Refactor sales pipeline: ShopPO, Invoice, SysConfig models
Major refactor replacing Sale/Order with ShopPO → Invoice → LoadingSheet flow. Removed legacy Sale/Order models and features; introduced ShopPO, ShopPOItem, Invoice, LoadingSheetOrder, and SysConfig models. Updated related entities, enums, repositories, and controllers. Added new migrations for schema changes and system config. Overhauled business logic and DI registrations. Updated documentation with migration plan.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
using Distribution.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Distribution.Features.SysConfig;
|
||||
|
||||
public class SysConfigRepository(AppDBContext context) : ISysConfigRepository
|
||||
{
|
||||
public async Task<Models.SysConfig?> GetByKeyAsync(string key) =>
|
||||
await context.SysConfigs.FindAsync(key);
|
||||
|
||||
public async Task<List<Models.SysConfig>> GetAllAsync() =>
|
||||
await context.SysConfigs.OrderBy(c => c.Key).ToListAsync();
|
||||
|
||||
public async Task UpsertAsync(Models.SysConfig entity)
|
||||
{
|
||||
var existing = await context.SysConfigs.FindAsync(entity.Key);
|
||||
if (existing is null)
|
||||
{
|
||||
await context.SysConfigs.AddAsync(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
existing.Value = entity.Value;
|
||||
existing.UpdatedAt = entity.UpdatedAt;
|
||||
existing.UpdatedBy = entity.UpdatedBy;
|
||||
context.SysConfigs.Update(existing);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user