2 Commits

Author SHA1 Message Date
e81551e5d1 Merge pull request 'feat: added ProductAdapter class' (#3) from feature/create-Product-and-ProductTag-CRUD-(adapters) into development
Reviewed-on: #3
Reviewed-by: Sergio Matías <sergio.matias@agilewebs.com>
2025-08-03 21:31:29 +00:00
0fcf1146f8 feat: added ProductAdapter class
- included relationship with TagAdapter
2025-08-03 14:53:06 -06:00

View File

@@ -0,0 +1,59 @@
using Core.Blueprint.Mongo;
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using System.Text.Json.Serialization;
namespace Core.Adapters.Lib.Inventory
{
/// <summary>
/// Represents the possible statuses of a product.
/// </summary>
public enum ProductStatus
{
Active,
Inactive,
Discontinued
}
[CollectionAttributeName("Product")]
public class ProductAdapter : Document
{
/// <summary>
/// Gets or sets the foreign key to the owning Tenant.
/// </summary>
[BsonElement("tenantId")]
[JsonPropertyName("tenantId")]
public string TenantId { get; set; } = null!;
/// <summary>
/// Gets or sets the name of the product.
/// </summary>
[BsonElement("productName")]
[JsonPropertyName("productName")]
public string ProductName { get; set; } = null!;
/// <summary>
/// Gets or sets the description of the product.
/// </summary>
[BsonElement("description")]
[JsonPropertyName("description")]
public string Description { get; set; } = null!;
/// <summary>
/// Gets or sets the status of the product. Stored as a string in MongoDB.
/// </summary>
[BsonElement("status")]
[JsonPropertyName("status")]
[BsonRepresentation(BsonType.String)]
public ProductStatus Status { get; set; }
/// <summary>
/// Gets or sets the list of Tag Ids associated with this product.
/// This follows the standard MongoDB practice for many-to-many relationships
/// by embedding an array of references.
/// </summary>
[BsonElement("tagIds")]
[JsonPropertyName("tagIds")]
public List<ObjectId> TagIds { get; set; } = new List<ObjectId>();
}
}