Add scheme data model and migrations

This commit is contained in:
2026-08-21 14:10:40 +05:30
parent c9f5006727
commit f7101800cd
8 changed files with 694 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
using System.ComponentModel.DataAnnotations.Schema;
namespace Distribution.Models
{
public class SchemeRedemption
{
public Guid Id { get; set; } = Guid.NewGuid();
public Guid FK_SchemeId { get; set; }
[ForeignKey("FK_SchemeId")]
public Scheme Scheme { get; set; }
public Guid? FK_OrderId { get; set; }
[ForeignKey("FK_OrderId")]
public Order? Order { get; set; }
/// <summary>Placeholder for the future field-invoice module — no FieldInvoice entity exists yet.</summary>
public Guid? FieldInvoiceId { get; set; }
public decimal? DiscountAmount { get; set; }
public Guid? FK_FreeItemId { get; set; }
[ForeignKey("FK_FreeItemId")]
public Item? FreeItem { get; set; }
public decimal? FreeQty { get; set; }
/// <summary>
/// Cost price of the free item snapshotted at redemption time, so getSchemeROI stays
/// accurate even after the item's cost price later changes.
/// </summary>
public decimal? FreeItemCostValue { get; set; }
public DateTime RedeemedAt { get; set; } = DateTime.Now;
}
}