Converting server to dotnet
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RanazePos.Api.Models;
|
||||
|
||||
public sealed class MenuItemDocument
|
||||
{
|
||||
[BsonId]
|
||||
[BsonRepresentation(BsonType.ObjectId)]
|
||||
[JsonPropertyName("_id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[BsonElement("name")]
|
||||
[JsonPropertyName("name")]
|
||||
public required string Name { get; set; }
|
||||
|
||||
[BsonElement("category")]
|
||||
[JsonPropertyName("category")]
|
||||
public required string Category { get; set; }
|
||||
|
||||
[BsonElement("description")]
|
||||
[JsonPropertyName("description")]
|
||||
public string Description { get; set; } = "";
|
||||
|
||||
[BsonElement("basePrice")]
|
||||
[BsonRepresentation(BsonType.Decimal128)]
|
||||
[JsonPropertyName("basePrice")]
|
||||
public decimal BasePrice { 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; }
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
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; } = "";
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace RanazePos.Api.Models;
|
||||
|
||||
public sealed class CreateMenuItemRequest
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? Category { get; set; }
|
||||
public string? Description { get; set; }
|
||||
public decimal? BasePrice { get; set; }
|
||||
}
|
||||
|
||||
public sealed class CreateOrderRequest
|
||||
{
|
||||
public string? CustomerName { get; set; }
|
||||
public string? PaymentMethod { get; set; }
|
||||
public List<OrderLineDocument>? Lines { get; set; }
|
||||
}
|
||||
|
||||
public sealed class UpdateOrderStatusRequest
|
||||
{
|
||||
public string? Status { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user