Completed initial database design
continuous-integration/drone/pr Build is passing

Sealed qualifying public classes
Migrated database changes
This commit is contained in:
Khwezi Mngoma
2026-05-27 09:12:04 +02:00
parent 70860efcfb
commit 902942eee6
86 changed files with 2883 additions and 140 deletions
@@ -0,0 +1,9 @@
using LiteCharms.Features.MidrandBooks.Orders.Entities;
namespace LiteCharms.Features.MidrandBooks.Payments.Entities;
[EntityTypeConfiguration<RefundConfiguration, Refund>]
public class Refund : Models.Refund
{
public virtual Order? Order { get; set; }
}
@@ -0,0 +1,22 @@
namespace LiteCharms.Features.MidrandBooks.Payments.Entities;
public sealed class RefundConfiguration : IEntityTypeConfiguration<Refund>
{
public void Configure(EntityTypeBuilder<Refund> builder)
{
builder.ToTable("Refunds");
builder.HasKey(r => r.Id);
builder.Property(r => r.OrderId).IsRequired();
builder.Property(o => o.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
builder.Property(o => o.UpdatedAt).HasDefaultValueSql("now()");
builder.Property(o => o.Status).IsRequired();
builder.Property(r => r.Amount).IsRequired().HasPrecision(18, 2);
builder.Property(r => r.Reason).HasMaxLength(1000);
builder.HasOne(r => r.Order)
.WithMany(o => o.Refunds)
.HasForeignKey(r => r.OrderId)
.OnDelete(DeleteBehavior.Restrict);
}
}
@@ -0,0 +1,20 @@
namespace LiteCharms.Features.MidrandBooks.Payments.Models;
public class Refund
{
public long Id { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public long OrderId { get; set; }
public RefundTypes Type { get; set; }
public RefundStatus Status { get; set; }
public string? Reason { get; set; }
public decimal Amount { get; set; }
}
@@ -0,0 +1,7 @@
using LiteCharms.Features.MidrandBooks.Abstractions;
namespace LiteCharms.Features.MidrandBooks.Payments;
public sealed class PaymentService : IService
{
}