Implement store credit tracking and enforcement
Introduced StoreCreditMovement entity and migration to track store credit usage and settlements. Updated payment flow to enforce credit limits and record credit movements. Modified outstanding balance calculation to use credit movements. Enhanced frontend to display real-time credit info and prevent over-credit payments. Updated API types, seed data, and DI registrations accordingly.
This commit is contained in:
@@ -71,6 +71,7 @@ public class AppDBContext(DbContextOptions<AppDBContext> options) : DbContext(op
|
|||||||
public DbSet<ReceivedCheque> ReceivedCheques { get; set; }
|
public DbSet<ReceivedCheque> ReceivedCheques { get; set; }
|
||||||
public DbSet<SupplierPayment> SupplierPayments { get; set; }
|
public DbSet<SupplierPayment> SupplierPayments { get; set; }
|
||||||
public DbSet<SupplierPaymentGRN> SupplierPaymentGRNs { get; set; }
|
public DbSet<SupplierPaymentGRN> SupplierPaymentGRNs { get; set; }
|
||||||
|
public DbSet<StoreCreditMovement> StoreCreditMovements { get; set; }
|
||||||
|
|
||||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
{
|
{
|
||||||
@@ -707,6 +708,34 @@ public class AppDBContext(DbContextOptions<AppDBContext> options) : DbContext(op
|
|||||||
modelBuilder.Entity<SupplierPaymentGRN>()
|
modelBuilder.Entity<SupplierPaymentGRN>()
|
||||||
.HasIndex(a => a.FK_GoodsReceiptId);
|
.HasIndex(a => a.FK_GoodsReceiptId);
|
||||||
|
|
||||||
|
// --- StoreCreditMovement ---
|
||||||
|
|
||||||
|
modelBuilder.Entity<StoreCreditMovement>()
|
||||||
|
.HasOne(m => m.Store)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(m => m.FK_StoreId)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
modelBuilder.Entity<StoreCreditMovement>()
|
||||||
|
.HasOne(m => m.Invoice)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(m => m.FK_InvoiceId)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<StoreCreditMovement>()
|
||||||
|
.HasOne(m => m.Payment)
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey(m => m.FK_PaymentId)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict)
|
||||||
|
.IsRequired(false);
|
||||||
|
|
||||||
|
modelBuilder.Entity<StoreCreditMovement>()
|
||||||
|
.Property(m => m.Amount).HasPrecision(18, 2);
|
||||||
|
|
||||||
|
modelBuilder.Entity<StoreCreditMovement>()
|
||||||
|
.HasIndex(m => new { m.FK_StoreId, m.OccurredAt });
|
||||||
|
|
||||||
Seed.RoleAndPermissionSeed.Apply(modelBuilder);
|
Seed.RoleAndPermissionSeed.Apply(modelBuilder);
|
||||||
Seed.MasterDataSeed.Apply(modelBuilder);
|
Seed.MasterDataSeed.Apply(modelBuilder);
|
||||||
Seed.OperationsDataSeed.Apply(modelBuilder);
|
Seed.OperationsDataSeed.Apply(modelBuilder);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public record PrintInvoiceRequest(Guid? PrintedByUserId = null);
|
|||||||
public record InvoiceResponse(
|
public record InvoiceResponse(
|
||||||
Guid Id,
|
Guid Id,
|
||||||
Guid ShopPOId,
|
Guid ShopPOId,
|
||||||
|
Guid StoreId,
|
||||||
string StoreName,
|
string StoreName,
|
||||||
InvoiceStatus Status,
|
InvoiceStatus Status,
|
||||||
PaymentStatus PaymentStatus,
|
PaymentStatus PaymentStatus,
|
||||||
@@ -19,6 +20,7 @@ public record InvoiceResponse(
|
|||||||
DateTime? FinalizedAt,
|
DateTime? FinalizedAt,
|
||||||
Guid? FinalizedBy,
|
Guid? FinalizedBy,
|
||||||
decimal TotalAmount,
|
decimal TotalAmount,
|
||||||
|
decimal PaidAmount,
|
||||||
bool IsActive,
|
bool IsActive,
|
||||||
DateTime CreatedAt);
|
DateTime CreatedAt);
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class InvoiceRepository(AppDBContext context) : IInvoiceRepository
|
|||||||
public async Task<List<Models.Invoice>> GetAllAsync(Guid? agentId, Guid? routeId, Guid? shopId, InvoiceStatus? status, PaymentStatus? paymentStatus, int page, int pageSize) =>
|
public async Task<List<Models.Invoice>> GetAllAsync(Guid? agentId, Guid? routeId, Guid? shopId, InvoiceStatus? status, PaymentStatus? paymentStatus, int page, int pageSize) =>
|
||||||
await context.Invoices
|
await context.Invoices
|
||||||
.Include(i => i.ShopPO).ThenInclude(p => p.Store)
|
.Include(i => i.ShopPO).ThenInclude(p => p.Store)
|
||||||
|
.Include(i => i.Payments.Where(p => p.IsActive))
|
||||||
.Where(i => i.IsActive
|
.Where(i => i.IsActive
|
||||||
&& (agentId == null || i.ShopPO.RaisedById == agentId)
|
&& (agentId == null || i.ShopPO.RaisedById == agentId)
|
||||||
&& (routeId == null || i.ShopPO.Store.FK_RouteId == routeId)
|
&& (routeId == null || i.ShopPO.Store.FK_RouteId == routeId)
|
||||||
|
|||||||
@@ -12,11 +12,14 @@ public class InvoiceService(
|
|||||||
{
|
{
|
||||||
private static InvoiceResponse ToResponse(Models.Invoice i) =>
|
private static InvoiceResponse ToResponse(Models.Invoice i) =>
|
||||||
new(i.Id, i.FK_ShopPOId,
|
new(i.Id, i.FK_ShopPOId,
|
||||||
|
i.ShopPO?.FK_StoreId ?? Guid.Empty,
|
||||||
i.ShopPO?.Store?.StoreName ?? string.Empty,
|
i.ShopPO?.Store?.StoreName ?? string.Empty,
|
||||||
i.Status, i.PaymentStatus, i.CreatedBy,
|
i.Status, i.PaymentStatus, i.CreatedBy,
|
||||||
i.PrintedAt, i.PrintedBy,
|
i.PrintedAt, i.PrintedBy,
|
||||||
i.FinalizedAt, i.FinalizedBy,
|
i.FinalizedAt, i.FinalizedBy,
|
||||||
i.TotalAmount, i.IsActive, i.CreatedAt);
|
i.TotalAmount,
|
||||||
|
i.Payments?.Where(p => p.IsActive).Sum(p => p.Amount) ?? 0m,
|
||||||
|
i.IsActive, i.CreatedAt);
|
||||||
|
|
||||||
public async Task<InvoiceResponse?> GetByIdAsync(Guid id)
|
public async Task<InvoiceResponse?> GetByIdAsync(Guid id)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Distribution.Features.BankAccount;
|
using Distribution.Features.BankAccount;
|
||||||
using Distribution.Features.Invoice;
|
using Distribution.Features.Invoice;
|
||||||
using Distribution.Features.ReceivedCheque;
|
using Distribution.Features.ReceivedCheque;
|
||||||
|
using Distribution.Features.StoreCredit;
|
||||||
using Distribution.Infra.Authorization;
|
using Distribution.Infra.Authorization;
|
||||||
using Distribution.Infra.UoW;
|
using Distribution.Infra.UoW;
|
||||||
using Distribution.Models;
|
using Distribution.Models;
|
||||||
@@ -12,6 +13,7 @@ public class PaymentService(
|
|||||||
IInvoiceRepository invoiceRepo,
|
IInvoiceRepository invoiceRepo,
|
||||||
IBankAccountRepository bankAccountRepo,
|
IBankAccountRepository bankAccountRepo,
|
||||||
IReceivedChequeRepository receivedChequeRepo,
|
IReceivedChequeRepository receivedChequeRepo,
|
||||||
|
IStoreCreditMovementRepository creditRepo,
|
||||||
IUnitOfWork uow,
|
IUnitOfWork uow,
|
||||||
ICurrentUserService currentUser)
|
ICurrentUserService currentUser)
|
||||||
{
|
{
|
||||||
@@ -34,12 +36,16 @@ public class PaymentService(
|
|||||||
{
|
{
|
||||||
var invoice = await invoiceRepo.GetByIdAsync(invoiceId);
|
var invoice = await invoiceRepo.GetByIdAsync(invoiceId);
|
||||||
if (invoice is null || !invoice.IsActive) return null;
|
if (invoice is null || !invoice.IsActive) return null;
|
||||||
if (invoice.Status == InvoiceStatus.Finalized)
|
|
||||||
throw new InvalidOperationException("Cannot record a payment against a finalized invoice");
|
|
||||||
|
|
||||||
if (request.Amount <= 0)
|
if (request.Amount <= 0)
|
||||||
throw new InvalidOperationException("Amount must be greater than zero");
|
throw new InvalidOperationException("Amount must be greater than zero");
|
||||||
|
|
||||||
|
var existingPaid = (await repo.GetByInvoiceIdAsync(invoiceId)).Sum(p => p.Amount);
|
||||||
|
var remaining = invoice.TotalAmount - existingPaid;
|
||||||
|
if (request.Amount > remaining)
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
$"Amount exceeds the outstanding balance of {remaining:0.##}");
|
||||||
|
|
||||||
if (request.Method == PaymentMethod.Cheque &&
|
if (request.Method == PaymentMethod.Cheque &&
|
||||||
(string.IsNullOrWhiteSpace(request.ChequeNumber) || request.ChequeDate is null))
|
(string.IsNullOrWhiteSpace(request.ChequeNumber) || request.ChequeDate is null))
|
||||||
throw new InvalidOperationException("ChequeNumber and ChequeDate are required when Method is Cheque");
|
throw new InvalidOperationException("ChequeNumber and ChequeDate are required when Method is Cheque");
|
||||||
@@ -47,6 +53,19 @@ public class PaymentService(
|
|||||||
if (request.Method == PaymentMethod.Cash && request.BankAccountId is null)
|
if (request.Method == PaymentMethod.Cash && request.BankAccountId is null)
|
||||||
throw new InvalidOperationException("BankAccountId is required when Method is Cash");
|
throw new InvalidOperationException("BankAccountId is required when Method is Cash");
|
||||||
|
|
||||||
|
if (request.Method == PaymentMethod.Credit)
|
||||||
|
{
|
||||||
|
var store = invoice.ShopPO?.Store
|
||||||
|
?? throw new InvalidOperationException("Invoice is missing the owning store; cannot record a credit payment");
|
||||||
|
var currentOutstanding = await creditRepo.GetOutstandingForStoreAsync(store.Id);
|
||||||
|
if (currentOutstanding + request.Amount > store.CreditLimit)
|
||||||
|
{
|
||||||
|
var available = store.CreditLimit - currentOutstanding;
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
$"Credit limit exceeded. Available credit: {available:0.##}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Models.BankAccount? bankAccount = null;
|
Models.BankAccount? bankAccount = null;
|
||||||
if (request.BankAccountId is not null)
|
if (request.BankAccountId is not null)
|
||||||
{
|
{
|
||||||
@@ -107,9 +126,22 @@ public class PaymentService(
|
|||||||
|
|
||||||
await repo.AddAsync(payment);
|
await repo.AddAsync(payment);
|
||||||
|
|
||||||
var allPayments = await repo.GetByInvoiceIdAsync(invoiceId);
|
if (request.Method == PaymentMethod.Credit)
|
||||||
var total = allPayments.Sum(p => p.Amount) + request.Amount;
|
{
|
||||||
|
var movement = new StoreCreditMovement
|
||||||
|
{
|
||||||
|
FK_StoreId = invoice.ShopPO!.Store!.Id,
|
||||||
|
Direction = StoreCreditMovementDirection.Usage,
|
||||||
|
Amount = request.Amount,
|
||||||
|
FK_InvoiceId = invoice.Id,
|
||||||
|
FK_PaymentId = payment.Id,
|
||||||
|
OccurredAt = DateTime.Now,
|
||||||
|
RecordedBy = recorderId
|
||||||
|
};
|
||||||
|
await creditRepo.AddAsync(movement);
|
||||||
|
}
|
||||||
|
|
||||||
|
var total = existingPaid + request.Amount;
|
||||||
invoice.PaymentStatus = total == 0
|
invoice.PaymentStatus = total == 0
|
||||||
? PaymentStatus.Pending
|
? PaymentStatus.Pending
|
||||||
: total < invoice.TotalAmount
|
: total < invoice.TotalAmount
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
using Distribution.Features.Scheme;
|
using Distribution.Features.Scheme;
|
||||||
using Distribution.Features.Stock;
|
using Distribution.Features.Stock;
|
||||||
|
using Distribution.Features.StoreCredit;
|
||||||
using Distribution.Infra.Authorization;
|
using Distribution.Infra.Authorization;
|
||||||
using Distribution.Infra.UoW;
|
using Distribution.Infra.UoW;
|
||||||
using Distribution.Models;
|
using Distribution.Models;
|
||||||
|
|
||||||
namespace Distribution.Features.Store;
|
namespace Distribution.Features.Store;
|
||||||
|
|
||||||
public class StoreService(IStoreRepository repo, IUnitOfWork uow, ICurrentUserService currentUser, IScopeAccessService scopeAccess, SchemeService schemeService, Route.IRouteRepository routeRepo)
|
public class StoreService(IStoreRepository repo, IUnitOfWork uow, ICurrentUserService currentUser, IScopeAccessService scopeAccess, SchemeService schemeService, Route.IRouteRepository routeRepo, IStoreCreditMovementRepository creditRepo)
|
||||||
{
|
{
|
||||||
private const int GlobalScopeRoleLevel = 50;
|
private const int GlobalScopeRoleLevel = 50;
|
||||||
private const int CreditApproverRoleLevel = 20;
|
private const int CreditApproverRoleLevel = 20;
|
||||||
@@ -167,7 +168,8 @@ public class StoreService(IStoreRepository repo, IUnitOfWork uow, ICurrentUserSe
|
|||||||
var store = await repo.GetByIdAsync(id);
|
var store = await repo.GetByIdAsync(id);
|
||||||
if (store is null || !store.IsActive) return null;
|
if (store is null || !store.IsActive) return null;
|
||||||
if (!await HasStoreScopeAsync(id)) return null;
|
if (!await HasStoreScopeAsync(id)) return null;
|
||||||
return new OutstandingBalanceResponse(store.Id, store.CreditLimit, store.OutstandingBalance, store.CreditLimit - store.OutstandingBalance);
|
var outstanding = await creditRepo.GetOutstandingForStoreAsync(id);
|
||||||
|
return new OutstandingBalanceResponse(store.Id, store.CreditLimit, outstanding, store.CreditLimit - outstanding);
|
||||||
}
|
}
|
||||||
public async Task<StoreResponse?> ClassifySegmentAsync(Guid id, ClassifySegmentRequest request, CancellationToken ct = default)
|
public async Task<StoreResponse?> ClassifySegmentAsync(Guid id, ClassifySegmentRequest request, CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using Distribution.Models;
|
||||||
|
|
||||||
|
namespace Distribution.Features.StoreCredit;
|
||||||
|
|
||||||
|
public interface IStoreCreditMovementRepository
|
||||||
|
{
|
||||||
|
Task<decimal> GetOutstandingForStoreAsync(Guid storeId);
|
||||||
|
Task<List<StoreCreditMovement>> GetByStoreAsync(Guid storeId, int page, int pageSize);
|
||||||
|
Task<int> GetCountByStoreAsync(Guid storeId);
|
||||||
|
Task AddAsync(StoreCreditMovement movement);
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Distribution.Data;
|
||||||
|
using Distribution.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Distribution.Features.StoreCredit;
|
||||||
|
|
||||||
|
public class StoreCreditMovementRepository(AppDBContext context) : IStoreCreditMovementRepository
|
||||||
|
{
|
||||||
|
public async Task<decimal> GetOutstandingForStoreAsync(Guid storeId)
|
||||||
|
{
|
||||||
|
var usage = await context.StoreCreditMovements
|
||||||
|
.Where(m => m.IsActive && m.FK_StoreId == storeId && m.Direction == StoreCreditMovementDirection.Usage)
|
||||||
|
.SumAsync(m => (decimal?)m.Amount) ?? 0m;
|
||||||
|
|
||||||
|
var settlements = await context.StoreCreditMovements
|
||||||
|
.Where(m => m.IsActive && m.FK_StoreId == storeId && m.Direction == StoreCreditMovementDirection.Settlement)
|
||||||
|
.SumAsync(m => (decimal?)m.Amount) ?? 0m;
|
||||||
|
|
||||||
|
return usage - settlements;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<StoreCreditMovement>> GetByStoreAsync(Guid storeId, int page, int pageSize) =>
|
||||||
|
await context.StoreCreditMovements
|
||||||
|
.Where(m => m.IsActive && m.FK_StoreId == storeId)
|
||||||
|
.OrderByDescending(m => m.OccurredAt)
|
||||||
|
.Skip((page - 1) * pageSize)
|
||||||
|
.Take(pageSize)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
public async Task<int> GetCountByStoreAsync(Guid storeId) =>
|
||||||
|
await context.StoreCreditMovements
|
||||||
|
.CountAsync(m => m.IsActive && m.FK_StoreId == storeId);
|
||||||
|
|
||||||
|
public async Task AddAsync(StoreCreditMovement movement) =>
|
||||||
|
await context.StoreCreditMovements.AddAsync(movement);
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,778 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Distribution.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class credittable : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "StoreCreditMovements",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
FK_StoreId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
||||||
|
Direction = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Amount = table.Column<decimal>(type: "decimal(18,2)", precision: 18, scale: 2, nullable: false),
|
||||||
|
FK_InvoiceId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
FK_PaymentId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
OccurredAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
RecordedBy = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
|
||||||
|
Notes = table.Column<string>(type: "longtext", nullable: true)
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||||
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
||||||
|
IsActive = table.Column<bool>(type: "tinyint(1)", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_StoreCreditMovements", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_StoreCreditMovements_Invoices_FK_InvoiceId",
|
||||||
|
column: x => x.FK_InvoiceId,
|
||||||
|
principalTable: "Invoices",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_StoreCreditMovements_Payments_FK_PaymentId",
|
||||||
|
column: x => x.FK_PaymentId,
|
||||||
|
principalTable: "Payments",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_StoreCreditMovements_Stores_FK_StoreId",
|
||||||
|
column: x => x.FK_StoreId,
|
||||||
|
principalTable: "Stores",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
})
|
||||||
|
.Annotation("MySql:CharSet", "utf8mb4");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000001"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("be712eda-98a5-4a30-820a-1737e84d1e4b"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000002"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("47ea9420-d6a0-4376-a2b8-211639d95b27"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000003"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("369eed1f-df4c-4131-a3c6-ebbe63d2dc91"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000004"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("14b6944f-2d4a-4378-a974-c6fc0f9dfb81"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000005"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("14a01e0b-7be5-4c65-ae6a-899f9aa7ad28"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000006"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("5d486ccd-3866-4e7d-8ef1-fb177fb637c1"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000007"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("d830e59b-f451-4bde-9a77-78daea5f9a61"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000008"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("096d3837-a649-4184-8987-2ea0dfa2d4a1"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000009"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("5e43bbde-689b-4d07-baf9-0764078b5586"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000010"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("f317d30c-1644-44f0-b0aa-6bcf1fa66f44"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000011"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("31ffac6f-2aa8-48ee-bc87-213f35933de4"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000012"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("fb525bc4-9f16-455a-bfd5-ca6f3e7ad141"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000013"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("2388918f-6392-4384-b269-0a1469f5bf4c"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000014"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("7159012e-5f25-4881-b5e8-5300e382332e"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000015"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("cc4b2e82-ad42-4440-92ba-9b2100bb5f84"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000016"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("6b15c133-ea0e-473d-b58a-7f140e9f03bf"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000017"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("c2dd52a9-380f-479f-8e5e-6b56bfc4738f"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000018"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("bf5f6c7a-2fde-4a01-83f4-aacf91333c4c"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000019"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("162a0346-c4c0-4c4e-96e9-aa8154d25b39"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000020"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("5cc76807-25d1-45e5-9da3-cfd6d6f3ad7c"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000021"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("51a2653e-4b1a-4f6f-80c2-f533b26109ea"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000022"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("e2a382e2-d712-4a97-a7ec-cd6232d77a78"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000023"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("b60260b5-70b0-4f9e-9ab9-ba4abbbdfb02"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000024"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("a73fe794-383c-4157-89cf-227c4e487a6d"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000025"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("a9743e96-15b2-4c1d-b410-698cd6db0b7b"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000026"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("a94d92ab-66d8-4dd9-8ba3-c242eb450e68"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000027"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("9cb1a028-a98e-492a-aafc-70456fe46c96"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000028"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("5bc99a62-f5d7-48fe-b25c-518e4774614c"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000029"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("eceee678-5cee-4ee9-b16d-8d8d21fbb5ea"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000030"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("3a049ed7-75b7-4b1d-b3bb-402ca77c350f"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000031"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("aeaab85c-5b02-4bc2-b0e3-318c0f5b07d3"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000032"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("b79800e0-baa6-4add-9374-7d1e2ed650e8"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000033"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("0da6bf0b-26ff-46b9-bb8c-f9c641b37a89"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000034"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("ff84aeeb-93c0-465d-9a4a-8b686ba7bc75"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000035"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("921f8073-7a66-49bb-ae23-cf8fcde12c9c"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000036"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("bff05501-4988-4c8a-b61d-e32389e795a8"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000037"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("2c4f7432-e697-4d65-97df-069f8913a662"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000038"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("18d27746-3178-4c57-afd5-b75f0061637f"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000039"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("a5d1978b-c497-4314-857b-a7e3b8323a53"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000040"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("88300763-b8c3-4bd2-803b-df0e43bc691e"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000041"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("7aaad5a9-4497-429f-b3dc-9b59664e2e19"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000042"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("2db130c1-4b6f-4719-b3bb-7bd8a0662d75"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000043"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("be349d14-38b5-4a13-a152-9ea055de26b1"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000044"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("5292e02d-9a7d-4a18-be14-86c2f3351cac"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000045"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("97021474-1218-4d21-9115-4b9b2726e38b"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000046"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("56f68355-7b1b-49e4-829c-1a4d47fc93de"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000047"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("3017c8cb-f9e4-41c8-ac2e-f03d23fe944a"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000048"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("619a08e5-f6cb-4515-8b4d-a094d19277d8"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000049"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("cb8b4e96-7026-4485-8b52-3145b5289350"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000050"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("f0f57dfd-21a5-4a0b-a77e-e641f00300fa"));
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_StoreCreditMovements_FK_InvoiceId",
|
||||||
|
table: "StoreCreditMovements",
|
||||||
|
column: "FK_InvoiceId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_StoreCreditMovements_FK_PaymentId",
|
||||||
|
table: "StoreCreditMovements",
|
||||||
|
column: "FK_PaymentId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_StoreCreditMovements_FK_StoreId_OccurredAt",
|
||||||
|
table: "StoreCreditMovements",
|
||||||
|
columns: new[] { "FK_StoreId", "OccurredAt" });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "StoreCreditMovements");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000001"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("30f658ac-2c92-4cd8-ad47-10b0def2699c"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000002"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("42ab2c52-eaf8-4a17-b67a-ccd66569e56a"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000003"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("8afec825-27b3-4153-ad06-f8bcdbf93da8"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000004"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("4b427620-e99d-4068-a416-c3788d5bd9b5"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000005"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("361f44ef-1cd1-48a9-be4d-4c068aacef1e"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000006"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("11fc03ae-92ee-4336-ae57-29aac731ad51"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000007"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("0b1f2b73-ef60-4634-864f-22a6c0cd1373"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000008"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("2380abf3-2bcd-4a9f-b447-5f1685df2fc8"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000009"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("240e4d6a-8306-40ba-aaec-8e05cd0347db"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000010"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("cfde0aa6-e859-4f9c-8291-b0d886fcd4c9"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000011"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("dae772c8-26ec-4b5c-8d7a-f3196510bf2c"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000012"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("3512c0a4-a5ae-4002-a779-7d3cc600ab61"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000013"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("f9e2a348-159e-47a2-b7be-a60f0254873f"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000014"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("c8b4c181-5b08-45d2-818b-74bceeab78a8"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000015"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("8fb4ff4c-c5bd-4afd-a08e-02861d63cb7b"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000016"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("edb3b711-d623-439d-811e-afaef8d0680d"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000017"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("f33e4c62-d69f-4a91-8b62-acbd5351ea2a"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000018"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("c7c9d16c-e343-43e9-9e27-f38f903a5d00"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000019"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("f5f4760a-8a45-46ca-8093-743c95b0313f"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000020"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("c5434801-146a-4fd9-9c29-a1145e7f7f00"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000021"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("6c085135-78a5-4e65-a380-ee090b07e2bb"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000022"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("bbde2785-a3df-4f81-bad1-0bc5afe5de57"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000023"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("4421a0fb-bdd4-45a9-8dc0-d9b70f775e97"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000024"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("dba9dcb4-3b94-4ddc-89f3-552cfc109478"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000025"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("d8f74160-c150-4d9c-aba6-e45e628c684e"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000026"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("495fb68b-9f01-4538-9561-fefce0d39558"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000027"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("3bdece9b-a798-4223-a23c-9c9dd10d042d"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000028"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("6fa616eb-99fe-46b9-8305-908765d037fd"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000029"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("7a07148a-1327-4e97-befc-b2045eacad21"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000030"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("852e86d7-aa57-4a77-81c0-054f3fb4d7f7"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000031"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("3b767929-c973-41fb-a340-4ee5feb65619"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000032"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("63619bbd-0352-41bd-9e1c-a3f7908fb5d2"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000033"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("f6b4c8bf-a9b3-4179-9f57-a8584678c0d1"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000034"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("bb47b8ca-f7cf-40fe-8945-fc532a439b53"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000035"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("52126271-ae3b-4b58-a9d2-50e2dd894087"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000036"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("981e3358-85bb-47fe-a1f5-3a3a02cf47b1"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000037"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("749408da-fcee-458d-9144-8d8dee928ba0"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000038"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("c157857c-fb0e-41fd-a414-c0f57a44b120"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000039"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("3217cdbc-76c9-4505-b9f3-23de91a6212b"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000040"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("63526c52-18ba-40e0-9889-3bd3b7fc8161"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000041"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("260cf2fa-1ca6-4cd5-92ae-8c479a80e2f0"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000042"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("130ab09c-8a36-4705-8235-9d00f75dd684"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000043"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("41794774-e919-4f4e-a42a-5ae408d3407f"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000044"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("2ff23d04-d1f6-4aa3-a48e-1c82bb9ad12a"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000045"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("d36c81c0-8e9b-41ea-8e09-464a327a16d2"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000046"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("6c51dfc1-63e0-46a6-b2bb-27c21c708b51"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000047"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("076333d5-b1f3-4b89-86fd-5a61a4451c88"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000048"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("7e834f3e-1424-4aaa-816e-d62da6df672b"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000049"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("699fa06b-a7ff-4dbd-98a7-a29c2c361665"));
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "RolePermissions",
|
||||||
|
keyColumns: new[] { "FK_PermissionId", "FK_RoleId" },
|
||||||
|
keyValues: new object[] { new Guid("20000000-0000-0000-0000-000000000050"), new Guid("10000000-0000-0000-0000-000000000007") },
|
||||||
|
column: "Id",
|
||||||
|
value: new Guid("00df5735-54c6-4cdf-8e2c-a64cd90ede15"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,8 @@ namespace Distribution.Models
|
|||||||
|
|
||||||
public enum PaymentMethod { Cash, Cheque, Credit }
|
public enum PaymentMethod { Cash, Cheque, Credit }
|
||||||
|
|
||||||
|
public enum StoreCreditMovementDirection { Usage, Settlement }
|
||||||
|
|
||||||
public enum EntryMode { RealTime, DayEndManual }
|
public enum EntryMode { RealTime, DayEndManual }
|
||||||
|
|
||||||
public enum DeliveryTaskStatus { Pending, Delivered, PartiallyDelivered, Failed }
|
public enum DeliveryTaskStatus { Pending, Delivered, PartiallyDelivered, Failed }
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace Distribution.Models
|
||||||
|
{
|
||||||
|
public class StoreCreditMovement : Template
|
||||||
|
{
|
||||||
|
public Guid FK_StoreId { get; set; }
|
||||||
|
[ForeignKey("FK_StoreId")]
|
||||||
|
public Store? Store { get; set; }
|
||||||
|
|
||||||
|
public StoreCreditMovementDirection Direction { get; set; }
|
||||||
|
|
||||||
|
public decimal Amount { get; set; }
|
||||||
|
|
||||||
|
public Guid? FK_InvoiceId { get; set; }
|
||||||
|
[ForeignKey("FK_InvoiceId")]
|
||||||
|
public Invoice? Invoice { get; set; }
|
||||||
|
|
||||||
|
public Guid? FK_PaymentId { get; set; }
|
||||||
|
[ForeignKey("FK_PaymentId")]
|
||||||
|
public Payment? Payment { get; set; }
|
||||||
|
|
||||||
|
public DateTime OccurredAt { get; set; } = DateTime.Now;
|
||||||
|
public Guid? RecordedBy { get; set; }
|
||||||
|
public string? Notes { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -100,6 +100,7 @@ builder.Services.AddScoped<IBankAccountRepository, BankAccountRepository>();
|
|||||||
builder.Services.AddScoped<IChequeBookRepository, ChequeBookRepository>();
|
builder.Services.AddScoped<IChequeBookRepository, ChequeBookRepository>();
|
||||||
builder.Services.AddScoped<IReceivedChequeRepository, ReceivedChequeRepository>();
|
builder.Services.AddScoped<IReceivedChequeRepository, ReceivedChequeRepository>();
|
||||||
builder.Services.AddScoped<ISupplierPaymentRepository, SupplierPaymentRepository>();
|
builder.Services.AddScoped<ISupplierPaymentRepository, SupplierPaymentRepository>();
|
||||||
|
builder.Services.AddScoped<Distribution.Features.StoreCredit.IStoreCreditMovementRepository, Distribution.Features.StoreCredit.StoreCreditMovementRepository>();
|
||||||
|
|
||||||
builder.Services.AddScoped<RegionService>();
|
builder.Services.AddScoped<RegionService>();
|
||||||
builder.Services.AddScoped<RouteService>();
|
builder.Services.AddScoped<RouteService>();
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import {
|
|||||||
} from '@/components/ui/dialog'
|
} from '@/components/ui/dialog'
|
||||||
import { FieldGroup } from '@/components/ui/field'
|
import { FieldGroup } from '@/components/ui/field'
|
||||||
import { toast } from '@/components/ui/toast'
|
import { toast } from '@/components/ui/toast'
|
||||||
import { payments as paymentsApi, bankAccounts as bankAccountsApi, getApiError } from '@/lib/api/index'
|
import { payments as paymentsApi, bankAccounts as bankAccountsApi, stores as storesApi, getApiError } from '@/lib/api/index'
|
||||||
import type { InvoiceResponse } from '@/types/api'
|
import type { InvoiceResponse, OutstandingBalanceResponse } from '@/types/api'
|
||||||
import type { BankAccountResponse } from '@/types/payments'
|
import type { BankAccountResponse } from '@/types/payments'
|
||||||
|
|
||||||
const schema = z
|
const schema = z
|
||||||
@@ -67,6 +67,7 @@ const truncId = (id: string) => id.substring(0, 8)
|
|||||||
|
|
||||||
export function PaymentSheet({ open, onClose, onSuccess, invoices, defaultInvoiceId }: PaymentSheetProps) {
|
export function PaymentSheet({ open, onClose, onSuccess, invoices, defaultInvoiceId }: PaymentSheetProps) {
|
||||||
const [accounts, setAccounts] = useState<BankAccountResponse[]>([])
|
const [accounts, setAccounts] = useState<BankAccountResponse[]>([])
|
||||||
|
const [credit, setCredit] = useState<OutstandingBalanceResponse | null>(null)
|
||||||
|
|
||||||
const form = useForm<FormValues>({
|
const form = useForm<FormValues>({
|
||||||
resolver: zodResolver(schema),
|
resolver: zodResolver(schema),
|
||||||
@@ -84,6 +85,16 @@ export function PaymentSheet({ open, onClose, onSuccess, invoices, defaultInvoic
|
|||||||
})
|
})
|
||||||
|
|
||||||
const method = form.watch('method')
|
const method = form.watch('method')
|
||||||
|
const invoiceId = form.watch('invoiceId')
|
||||||
|
const amount = form.watch('amount')
|
||||||
|
const selectedInvoice = invoices.find((inv) => inv.id === invoiceId)
|
||||||
|
const selectedStoreId = selectedInvoice?.storeId
|
||||||
|
const remaining = selectedInvoice ? selectedInvoice.totalAmount - selectedInvoice.paidAmount : 0
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open || !selectedInvoice) return
|
||||||
|
form.setValue('amount', Number((selectedInvoice.totalAmount - selectedInvoice.paidAmount).toFixed(2)))
|
||||||
|
}, [open, selectedInvoice?.id])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!open) return
|
if (!open) return
|
||||||
@@ -101,10 +112,39 @@ export function PaymentSheet({ open, onClose, onSuccess, invoices, defaultInvoic
|
|||||||
bankAccountsApi.list()
|
bankAccountsApi.list()
|
||||||
.then(list => setAccounts(list.filter(a => a.isActive !== false)))
|
.then(list => setAccounts(list.filter(a => a.isActive !== false)))
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
|
setCredit(null)
|
||||||
}, [open, defaultInvoiceId])
|
}, [open, defaultInvoiceId])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open || method !== 'Credit' || !selectedStoreId) {
|
||||||
|
setCredit(null)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let cancelled = false
|
||||||
|
storesApi.outstandingBalance(selectedStoreId)
|
||||||
|
.then((data) => { if (!cancelled) setCredit(data) })
|
||||||
|
.catch(() => { if (!cancelled) setCredit(null) })
|
||||||
|
return () => { cancelled = true }
|
||||||
|
}, [open, method, selectedStoreId])
|
||||||
|
|
||||||
async function onSubmit(values: FormValues) {
|
async function onSubmit(values: FormValues) {
|
||||||
const { invoiceId, method, bankAccountId, chequeNumber, chequeDate, drawerBankName, accountHolderName, ...rest } = values
|
const { invoiceId, method, bankAccountId, chequeNumber, chequeDate, drawerBankName, accountHolderName, ...rest } = values
|
||||||
|
if (selectedInvoice && values.amount > remaining) {
|
||||||
|
toast.add({
|
||||||
|
title: 'Amount exceeds outstanding balance',
|
||||||
|
description: `Outstanding: Rs. ${remaining.toLocaleString()}`,
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (method === 'Credit' && credit && values.amount > credit.availableCredit) {
|
||||||
|
toast.add({
|
||||||
|
title: 'Credit limit exceeded',
|
||||||
|
description: `Available credit: Rs. ${credit.availableCredit.toLocaleString()}`,
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await paymentsApi.create(invoiceId, {
|
await paymentsApi.create(invoiceId, {
|
||||||
...rest,
|
...rest,
|
||||||
@@ -161,6 +201,7 @@ export function PaymentSheet({ open, onClose, onSuccess, invoices, defaultInvoic
|
|||||||
name="amount"
|
name="amount"
|
||||||
label="Amount"
|
label="Amount"
|
||||||
required
|
required
|
||||||
|
description={selectedInvoice ? `Outstanding: ${fmtAmount(remaining)}` : undefined}
|
||||||
render={({ field, invalid }) => (
|
render={({ field, invalid }) => (
|
||||||
<Input
|
<Input
|
||||||
id="amount"
|
id="amount"
|
||||||
@@ -172,7 +213,7 @@ export function PaymentSheet({ open, onClose, onSuccess, invoices, defaultInvoic
|
|||||||
onChange={(e) => field.onChange(Number(e.target.value))}
|
onChange={(e) => field.onChange(Number(e.target.value))}
|
||||||
onBlur={field.onBlur}
|
onBlur={field.onBlur}
|
||||||
placeholder="0.00"
|
placeholder="0.00"
|
||||||
aria-invalid={invalid}
|
aria-invalid={invalid || (selectedInvoice ? amount > remaining : false)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
@@ -196,6 +237,36 @@ export function PaymentSheet({ open, onClose, onSuccess, invoices, defaultInvoic
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{method === 'Credit' && selectedStoreId && (
|
||||||
|
<div className="rounded-md border bg-muted/40 p-3 text-sm">
|
||||||
|
{credit ? (
|
||||||
|
<div className="flex flex-col gap-1">
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-muted-foreground">Credit limit</span>
|
||||||
|
<span>{fmtAmount(credit.creditLimit)}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<span className="text-muted-foreground">Currently used</span>
|
||||||
|
<span>{fmtAmount(credit.outstandingBalance)}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex justify-between font-medium">
|
||||||
|
<span>Available</span>
|
||||||
|
<span className={amount > credit.availableCredit ? 'text-destructive' : ''}>
|
||||||
|
{fmtAmount(credit.availableCredit)}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{amount > credit.availableCredit && (
|
||||||
|
<p className="text-destructive text-xs mt-1">
|
||||||
|
Amount exceeds available credit.
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<span className="text-muted-foreground">Loading credit info…</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{method === 'Cash' && (
|
{method === 'Cash' && (
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
|||||||
@@ -1004,6 +1004,7 @@ export interface ShopPOResponse {
|
|||||||
export interface InvoiceResponse {
|
export interface InvoiceResponse {
|
||||||
id: string
|
id: string
|
||||||
shopPOId: string
|
shopPOId: string
|
||||||
|
storeId: string
|
||||||
storeName: string
|
storeName: string
|
||||||
status: InvoiceStatus
|
status: InvoiceStatus
|
||||||
paymentStatus: PaymentStatus
|
paymentStatus: PaymentStatus
|
||||||
@@ -1013,6 +1014,7 @@ export interface InvoiceResponse {
|
|||||||
finalizedAt: string | null
|
finalizedAt: string | null
|
||||||
finalizedBy: string | null
|
finalizedBy: string | null
|
||||||
totalAmount: number
|
totalAmount: number
|
||||||
|
paidAmount: number
|
||||||
isActive: boolean
|
isActive: boolean
|
||||||
createdAt: string
|
createdAt: string
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user