From 18cb238b40b249c5e63668a118c6e3c6a369eb07 Mon Sep 17 00:00:00 2001 From: Ignacio Gomez Date: Sun, 22 Jun 2025 00:47:44 -0600 Subject: [PATCH] first version of inventory adapters --- Inventory/Base/InventoryItem.cs | 29 ---------------- Inventory/Common/FurnitureModel.cs | 53 ++++++++++++++++++++++++++++++ Inventory/InventoryItem.cs | 51 ++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 29 deletions(-) delete mode 100644 Inventory/Base/InventoryItem.cs create mode 100644 Inventory/Common/FurnitureModel.cs create mode 100644 Inventory/InventoryItem.cs diff --git a/Inventory/Base/InventoryItem.cs b/Inventory/Base/InventoryItem.cs deleted file mode 100644 index e45586b..0000000 --- a/Inventory/Base/InventoryItem.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Core.Blueprint.Mongo; -using MongoDB.Bson.Serialization.Attributes; -using System.Text.Json.Serialization; - -namespace Core.Adapters.Lib.Inventory.Base -{ - [CollectionAttributeName("Inventory")] - public class InventoryItem : Document - { - [BsonElement("name")] - [JsonPropertyName("name")] - public string Name { get; set; } - - [BsonElement("description")] - [JsonPropertyName("description")] - public string Description { get; set; } - - [BsonElement("stock")] - [JsonPropertyName("stock")] - public int Stock { get; set; } - - [BsonElement("representation")] - [JsonPropertyName("representation")] - public string Representation { get; set; } - - - public string Company { get; set; } - } -} diff --git a/Inventory/Common/FurnitureModel.cs b/Inventory/Common/FurnitureModel.cs new file mode 100644 index 0000000..64c09d0 --- /dev/null +++ b/Inventory/Common/FurnitureModel.cs @@ -0,0 +1,53 @@ +using Core.Blueprint.Mongo; +using MongoDB.Bson.Serialization.Attributes; +using System.Text.Json.Serialization; + +namespace Core.Adapters.Lib.Inventory.Common +{ + [CollectionAttributeName("Furniture")] + public class FurnitureModel : Document + { + [BsonElement("modelName")] + [JsonPropertyName("modelName")] + public string ModelName { get; set; } + + [BsonElement("material")] + [JsonPropertyName("material")] + public string Material { get; set; } + + [BsonElement("condition")] + [JsonPropertyName("condition")] + public string Condition { get; set; } + + [BsonElement("dimensions")] + [JsonPropertyName("dimensions")] + public Dimensions Dimensions { get; set; } + + [BsonElement("baseDescription")] + [JsonPropertyName("baseDescription")] + public string BaseDescription { get; set; } + + [BsonElement("representation")] + [JsonPropertyName("representation")] + public string Representation { get; set; } + + [BsonElement("maintenanceNotes")] + [JsonPropertyName("maintenanceNotes")] + public string MaintenanceNotes { get; set; } + } + + public class Dimensions + { + [BsonElement("width")] + [JsonPropertyName("width")] + public float Width { get; set; } + + [BsonElement("height")] + [JsonPropertyName("height")] + public float Height { get; set; } + + [BsonElement("depth")] + [JsonPropertyName("depth")] + public float Depth { get; set; } + } +} diff --git a/Inventory/InventoryItem.cs b/Inventory/InventoryItem.cs new file mode 100644 index 0000000..fade486 --- /dev/null +++ b/Inventory/InventoryItem.cs @@ -0,0 +1,51 @@ +using Core.Adapters.Lib.Inventory.Common; +using Core.Blueprint.Mongo; +using MongoDB.Bson.Serialization.Attributes; +using System.Text.Json.Serialization; + +namespace Core.Adapters.Lib.Inventory +{ + [CollectionAttributeName("Inventory")] + public class InventoryItem : FurnitureModel + { + [BsonElement("modelId")] + [JsonPropertyName("modelId")] + public string ModelId { get; set; } // FK a FurnitureModel._id + + [BsonElement("name")] + [JsonPropertyName("name")] + public string Name { get; set; } + + [BsonElement("color")] + [JsonPropertyName("color")] + public string Color { get; set; } + + [BsonElement("line")] + [JsonPropertyName("line")] + public string Line { get; set; } + + [BsonElement("price")] + [JsonPropertyName("price")] + public decimal Price { get; set; } + + [BsonElement("currency")] + [JsonPropertyName("currency")] + public string Currency { get; set; } + + [BsonElement("stock")] + [JsonPropertyName("stock")] + public int Stock { get; set; } + + [BsonElement("categoryId")] + [JsonPropertyName("categoryId")] + public Guid CategoryId { get; set; } + + [BsonElement("providerId")] + [JsonPropertyName("providerId")] + public Guid ProviderId { get; set; } + + [BsonElement("attributes")] + [JsonPropertyName("attributes")] + public Dictionary Attributes { get; set; } = new(); + } +}