From 8d1e218eb941d7f9e5e2cb2cd6b06c5076637383 Mon Sep 17 00:00:00 2001 From: Sergio Matias Date: Thu, 31 Jul 2025 18:45:08 -0600 Subject: [PATCH] Added catalog and tenant adapter --- .../Adapters/CatalogAdapter.cs | 32 ++++++++++++ .../Adapters/TenantAdapter.cs | 51 +++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 Core.Thalos.BuildingBlocks/Adapters/CatalogAdapter.cs create mode 100644 Core.Thalos.BuildingBlocks/Adapters/TenantAdapter.cs diff --git a/Core.Thalos.BuildingBlocks/Adapters/CatalogAdapter.cs b/Core.Thalos.BuildingBlocks/Adapters/CatalogAdapter.cs new file mode 100644 index 0000000..dadfb29 --- /dev/null +++ b/Core.Thalos.BuildingBlocks/Adapters/CatalogAdapter.cs @@ -0,0 +1,32 @@ +using Core.Blueprint.Mongo; +using MongoDB.Bson; +using MongoDB.Bson.Serialization.Attributes; + +namespace Core.Thalos.BuildingBlocks.Adapters +{ + [CollectionAttributeName("Catalogs")] + public class CatalogAdapter : Document + { + [BsonElement("name")] + public string Name { get; set; } = null!; + + [BsonElement("key")] + public string? Key { get; set; } = null!; + + [BsonElement("description")] + public string? Description { get; set; } + + public IEnumerable? Values { get; set; } + } + + public class CatalogValue + { + [BsonId] + [BsonElement("_id")] + [BsonRepresentation(BsonType.ObjectId)] + public string _Id { get; set; } = null!; + + [BsonElement("value")] + public string Value { get; set; } = null!; + } +} \ No newline at end of file diff --git a/Core.Thalos.BuildingBlocks/Adapters/TenantAdapter.cs b/Core.Thalos.BuildingBlocks/Adapters/TenantAdapter.cs new file mode 100644 index 0000000..e768449 --- /dev/null +++ b/Core.Thalos.BuildingBlocks/Adapters/TenantAdapter.cs @@ -0,0 +1,51 @@ +using MongoDB.Bson; +using MongoDB.Bson.Serialization.Attributes; + +namespace Core.Thalos.BuildingBlocks +{ + public class TenantAdapter : Document + { + [BsonElement("name")] + public string Name { get; set; } = null!; + + [BsonElement("taxIdentifier")] + public string TaxIdentifier { get; set; } = null!; + + [BsonElement("addressLine1")] + public string AddressLine1 { get; set; } = null!; + + [BsonElement("addressLine2")] + [BsonIgnoreIfNull] + public string? AddressLine2 { get; set; } + + [BsonElement("city")] + public string City { get; set; } = null!; + + [BsonElement("state")] + public string State { get; set; } = null!; + + [BsonElement("country")] + public string Country { get; set; } = null!; + + [BsonElement("postalCode")] + public string PostalCode { get; set; } = null!; + + [BsonElement("contactEmail")] + public string ContactEmail { get; set; } = null!; + + [BsonElement("contactPhone")] + public string ContactPhone { get; set; } = null!; + + [BsonElement("website")] + [BsonIgnoreIfNull] + public string? Website { get; set; } + + [BsonElement("connectionString")] + [BsonIgnoreIfNull] + public string? ConnectionString { get; set; } + + [BsonElement("isolated")] + public bool Isolated { get; set; } + } + +}