85 lines
2.2 KiB
C#
85 lines
2.2 KiB
C#
using MongoDB.Bson;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace RanazePos.Api.Models;
|
|
|
|
public sealed class OrderDocument
|
|
{
|
|
[BsonId]
|
|
[BsonRepresentation(BsonType.ObjectId)]
|
|
[JsonPropertyName("_id")]
|
|
public string? Id { get; set; }
|
|
|
|
[BsonElement("number")]
|
|
[JsonPropertyName("number")]
|
|
public int Number { get; set; }
|
|
|
|
[BsonElement("customerName")]
|
|
[JsonPropertyName("customerName")]
|
|
public string CustomerName { get; set; } = "";
|
|
|
|
[BsonElement("paymentMethod")]
|
|
[JsonPropertyName("paymentMethod")]
|
|
public string PaymentMethod { get; set; } = "cash";
|
|
|
|
[BsonElement("status")]
|
|
[JsonPropertyName("status")]
|
|
public string Status { get; set; } = "new";
|
|
|
|
[BsonElement("lines")]
|
|
[JsonPropertyName("lines")]
|
|
public required List<OrderLineDocument> Lines { get; set; }
|
|
|
|
[BsonElement("total")]
|
|
[BsonRepresentation(BsonType.Decimal128)]
|
|
[JsonPropertyName("total")]
|
|
public decimal Total { get; set; }
|
|
|
|
[BsonElement("createdAt")]
|
|
[BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
|
|
[JsonPropertyName("createdAt")]
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
[BsonElement("updatedAt")]
|
|
[BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
|
|
[JsonPropertyName("updatedAt")]
|
|
public DateTime UpdatedAt { get; set; }
|
|
}
|
|
|
|
public sealed class OrderLineDocument
|
|
{
|
|
[BsonElement("menuItemId")]
|
|
[JsonPropertyName("menuItemId")]
|
|
public required string MenuItemId { get; set; }
|
|
|
|
[BsonElement("name")]
|
|
[JsonPropertyName("name")]
|
|
public required string Name { get; set; }
|
|
|
|
[BsonElement("basePrice")]
|
|
[BsonRepresentation(BsonType.Decimal128)]
|
|
[JsonPropertyName("basePrice")]
|
|
public decimal BasePrice { get; set; }
|
|
|
|
[BsonElement("size")]
|
|
[JsonPropertyName("size")]
|
|
public required string Size { get; set; }
|
|
|
|
[BsonElement("sweetness")]
|
|
[JsonPropertyName("sweetness")]
|
|
public required string Sweetness { get; set; }
|
|
|
|
[BsonElement("ice")]
|
|
[JsonPropertyName("ice")]
|
|
public required string Ice { get; set; }
|
|
|
|
[BsonElement("toppings")]
|
|
[JsonPropertyName("toppings")]
|
|
public List<string> Toppings { get; set; } = [];
|
|
|
|
[BsonElement("notes")]
|
|
[JsonPropertyName("notes")]
|
|
public string Notes { get; set; } = "";
|
|
}
|