[Add] MasterData Services.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ClosedXML" Version="0.105.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.6"/>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.9">
|
||||
|
||||
187
AMREZ.EOP.API/Controllers/DataController.cs
Normal file
187
AMREZ.EOP.API/Controllers/DataController.cs
Normal file
@@ -0,0 +1,187 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.ImportData.Location;
|
||||
using AMREZ.EOP.Contracts.DTOs.ImportData.Location;
|
||||
using AMREZ.EOP.Domain.Shared.Data;
|
||||
using ClosedXML.Excel;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AMREZ.EOP.API.Controllers;
|
||||
|
||||
public class AddressTemplateRow
|
||||
{
|
||||
public string CustomerName { get; set; } = ""; // ชื่อ
|
||||
public string Phone { get; set; } = ""; // เบอร์โทร
|
||||
public string Address { get; set; } = ""; // ที่อยู่ (เลขที่/หมู่/ซอย/ถนน ฯลฯ)
|
||||
public string Subdistrict { get; set; } = ""; // ตำบล
|
||||
public string District { get; set; } = ""; // อำเภอ
|
||||
public string Province { get; set; } = ""; // จังหวัด
|
||||
public string PostalCode { get; set; } = ""; // รหัสไปรษณีย์
|
||||
|
||||
public string? ProductCode { get; set; } // เผื่อใช้ต่อ
|
||||
public string? ProductName { get; set; }
|
||||
public int? Quantity { get; set; }
|
||||
}
|
||||
|
||||
[ApiController]
|
||||
[Route("api/[controller]")]
|
||||
public class DataController : ControllerBase
|
||||
{
|
||||
private readonly ILocationImportUseCase _locationImportUseCase;
|
||||
|
||||
public DataController(ILocationImportUseCase locationImportUseCase)
|
||||
{
|
||||
_locationImportUseCase = locationImportUseCase;
|
||||
}
|
||||
|
||||
// เซ็ต Fixed สินค้า 3 รายการตามตัวอย่าง
|
||||
private static readonly (string Code, string Name, decimal Price)[] FixedProducts =
|
||||
{
|
||||
("900-000-01-01", "LAVIESTE (DIETARY SUPPLEMENT PRODUCT) KATHY LABZ BRAND", 1590m),
|
||||
("900-000-01-02", "KARISTA (DIETARY SUPPLEMENT PRODUCT) KATHY LABZ BRAND", 1590m),
|
||||
("890-001-00-01", "KATHY LABZ AUTO STIRRING", 390m)
|
||||
};
|
||||
|
||||
[HttpPost("address-parse")]
|
||||
public async Task<IActionResult> ThaiParseAddress([FromForm(Name = "Image")] IFormFile? Image)
|
||||
{
|
||||
if (Image == null || Image.Length == 0)
|
||||
return BadRequest("กรุณาอัปโหลดไฟล์ Excel (.xlsx) ที่เป็น 'ข้อมูลจริง ครั้งที่1'");
|
||||
|
||||
using var stream = new MemoryStream();
|
||||
await Image.CopyToAsync(stream);
|
||||
stream.Position = 0;
|
||||
|
||||
using var wb = new XLWorkbook(stream);
|
||||
var ws = wb.Worksheets.First();
|
||||
|
||||
// row1 = header => "username", "Address"
|
||||
var lastRow = ws.LastRowUsed().RowNumber();
|
||||
|
||||
var rows = new List<AddressTemplateRow>();
|
||||
|
||||
for (int row = 2; row <= lastRow; row++)
|
||||
{
|
||||
var username = ws.Cell(row, 1).GetString().Trim(); // "username"
|
||||
var rawAddress = ws.Cell(row, 2).GetString().Trim(); // "Address"
|
||||
|
||||
if (string.IsNullOrWhiteSpace(username) && string.IsNullOrWhiteSpace(rawAddress))
|
||||
continue;
|
||||
|
||||
var parsed = ThaiAddressParser.Parse(rawAddress);
|
||||
|
||||
rows.Add(new AddressTemplateRow
|
||||
{
|
||||
CustomerName = string.IsNullOrWhiteSpace(parsed.Name)
|
||||
? username
|
||||
: parsed.Name,
|
||||
Phone = parsed.Phone,
|
||||
Address = parsed.AddressMain,
|
||||
Subdistrict = parsed.Subdistrict,
|
||||
District = parsed.District,
|
||||
Province = parsed.Province,
|
||||
PostalCode = parsed.PostalCode
|
||||
});
|
||||
}
|
||||
|
||||
// ================== สร้างไฟล์ Excel ตาม Template ==================
|
||||
using var outWb = new XLWorkbook();
|
||||
|
||||
var outWs = outWb.Worksheets.Add("template");
|
||||
|
||||
// Header แถวที่ 1 ให้ตรงกับไฟล์ตัวอย่าง
|
||||
outWs.Cell(1, 1).Value = "สถานะออเดอร์";
|
||||
outWs.Cell(1, 2).Value = "สถานะการชำระเงิน";
|
||||
outWs.Cell(1, 3).Value = "รหัสพนักงานขาย";
|
||||
outWs.Cell(1, 4).Value = "รหัสช่องทางการขาย";
|
||||
outWs.Cell(1, 5).Value = "ช่องทางการชำระเงิน";
|
||||
outWs.Cell(1, 6).Value = "กำหนดส่งสินค้า";
|
||||
outWs.Cell(1, 7).Value = "Order No";
|
||||
outWs.Cell(1, 8).Value = "ชื่อขนส่ง";
|
||||
outWs.Cell(1, 9).Value = "ชื่อ";
|
||||
outWs.Cell(1, 10).Value = "เบอร์โทร";
|
||||
outWs.Cell(1, 11).Value = "E-mail";
|
||||
outWs.Cell(1, 12).Value = "Line";
|
||||
outWs.Cell(1, 13).Value = "Facebook";
|
||||
outWs.Cell(1, 14).Value = "IG";
|
||||
outWs.Cell(1, 15).Value = "หมายเหตุ";
|
||||
outWs.Cell(1, 16).Value = "ที่อยู่";
|
||||
outWs.Cell(1, 17).Value = "ตำบล";
|
||||
outWs.Cell(1, 18).Value = "อำเภอ";
|
||||
outWs.Cell(1, 19).Value = "จังหวัด";
|
||||
outWs.Cell(1, 20).Value = "รหัสไปรษณีย์";
|
||||
outWs.Cell(1, 21).Value = "รหัสสินค้า/รหัสโปรโมชั่น (ตายตัว";
|
||||
outWs.Cell(1, 22).Value = "ชื่อสินค้า/ชื่อโปรโมชั่น (ตายตัว)";
|
||||
outWs.Cell(1, 23).Value = "ราคา/ชิ้น";
|
||||
outWs.Cell(1, 24).Value = "จำนวน";
|
||||
outWs.Cell(1, 25).Value = "ส่วนลด";
|
||||
outWs.Cell(1, 26).Value = "ราคารวมสินค้า";
|
||||
outWs.Cell(1, 27).Value = "ค่าขนส่ง";
|
||||
outWs.Cell(1, 28).Value = "ส่วนลดท้ายบิล";
|
||||
outWs.Cell(1, 29).Value = "ราคารวมออเดอร์";
|
||||
outWs.Cell(1, 30).Value = "Tracking No.";
|
||||
outWs.Cell(1, 31).Value = "วันอนุมัติ";
|
||||
|
||||
var outRow = 2;
|
||||
|
||||
foreach (var r in rows)
|
||||
{
|
||||
// 1 ลูกค้า → 3 แถวสินค้า fix
|
||||
foreach (var p in FixedProducts)
|
||||
{
|
||||
// ข้อมูลลูกค้า
|
||||
outWs.Cell(outRow, 9).Value = r.CustomerName ?? "";
|
||||
outWs.Cell(outRow, 10).Value = r.Phone ?? "";
|
||||
outWs.Cell(outRow, 16).Value = r.Address ?? "";
|
||||
outWs.Cell(outRow, 17).Value = r.Subdistrict ?? "";
|
||||
outWs.Cell(outRow, 18).Value = r.District ?? "";
|
||||
outWs.Cell(outRow, 19).Value = r.Province ?? "";
|
||||
outWs.Cell(outRow, 20).Value = r.PostalCode ?? "";
|
||||
|
||||
// สินค้า
|
||||
outWs.Cell(outRow, 21).Value = p.Code; // รหัสสินค้า
|
||||
outWs.Cell(outRow, 22).Value = p.Name; // ชื่อสินค้า hard-coded
|
||||
outWs.Cell(outRow, 23).Value = p.Price; // ราคา/ชิ้น
|
||||
outWs.Cell(outRow, 24).Value = 1; // จำนวน = 1
|
||||
|
||||
// ส่วนลด/รวม/ค่าขนส่ง/ส่วนลดท้ายบิล/ราคารวมออเดอร์ ปล่อยว่าง
|
||||
// คอลัมน์ 25–31 ไม่เซ็ตอะไร
|
||||
|
||||
outRow++;
|
||||
}
|
||||
}
|
||||
|
||||
outWs.Columns(1, 31).AdjustToContents();
|
||||
|
||||
using var outStream = new MemoryStream();
|
||||
outWb.SaveAs(outStream);
|
||||
outStream.Position = 0;
|
||||
|
||||
var fileName = $"import_SO_template_{DateTime.Now:yyyyMMddHHmmss}.xlsx";
|
||||
|
||||
return File(
|
||||
outStream.ToArray(),
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
fileName
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Import ตารางจังหวัด / อำเภอ / ตำบล จากไฟล์ Excel (กรมการปกครอง)
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// ส่งไฟล์ .xlsx ผ่าน multipart/form-data, field name = "file"
|
||||
/// </remarks>
|
||||
[HttpPost("import-th-location")]
|
||||
[Consumes("multipart/form-data")]
|
||||
[ProducesResponseType(typeof(LocationImportResultDto), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public async Task<IActionResult> ImportLocations(
|
||||
[FromForm(Name = "file")] IFormFile? file,
|
||||
CancellationToken ct)
|
||||
{
|
||||
if (file == null || file.Length == 0)
|
||||
return BadRequest("กรุณาอัปโหลดไฟล์ Excel (.xlsx) รหัสจังหวัด/อำเภอ/ตำบล");
|
||||
|
||||
var result = await _locationImportUseCase.ExecuteAsync(file, ct);
|
||||
return Ok(result);
|
||||
}
|
||||
}
|
||||
59
AMREZ.EOP.API/Controllers/MasterData/BrandsController.cs
Normal file
59
AMREZ.EOP.API/Controllers/MasterData/BrandsController.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace AMREZ.EOP.API.Controllers.MasterData;
|
||||
|
||||
[ApiController]
|
||||
[Route("api/master/brands")]
|
||||
public sealed class BrandsController : ControllerBase
|
||||
{
|
||||
private readonly IListBrandsUseCase _list;
|
||||
private readonly IGetBrandUseCase _get;
|
||||
private readonly ICreateBrandUseCase _create;
|
||||
private readonly IUpdateBrandUseCase _update;
|
||||
private readonly IDeleteBrandUseCase _delete;
|
||||
|
||||
public BrandsController(
|
||||
IListBrandsUseCase list,
|
||||
IGetBrandUseCase get,
|
||||
ICreateBrandUseCase create,
|
||||
IUpdateBrandUseCase update,
|
||||
IDeleteBrandUseCase delete)
|
||||
{
|
||||
_list = list; _get = get; _create = create; _update = update; _delete = delete;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<PagedResponse<BrandResponse>>> List([FromQuery] BrandListRequest query, CancellationToken ct)
|
||||
=> Ok(await _list.ExecuteAsync(query, ct));
|
||||
|
||||
[HttpGet("{id:guid}")]
|
||||
public async Task<IActionResult> Get(Guid id, CancellationToken ct)
|
||||
{
|
||||
var res = await _get.ExecuteAsync(id, ct);
|
||||
return res is null ? NotFound() : Ok(res);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Create([FromBody] BrandCreateRequest body, CancellationToken ct)
|
||||
{
|
||||
var res = await _create.ExecuteAsync(body, ct);
|
||||
return CreatedAtAction(nameof(Get), new { id = res.Id }, res);
|
||||
}
|
||||
|
||||
[HttpPut("{id:guid}")]
|
||||
public async Task<IActionResult> Update(Guid id, [FromBody] BrandUpdateRequest body, CancellationToken ct)
|
||||
{
|
||||
var res = await _update.ExecuteAsync(id, body, ct);
|
||||
return res is null ? NotFound() : Ok(res);
|
||||
}
|
||||
|
||||
[HttpDelete("{id:guid}")]
|
||||
public async Task<IActionResult> Delete(Guid id, CancellationToken ct)
|
||||
{
|
||||
var ok = await _delete.ExecuteAsync(id, ct);
|
||||
return ok ? NoContent() : NotFound();
|
||||
}
|
||||
}
|
||||
@@ -28,13 +28,13 @@ public class SCBController : ControllerBase
|
||||
{
|
||||
if (Image is null || Image.Length == 0)
|
||||
return BadRequest(new { message = "Missing slip image" });
|
||||
|
||||
|
||||
var res = await _verifyFromImage.ExecuteAsync(new VerifyFromImageRequest
|
||||
{
|
||||
Image = Image,
|
||||
OverrideSendingBank = OverrideSendingBank
|
||||
}, ct);
|
||||
|
||||
|
||||
if (res is null) return NotFound(new { message = "Cannot extract transRef or verification failed" });
|
||||
return Ok(res);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,4 @@
|
||||
<ProjectReference Include="..\AMREZ.EOP.Domain\AMREZ.EOP.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.ImportData.Location;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.ImportData.Location;
|
||||
|
||||
public interface ILocationImportUseCase
|
||||
{
|
||||
Task<LocationImportResultDto> ExecuteAsync(IFormFile file, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
|
||||
public interface ICreateAllergenUseCase
|
||||
{
|
||||
Task<AllergenResponse> ExecuteAsync(AllergenCreateRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
|
||||
public interface IDeleteAllergenUseCase
|
||||
{
|
||||
Task<bool> ExecuteAsync(Guid id, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
|
||||
public interface IGetAllergenUseCase
|
||||
{
|
||||
Task<AllergenResponse?> ExecuteAsync(Guid id, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
|
||||
public interface IListAllergenUseCase
|
||||
{
|
||||
Task<PagedResponse<AllergenResponse>> ExecuteAsync(AllergenListRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
|
||||
public interface IUpdateAllergenUseCase
|
||||
{
|
||||
Task<AllergenResponse?> ExecuteAsync(Guid id, AllergenUpdateRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
|
||||
public interface ICreateBrandUseCase
|
||||
{
|
||||
Task<BrandResponse> ExecuteAsync(BrandCreateRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
|
||||
public interface IDeleteBrandUseCase
|
||||
{
|
||||
Task<bool> ExecuteAsync(Guid id, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
|
||||
public interface IGetBrandUseCase
|
||||
{
|
||||
Task<BrandResponse?> ExecuteAsync(Guid id, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
|
||||
public interface IListBrandsUseCase
|
||||
{
|
||||
Task<PagedResponse<BrandResponse>> ExecuteAsync(BrandListRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
|
||||
public interface IUpdateBrandUseCase
|
||||
{
|
||||
Task<BrandResponse?> ExecuteAsync(Guid id, BrandUpdateRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.District;
|
||||
|
||||
public interface IGetDistrictUseCase
|
||||
{
|
||||
Task<DistrictResponse?> ExecuteAsync(Guid id, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.District;
|
||||
|
||||
public interface IListDistrictsUseCase
|
||||
{
|
||||
Task<PagedResponse<DistrictResponse>> ExecuteAsync(DistrictListRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Province;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Province;
|
||||
|
||||
public interface IGetProvinceUseCase
|
||||
{
|
||||
Task<ProvinceResponse?> ExecuteAsync(Guid id, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Province;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Province;
|
||||
|
||||
public interface IListProvincesUseCase
|
||||
{
|
||||
Task<PagedResponse<ProvinceResponse>> ExecuteAsync(ProvinceListRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Subdistrict;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Subdistrict;
|
||||
|
||||
public interface IGetSubdistrictUseCase
|
||||
{
|
||||
Task<SubdistrictResponse?> ExecuteAsync(Guid id, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Subdistrict;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Subdistrict;
|
||||
|
||||
public interface IListSubdistrictsUseCase
|
||||
{
|
||||
Task<PagedResponse<SubdistrictResponse>> ExecuteAsync(SubdistrictListRequest req, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IAllergenRepository
|
||||
{
|
||||
Task<Allergen?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Allergen>> SearchEffectiveAsync(Guid tenantId, AllergenListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Allergen entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Allergen entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IBrandRepository
|
||||
{
|
||||
Task<Brand?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Brand>> SearchEffectiveAsync(Guid tenantId, BrandListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Brand entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Brand entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Category;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface ICategoryRepository
|
||||
{
|
||||
Task<Category?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Category>> SearchEffectiveAsync(Guid tenantId, CategoryListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Category entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Category entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IComplianceStatusRepository
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Country;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface ICountryRepository
|
||||
{
|
||||
Task<Country?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Country>> SearchEffectiveAsync(Guid tenantId, CountryListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Country entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Country entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Currency;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface ICurrencyRepository
|
||||
{
|
||||
Task<Currency?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Currency>> SearchEffectiveAsync(Guid tenantId, CurrencyListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Currency entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Currency entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IDistrictRepository
|
||||
{
|
||||
Task<District?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
|
||||
Task<PagedResponse<District>> SearchEffectiveAsync(
|
||||
Guid tenantId,
|
||||
DistrictListRequest req,
|
||||
CancellationToken ct = default);
|
||||
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
|
||||
Task AddAsync(District entity, CancellationToken ct = default);
|
||||
|
||||
Task UpdateAsync(District entity, CancellationToken ct = default);
|
||||
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.DocControlStatus;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IDocControlStatusRepository
|
||||
{
|
||||
Task<DocControlStatus?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<DocControlStatus>> SearchEffectiveAsync(Guid tenantId, DocControlStatusListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(DocControlStatus entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(DocControlStatus entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.FuncTest;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IFuncTestRepository
|
||||
{
|
||||
Task<FuncTest?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<FuncTest>> SearchEffectiveAsync(Guid tenantId, FuncTestListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(FuncTest entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(FuncTest entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.HazardClass;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IHazardClassRepository
|
||||
{
|
||||
Task<HazardClass?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<HazardClass>> SearchEffectiveAsync(Guid tenantId, HazardClassListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(HazardClass entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(HazardClass entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Language;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface ILanguageRepository
|
||||
{
|
||||
Task<Language?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Language>> SearchEffectiveAsync(Guid tenantId, LanguageListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Language entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Language entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Manufacturer;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IManufacturerRepository
|
||||
{
|
||||
Task<Manufacturer?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Manufacturer>> SearchEffectiveAsync(Guid tenantId, ManufacturerListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Manufacturer entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Manufacturer entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Market;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IMarketRepository
|
||||
{
|
||||
Task<Market?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Market>> SearchEffectiveAsync(Guid tenantId, MarketListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Market entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Market entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.PackingGroup;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IPackingGroupRepository
|
||||
{
|
||||
Task<PackingGroup?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<PackingGroup>> SearchEffectiveAsync(Guid tenantId, PackingGroupListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(PackingGroup entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(PackingGroup entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Province;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IProvinceRepository
|
||||
{
|
||||
Task<Province?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
|
||||
Task<PagedResponse<Province>> SearchEffectiveAsync(
|
||||
Guid tenantId,
|
||||
ProvinceListRequest req,
|
||||
CancellationToken ct = default);
|
||||
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
|
||||
Task AddAsync(Province entity, CancellationToken ct = default);
|
||||
|
||||
Task UpdateAsync(Province entity, CancellationToken ct = default);
|
||||
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.QaStage;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IQaStageRepository
|
||||
{
|
||||
Task<QaStage?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<QaStage>> SearchEffectiveAsync(Guid tenantId, QaStageListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(QaStage entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(QaStage entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.QcStatus;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IQcStatusRepository
|
||||
{
|
||||
Task<QcStatus?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<QcStatus>> SearchEffectiveAsync(Guid tenantId, QcStatusListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(QcStatus entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(QcStatus entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.RecallClass;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IRecallClassRepository
|
||||
{
|
||||
Task<RecallClass?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<RecallClass>> SearchEffectiveAsync(Guid tenantId, RecallClassListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(RecallClass entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(RecallClass entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.RiskClass;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IRiskClassRepository
|
||||
{
|
||||
Task<RiskClass?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<RiskClass>> SearchEffectiveAsync(Guid tenantId, RiskClassListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(RiskClass entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(RiskClass entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Route;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IRouteRepository
|
||||
{
|
||||
Task<Route?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Route>> SearchEffectiveAsync(Guid tenantId, RouteListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Route entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Route entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.RxSchedule;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IRxScheduleRepository
|
||||
{
|
||||
Task<RxSchedule?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<RxSchedule>> SearchEffectiveAsync(Guid tenantId, RxScheduleListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(RxSchedule entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(RxSchedule entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Species;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface ISpeciesRepository
|
||||
{
|
||||
Task<Species?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Species>> SearchEffectiveAsync(Guid tenantId, SpeciesListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Species entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Species entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.StabilityStatus;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IStabilityStatusRepository
|
||||
{
|
||||
Task<StabilityStatus?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<StabilityStatus>> SearchEffectiveAsync(Guid tenantId, StabilityStatusListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(StabilityStatus entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(StabilityStatus entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.SterilizationMethod;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface ISterilizationMethodRepository
|
||||
{
|
||||
Task<SterilizationMethod?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<SterilizationMethod>> SearchEffectiveAsync(Guid tenantId, SterilizationMethodListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(SterilizationMethod entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(SterilizationMethod entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Subdistrict;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface ISubdistrictRepository
|
||||
{
|
||||
Task<Subdistrict?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
|
||||
Task<PagedResponse<Subdistrict>> SearchEffectiveAsync(
|
||||
Guid tenantId,
|
||||
SubdistrictListRequest req,
|
||||
CancellationToken ct = default);
|
||||
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
|
||||
Task AddAsync(Subdistrict entity, CancellationToken ct = default);
|
||||
|
||||
Task UpdateAsync(Subdistrict entity, CancellationToken ct = default);
|
||||
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Uom;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IUomRepository
|
||||
{
|
||||
Task<Uom?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Uom>> SearchEffectiveAsync(Guid tenantId, UomListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Uom entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Uom entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Vvm;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
|
||||
namespace AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
|
||||
public interface IVvmRepository
|
||||
{
|
||||
Task<Vvm?> GetAsync(Guid id, CancellationToken ct = default);
|
||||
Task<PagedResponse<Vvm>> SearchEffectiveAsync(Guid tenantId, VvmListRequest req, CancellationToken ct = default);
|
||||
Task<bool> CodeExistsAsync(Guid tenantId, string code, CancellationToken ct = default);
|
||||
Task AddAsync(Vvm entity, CancellationToken ct = default);
|
||||
Task UpdateAsync(Vvm entity, CancellationToken ct = default);
|
||||
Task<int> SoftDeleteAsync(Guid id, Guid tenantId, CancellationToken ct = default);
|
||||
}
|
||||
@@ -11,13 +11,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ClosedXML" Version="0.105.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.3.0" />
|
||||
<PackageReference Include="SkiaSharp" Version="3.119.1" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.1" />
|
||||
<PackageReference Include="ZXing.Net.Bindings.SkiaSharp" Version="0.16.21" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -31,72 +31,71 @@ public sealed class IssueTokenPairUseCase : IIssueTokenPairUseCase
|
||||
_http = http;
|
||||
}
|
||||
|
||||
public async Task<IssueTokenPairResponse> ExecuteAsync(IssueTokenPairRequest request, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
|
||||
var tenantId = request.TenantId;
|
||||
|
||||
// ---- สร้าง/บันทึก refresh session ----
|
||||
var refreshRaw = Convert.ToBase64String(RandomNumberGenerator.GetBytes(64));
|
||||
var refreshHash = Sha256(refreshRaw);
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
var session = await _users.CreateSessionAsync(new UserSession
|
||||
public async Task<IssueTokenPairResponse> ExecuteAsync(IssueTokenPairRequest request,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
UserId = request.UserId,
|
||||
RefreshTokenHash = refreshHash,
|
||||
IssuedAt = now,
|
||||
ExpiresAt = now.AddDays(RefreshDays),
|
||||
DeviceId = http.Request.Headers["X-Device-Id"].FirstOrDefault(),
|
||||
UserAgent = http.Request.Headers["User-Agent"].FirstOrDefault(),
|
||||
IpAddress = http.Connection.RemoteIpAddress?.ToString()
|
||||
}, ct);
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
|
||||
// ---- เวอร์ชัน/สแตมป์ความปลอดภัย ----
|
||||
var tv = await _users.GetTenantTokenVersionAsync(tenantId, ct);
|
||||
var sstamp = await _users.GetUserSecurityStampAsync(request.UserId, ct) ?? string.Empty;
|
||||
var tenantId = request.TenantId;
|
||||
|
||||
// ---- เตรียม claims พื้นฐาน ----
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new("sub", request.UserId.ToString()),
|
||||
new("email", request.Email),
|
||||
new("tenant", request.Tenant), // tenantKey ที่ FE ใช้
|
||||
new("tenant_id", tenantId.ToString()),
|
||||
new("sid", session.Id.ToString()),
|
||||
new("jti", Guid.NewGuid().ToString("N")),
|
||||
new("tv", tv),
|
||||
new("sstamp", sstamp),
|
||||
new("iat", now.ToUnixTimeSeconds().ToString(), ClaimValueTypes.Integer64)
|
||||
};
|
||||
// ---- สร้าง/บันทึก refresh session ----
|
||||
var refreshRaw = Convert.ToBase64String(RandomNumberGenerator.GetBytes(64));
|
||||
var refreshHash = Sha256(refreshRaw);
|
||||
var now = DateTimeOffset.UtcNow;
|
||||
|
||||
string[] roles = request.Roles ?? Array.Empty<string>();
|
||||
if (roles.Length == 0)
|
||||
{
|
||||
roles = await _users.GetRoleCodesByUserIdAsync(request.UserId, tenantId, ct);
|
||||
var session = await _users.CreateSessionAsync(new UserSession
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
UserId = request.UserId,
|
||||
RefreshTokenHash = refreshHash,
|
||||
IssuedAt = now,
|
||||
ExpiresAt = now.AddDays(RefreshDays),
|
||||
DeviceId = http.Request.Headers["X-Device-Id"].FirstOrDefault(),
|
||||
UserAgent = http.Request.Headers["User-Agent"].FirstOrDefault(),
|
||||
IpAddress = http.Connection.RemoteIpAddress?.ToString()
|
||||
}, ct);
|
||||
|
||||
var tv = await _users.GetTenantTokenVersionAsync(tenantId, ct);
|
||||
var sstamp = await _users.GetUserSecurityStampAsync(request.UserId, ct) ?? string.Empty;
|
||||
|
||||
// ---- เตรียม claims พื้นฐาน ----
|
||||
var claims = new List<Claim>
|
||||
{
|
||||
new("sub", request.UserId.ToString()),
|
||||
new("email", request.Email),
|
||||
new("tenant", request.Tenant), // tenantKey ที่ FE ใช้
|
||||
new("tenant_id", tenantId.ToString()),
|
||||
new("sid", session.Id.ToString()),
|
||||
new("jti", Guid.NewGuid().ToString("N")),
|
||||
new("tv", tv),
|
||||
new("sstamp", sstamp),
|
||||
new("iat", now.ToUnixTimeSeconds().ToString(), ClaimValueTypes.Integer64)
|
||||
};
|
||||
|
||||
string[] roles = request.Roles ?? Array.Empty<string>();
|
||||
if (roles.Length == 0)
|
||||
{
|
||||
roles = await _users.GetRoleCodesByUserIdAsync(request.UserId, tenantId, ct);
|
||||
}
|
||||
|
||||
foreach (var r in roles.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct(StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
claims.Add(new Claim("role", r));
|
||||
claims.Add(new Claim(ClaimTypes.Role, r));
|
||||
}
|
||||
|
||||
var (access, accessExp) = _jwt.CreateAccessToken(claims);
|
||||
|
||||
return new IssueTokenPairResponse
|
||||
{
|
||||
AccessToken = access,
|
||||
AccessExpiresAt = accessExp,
|
||||
RefreshToken = refreshRaw,
|
||||
RefreshExpiresAt = session.ExpiresAt
|
||||
};
|
||||
}
|
||||
|
||||
foreach (var r in roles.Where(s => !string.IsNullOrWhiteSpace(s)).Distinct(StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
claims.Add(new Claim("role", r));
|
||||
claims.Add(new Claim(ClaimTypes.Role, r));
|
||||
}
|
||||
|
||||
// ---- ออก access token ----
|
||||
var (access, accessExp) = _jwt.CreateAccessToken(claims);
|
||||
|
||||
return new IssueTokenPairResponse
|
||||
{
|
||||
AccessToken = access,
|
||||
AccessExpiresAt = accessExp,
|
||||
RefreshToken = refreshRaw,
|
||||
RefreshExpiresAt = session.ExpiresAt
|
||||
};
|
||||
}
|
||||
|
||||
private static string Sha256(string raw)
|
||||
{
|
||||
var bytes = SHA256.HashData(Encoding.UTF8.GetBytes(raw));
|
||||
|
||||
@@ -0,0 +1,413 @@
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.ImportData.Location;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Common;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.ImportData.Location;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Province;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Subdistrict;
|
||||
using AMREZ.EOP.Domain.Entities.MasterData;
|
||||
using AMREZ.EOP.Domain.Entities.Tenancy;
|
||||
using ClosedXML.Excel;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.ImportData.Location;
|
||||
|
||||
public sealed class LocationImportUseCase : ILocationImportUseCase
|
||||
{
|
||||
private readonly IProvinceRepository _provinceRepo;
|
||||
private readonly IDistrictRepository _districtRepo;
|
||||
private readonly ISubdistrictRepository _subdistrictRepo;
|
||||
private readonly ITenantRepository _tenants;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
private readonly IUnitOfWork _uow;
|
||||
|
||||
public LocationImportUseCase(
|
||||
IProvinceRepository provinceRepo,
|
||||
IDistrictRepository districtRepo,
|
||||
ISubdistrictRepository subdistrictRepo,
|
||||
ITenantRepository tenants,
|
||||
ITenantResolver tenantResolver,
|
||||
IHttpContextAccessor http,
|
||||
IUnitOfWork uow)
|
||||
{
|
||||
_provinceRepo = provinceRepo;
|
||||
_districtRepo = districtRepo;
|
||||
_subdistrictRepo = subdistrictRepo;
|
||||
_tenants = tenants;
|
||||
_tenantResolver = tenantResolver;
|
||||
_http = http;
|
||||
_uow = uow;
|
||||
}
|
||||
|
||||
public async Task<LocationImportResultDto> ExecuteAsync(IFormFile file, CancellationToken ct = default)
|
||||
{
|
||||
if (file == null || file.Length == 0)
|
||||
throw new InvalidOperationException("Excel file is required");
|
||||
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
|
||||
var tn = await _tenants.GetAsync(tc.Id) ?? throw new InvalidOperationException("Tenant config not found");
|
||||
var tenantId = tn.TenantId;
|
||||
|
||||
var result = new LocationImportResultDto();
|
||||
|
||||
await _uow.BeginAsync(tc, IsolationLevel.ReadCommitted, ct);
|
||||
try
|
||||
{
|
||||
var provincesByCode = await LoadGlobalProvincesAsync(tenantId, ct);
|
||||
var districtsByCode = await LoadGlobalDistrictsAsync(tenantId, ct);
|
||||
var subdistrictsByCode = await LoadGlobalSubdistrictsAsync(tenantId, ct);
|
||||
|
||||
using var stream = new MemoryStream();
|
||||
await file.CopyToAsync(stream, ct);
|
||||
stream.Position = 0;
|
||||
|
||||
using var wb = new XLWorkbook(stream);
|
||||
var ws = wb.Worksheets.First();
|
||||
var lastRow = ws.LastRowUsed().RowNumber();
|
||||
|
||||
// row 1 = header
|
||||
for (var row = 2; row <= lastRow; row++)
|
||||
{
|
||||
ct.ThrowIfCancellationRequested();
|
||||
result.RowsRead++;
|
||||
|
||||
string Get(int col)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ws.Cell(row, col).GetString().Trim();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
// 1: CC, 2: AA, 3: TT, 4: CCAATT, 5: จังหวัด, 6: อำเภอ, 7: ตำบล, 8: รหัสไปรษณีย์
|
||||
var cc = Get(1);
|
||||
var aa = Get(2);
|
||||
var tt = Get(3);
|
||||
var locCode = Get(4);
|
||||
|
||||
var provinceName = Get(5);
|
||||
var districtName = Get(6);
|
||||
var subdistrictName = Get(7);
|
||||
var postcode = Get(8);
|
||||
|
||||
string? code = null;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(cc) &&
|
||||
!string.IsNullOrWhiteSpace(aa) &&
|
||||
!string.IsNullOrWhiteSpace(tt))
|
||||
{
|
||||
code =
|
||||
cc.PadLeft(2, '0') +
|
||||
aa.PadLeft(2, '0') +
|
||||
tt.PadLeft(2, '0');
|
||||
}
|
||||
else if (!string.IsNullOrWhiteSpace(locCode))
|
||||
{
|
||||
code = locCode;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(code))
|
||||
continue;
|
||||
|
||||
code = code.Trim();
|
||||
if (code.Length < 6)
|
||||
code = code.PadLeft(6, '0');
|
||||
else if (code.Length > 6)
|
||||
code = code[..6];
|
||||
|
||||
var isProvince = code.EndsWith("0000", StringComparison.Ordinal);
|
||||
var isDistrict = !isProvince && code.EndsWith("00", StringComparison.Ordinal);
|
||||
var isSubdistrict = !isProvince && !isDistrict;
|
||||
|
||||
if (isProvince)
|
||||
{
|
||||
await ImportProvinceAsync(code, provinceName, provincesByCode, tenantId, result, ct);
|
||||
}
|
||||
else if (isDistrict)
|
||||
{
|
||||
await ImportDistrictAsync(
|
||||
code,
|
||||
provinceName,
|
||||
districtName,
|
||||
provincesByCode,
|
||||
districtsByCode,
|
||||
tenantId,
|
||||
result,
|
||||
ct);
|
||||
}
|
||||
else if (isSubdistrict)
|
||||
{
|
||||
await ImportSubdistrictAsync(
|
||||
code,
|
||||
provinceName,
|
||||
districtName,
|
||||
subdistrictName,
|
||||
postcode,
|
||||
provincesByCode,
|
||||
districtsByCode,
|
||||
subdistrictsByCode,
|
||||
tenantId,
|
||||
result,
|
||||
ct);
|
||||
}
|
||||
}
|
||||
|
||||
await _uow.CommitAsync(ct);
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
await _uow.RollbackAsync(ct);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// ========== preload helpers ==========
|
||||
|
||||
private async Task<Dictionary<string, Province>> LoadGlobalProvincesAsync(Guid tenantId, CancellationToken ct)
|
||||
{
|
||||
var req = new ProvinceListRequest
|
||||
{
|
||||
Page = 1,
|
||||
PageSize = 500,
|
||||
IncludeInactive = true,
|
||||
Search = null
|
||||
};
|
||||
|
||||
var page = await _provinceRepo.SearchEffectiveAsync(tenantId, req, ct);
|
||||
|
||||
return page.Items
|
||||
.Where(x => x.Scope == "global" && !string.IsNullOrWhiteSpace(x.Code))
|
||||
.GroupBy(x => x.Code!)
|
||||
.ToDictionary(g => g.Key, g => g.First(), StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private async Task<Dictionary<string, District>> LoadGlobalDistrictsAsync(Guid tenantId, CancellationToken ct)
|
||||
{
|
||||
var req = new DistrictListRequest
|
||||
{
|
||||
Page = 1,
|
||||
PageSize = 5000,
|
||||
IncludeInactive = true,
|
||||
Search = null
|
||||
};
|
||||
|
||||
var page = await _districtRepo.SearchEffectiveAsync(tenantId, req, ct);
|
||||
|
||||
return page.Items
|
||||
.Where(x => x.Scope == "global" && !string.IsNullOrWhiteSpace(x.Code))
|
||||
.GroupBy(x => x.Code!)
|
||||
.ToDictionary(g => g.Key, g => g.First(), StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private async Task<Dictionary<string, Subdistrict>> LoadGlobalSubdistrictsAsync(Guid tenantId, CancellationToken ct)
|
||||
{
|
||||
var req = new SubdistrictListRequest
|
||||
{
|
||||
Page = 1,
|
||||
PageSize = 10000,
|
||||
IncludeInactive = true,
|
||||
Search = null
|
||||
};
|
||||
|
||||
var page = await _subdistrictRepo.SearchEffectiveAsync(tenantId, req, ct);
|
||||
|
||||
return page.Items
|
||||
.Where(x => x.Scope == "global" && !string.IsNullOrWhiteSpace(x.Code))
|
||||
.GroupBy(x => x.Code!)
|
||||
.ToDictionary(g => g.Key, g => g.First(), StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
// ========== import helpers ==========
|
||||
|
||||
private async Task ImportProvinceAsync(
|
||||
string ccaatt,
|
||||
string? provinceName,
|
||||
Dictionary<string, Province> provincesByCode,
|
||||
Guid tenantId,
|
||||
LocationImportResultDto result,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var provCode = ccaatt[..2];
|
||||
|
||||
if (!provincesByCode.TryGetValue(provCode, out var prov))
|
||||
{
|
||||
prov = new Province
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
Scope = "global",
|
||||
Code = provCode,
|
||||
Name = string.IsNullOrWhiteSpace(provinceName) ? provCode : provinceName,
|
||||
IsActive = true,
|
||||
IsSystem = true
|
||||
};
|
||||
|
||||
await _provinceRepo.AddAsync(prov, ct);
|
||||
provincesByCode[provCode] = prov;
|
||||
result.ProvincesCreated++;
|
||||
return;
|
||||
}
|
||||
|
||||
var updated = false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(provinceName) && prov.Name != provinceName)
|
||||
{
|
||||
prov.Name = provinceName;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (updated)
|
||||
{
|
||||
await _provinceRepo.UpdateAsync(prov, ct);
|
||||
result.ProvincesUpdated++;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ImportDistrictAsync(
|
||||
string ccaatt,
|
||||
string? provinceName,
|
||||
string? districtName,
|
||||
Dictionary<string, Province> provincesByCode,
|
||||
Dictionary<string, District> districtsByCode,
|
||||
Guid tenantId,
|
||||
LocationImportResultDto result,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var provCode = ccaatt[..2];
|
||||
var distCode = ccaatt[..4];
|
||||
|
||||
if (!provincesByCode.TryGetValue(provCode, out var prov))
|
||||
{
|
||||
await ImportProvinceAsync(provCode + "0000", provinceName, provincesByCode, tenantId, result, ct);
|
||||
prov = provincesByCode[provCode];
|
||||
}
|
||||
|
||||
if (!districtsByCode.TryGetValue(distCode, out var dist))
|
||||
{
|
||||
dist = new District
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
Scope = "global",
|
||||
Code = distCode,
|
||||
Name = string.IsNullOrWhiteSpace(districtName) ? distCode : districtName,
|
||||
ProvinceId = prov.Id,
|
||||
IsActive = true,
|
||||
IsSystem = true
|
||||
};
|
||||
|
||||
await _districtRepo.AddAsync(dist, ct);
|
||||
districtsByCode[distCode] = dist;
|
||||
result.DistrictsCreated++;
|
||||
return;
|
||||
}
|
||||
|
||||
var updated = false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(districtName) && dist.Name != districtName)
|
||||
{
|
||||
dist.Name = districtName;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (dist.ProvinceId != prov.Id)
|
||||
{
|
||||
dist.ProvinceId = prov.Id;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (updated)
|
||||
{
|
||||
await _districtRepo.UpdateAsync(dist, ct);
|
||||
result.DistrictsUpdated++;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ImportSubdistrictAsync(
|
||||
string ccaatt,
|
||||
string? provinceName,
|
||||
string? districtName,
|
||||
string? subdistrictName,
|
||||
string? postcode,
|
||||
Dictionary<string, Province> provincesByCode,
|
||||
Dictionary<string, District> districtsByCode,
|
||||
Dictionary<string, Subdistrict> subdistrictsByCode,
|
||||
Guid tenantId,
|
||||
LocationImportResultDto result,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var provCode = ccaatt[..2];
|
||||
var distCode = ccaatt[..4];
|
||||
var subCode = ccaatt[..6];
|
||||
|
||||
if (!provincesByCode.TryGetValue(provCode, out var prov))
|
||||
{
|
||||
await ImportProvinceAsync(provCode + "0000", provinceName, provincesByCode, tenantId, result, ct);
|
||||
prov = provincesByCode[provCode];
|
||||
}
|
||||
|
||||
if (!districtsByCode.TryGetValue(distCode, out var dist))
|
||||
{
|
||||
await ImportDistrictAsync(distCode + "00", provinceName, districtName, provincesByCode, districtsByCode, tenantId, result, ct);
|
||||
dist = districtsByCode[distCode];
|
||||
}
|
||||
|
||||
if (!subdistrictsByCode.TryGetValue(subCode, out var sub))
|
||||
{
|
||||
sub = new Subdistrict
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
TenantId = tenantId,
|
||||
Scope = "global",
|
||||
Code = subCode,
|
||||
Name = string.IsNullOrWhiteSpace(subdistrictName) ? subCode : subdistrictName,
|
||||
DistrictId = dist.Id,
|
||||
Postcode = string.IsNullOrWhiteSpace(postcode) ? null : postcode,
|
||||
IsActive = true,
|
||||
IsSystem = true
|
||||
};
|
||||
|
||||
await _subdistrictRepo.AddAsync(sub, ct);
|
||||
subdistrictsByCode[subCode] = sub;
|
||||
result.SubdistrictsCreated++;
|
||||
return;
|
||||
}
|
||||
|
||||
var updated = false;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(subdistrictName) && sub.Name != subdistrictName)
|
||||
{
|
||||
sub.Name = subdistrictName;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (sub.DistrictId != dist.Id)
|
||||
{
|
||||
sub.DistrictId = dist.Id;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(postcode) && sub.Postcode != postcode)
|
||||
{
|
||||
sub.Postcode = postcode;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
if (updated)
|
||||
{
|
||||
await _subdistrictRepo.UpdateAsync(sub, ct);
|
||||
result.SubdistrictsUpdated++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Data;
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Common;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Allergen;
|
||||
|
||||
public sealed class CreateAllergenUseCase : ICreateAllergenUseCase
|
||||
{
|
||||
private readonly IAllergenRepository _repo;
|
||||
private readonly IUnitOfWork _uow;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public CreateAllergenUseCase(IAllergenRepository repo, IUnitOfWork uow, ITenantResolver tr, IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo; _uow = uow; _tenantResolver = tr; _http = http;
|
||||
}
|
||||
|
||||
public async Task<AllergenResponse> ExecuteAsync(AllergenCreateRequest req, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
|
||||
await _uow.BeginAsync(tc, IsolationLevel.ReadCommitted, ct);
|
||||
try
|
||||
{
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
if (req.Scope == "tenant" && await _repo.CodeExistsAsync(tid, req.Code, ct))
|
||||
throw new InvalidOperationException($"Brand code '{req.Code}' already exists.");
|
||||
|
||||
var entity = new Domain.Entities.MasterData.Allergen()
|
||||
{
|
||||
TenantId = tid,
|
||||
Scope = string.IsNullOrWhiteSpace(req.Scope) ? "tenant" : req.Scope,
|
||||
Code = req.Code.Trim(),
|
||||
Name = req.Name.Trim(),
|
||||
NameI18n = req.NameI18n,
|
||||
Meta = req.Meta,
|
||||
IsActive = req.IsActive,
|
||||
IsSystem = false,
|
||||
OverridesGlobalId = req.OverridesGlobalId
|
||||
};
|
||||
|
||||
await _repo.AddAsync(entity, ct);
|
||||
await _uow.CommitAsync(ct);
|
||||
|
||||
return new AllergenResponse(entity.Id, entity.Scope, entity.Code, entity.Name, entity.NameI18n, entity.OverridesGlobalId, entity.IsActive, entity.IsSystem, entity.Meta);
|
||||
}
|
||||
catch
|
||||
{
|
||||
await _uow.RollbackAsync(ct);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Allergen;
|
||||
|
||||
public class DeleteAllergenUseCase : IDeleteAllergenUseCase
|
||||
{
|
||||
private readonly IAllergenRepository _repo;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public DeleteAllergenUseCase(IAllergenRepository repo, ITenantResolver tr, IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo;
|
||||
_tenantResolver = tr;
|
||||
_http = http;
|
||||
}
|
||||
|
||||
public async Task<bool> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
var n = await _repo.SoftDeleteAsync(id, tid, ct);
|
||||
return n > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Allergen;
|
||||
|
||||
public class GetAllergenUseCase : IGetAllergenUseCase
|
||||
{
|
||||
private readonly IAllergenRepository _repo;
|
||||
public GetAllergenUseCase(IAllergenRepository repo) => _repo = repo;
|
||||
|
||||
public async Task<AllergenResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
return e is null ? null : new AllergenResponse(e.Id, e.Scope, e.Code, e.Name, e.NameI18n, e.OverridesGlobalId, e.IsActive, e.IsSystem, e.Meta);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Allergen;
|
||||
|
||||
public class ListAllergenUseCase : IListAllergenUseCase
|
||||
{
|
||||
private readonly IAllergenRepository _repo;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public ListAllergenUseCase(IAllergenRepository repo, ITenantResolver tenantResolver, IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo;
|
||||
_tenantResolver = tenantResolver;
|
||||
_http = http;
|
||||
}
|
||||
|
||||
public async Task<PagedResponse<AllergenResponse>> ExecuteAsync(AllergenListRequest req, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
var page = await _repo.SearchEffectiveAsync(tid, req, ct);
|
||||
var items = page.Items.Select(Map).ToList();
|
||||
return new PagedResponse<AllergenResponse>(page.Page, page.PageSize, page.Total, items);
|
||||
}
|
||||
|
||||
private static AllergenResponse Map(Domain.Entities.MasterData.Allergen e) =>
|
||||
new(e.Id, e.Scope, e.Code, e.Name, e.NameI18n, e.OverridesGlobalId, e.IsActive, e.IsSystem, e.Meta);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Data;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Allergen;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Common;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Allergen;
|
||||
|
||||
public class UpdateAllergenUseCase : IUpdateAllergenUseCase
|
||||
{
|
||||
private readonly IAllergenRepository _repo;
|
||||
private readonly IUnitOfWork _uow;
|
||||
|
||||
public UpdateAllergenUseCase(IAllergenRepository repo, IUnitOfWork uow) { _repo = repo; _uow = uow; }
|
||||
|
||||
public async Task<AllergenResponse?> ExecuteAsync(Guid id, AllergenUpdateRequest req, CancellationToken ct = default)
|
||||
{
|
||||
await _uow.BeginAsync(null, IsolationLevel.ReadCommitted, ct);
|
||||
try
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
if (e is null) { await _uow.RollbackAsync(ct); return null; }
|
||||
|
||||
e.Name = req.Name.Trim();
|
||||
e.NameI18n = req.NameI18n;
|
||||
e.Meta = req.Meta;
|
||||
e.IsActive = req.IsActive;
|
||||
|
||||
await _repo.UpdateAsync(e, ct);
|
||||
await _uow.CommitAsync(ct);
|
||||
|
||||
return new AllergenResponse(e.Id, e.Scope, e.Code, e.Name, e.NameI18n, e.OverridesGlobalId, e.IsActive, e.IsSystem, e.Meta);
|
||||
}
|
||||
catch
|
||||
{
|
||||
await _uow.RollbackAsync(ct);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using System.Data;
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Common;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Brand;
|
||||
|
||||
public sealed class CreateBrandUseCase : ICreateBrandUseCase
|
||||
{
|
||||
private readonly IBrandRepository _repo;
|
||||
private readonly IUnitOfWork _uow;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public CreateBrandUseCase(IBrandRepository repo, IUnitOfWork uow, ITenantResolver tr, IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo; _uow = uow; _tenantResolver = tr; _http = http;
|
||||
}
|
||||
|
||||
public async Task<BrandResponse> ExecuteAsync(BrandCreateRequest req, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
|
||||
await _uow.BeginAsync(tc, IsolationLevel.ReadCommitted, ct);
|
||||
try
|
||||
{
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
if (req.Scope == "tenant" && await _repo.CodeExistsAsync(tid, req.Code, ct))
|
||||
throw new InvalidOperationException($"Brand code '{req.Code}' already exists.");
|
||||
|
||||
var entity = new Domain.Entities.MasterData.Brand
|
||||
{
|
||||
TenantId = tid,
|
||||
Scope = string.IsNullOrWhiteSpace(req.Scope) ? "tenant" : req.Scope,
|
||||
Code = req.Code.Trim(),
|
||||
Name = req.Name.Trim(),
|
||||
NameI18n = req.NameI18n,
|
||||
Meta = req.Meta,
|
||||
IsActive = req.IsActive,
|
||||
IsSystem = false,
|
||||
OverridesGlobalId = req.OverridesGlobalId
|
||||
};
|
||||
|
||||
await _repo.AddAsync(entity, ct);
|
||||
await _uow.CommitAsync(ct);
|
||||
|
||||
return new BrandResponse(entity.Id, entity.Scope, entity.Code, entity.Name, entity.NameI18n, entity.OverridesGlobalId, entity.IsActive, entity.IsSystem, entity.Meta);
|
||||
}
|
||||
catch
|
||||
{
|
||||
await _uow.RollbackAsync(ct);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Brand;
|
||||
|
||||
public sealed class DeleteBrandUseCase : IDeleteBrandUseCase
|
||||
{
|
||||
private readonly IBrandRepository _repo;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public DeleteBrandUseCase(IBrandRepository repo, ITenantResolver tr, IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo;
|
||||
_tenantResolver = tr;
|
||||
_http = http;
|
||||
}
|
||||
|
||||
public async Task<bool> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
var n = await _repo.SoftDeleteAsync(id, tid, ct);
|
||||
return n > 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Brand;
|
||||
|
||||
public sealed class GetBrandUseCase : IGetBrandUseCase
|
||||
{
|
||||
private readonly IBrandRepository _repo;
|
||||
public GetBrandUseCase(IBrandRepository repo) => _repo = repo;
|
||||
|
||||
public async Task<BrandResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
return e is null ? null : new BrandResponse(e.Id, e.Scope, e.Code, e.Name, e.NameI18n, e.OverridesGlobalId, e.IsActive, e.IsSystem, e.Meta);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Brand;
|
||||
|
||||
public sealed class ListBrandsUseCase : IListBrandsUseCase
|
||||
{
|
||||
private readonly IBrandRepository _repo;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public ListBrandsUseCase(IBrandRepository repo, ITenantResolver tenantResolver, IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo;
|
||||
_tenantResolver = tenantResolver;
|
||||
_http = http;
|
||||
}
|
||||
|
||||
public async Task<PagedResponse<BrandResponse>> ExecuteAsync(BrandListRequest req, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
var page = await _repo.SearchEffectiveAsync(tid, req, ct);
|
||||
var items = page.Items.Select(Map).ToList();
|
||||
return new PagedResponse<BrandResponse>(page.Page, page.PageSize, page.Total, items);
|
||||
}
|
||||
|
||||
private static BrandResponse Map(Domain.Entities.MasterData.Brand e) =>
|
||||
new(e.Id, e.Scope, e.Code, e.Name, e.NameI18n, e.OverridesGlobalId, e.IsActive, e.IsSystem, e.Meta);
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System.Data;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Brand;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Common;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Brand;
|
||||
|
||||
public sealed class UpdateBrandUseCase : IUpdateBrandUseCase
|
||||
{
|
||||
private readonly IBrandRepository _repo;
|
||||
private readonly IUnitOfWork _uow;
|
||||
|
||||
public UpdateBrandUseCase(IBrandRepository repo, IUnitOfWork uow) { _repo = repo; _uow = uow; }
|
||||
|
||||
public async Task<BrandResponse?> ExecuteAsync(Guid id, BrandUpdateRequest req, CancellationToken ct = default)
|
||||
{
|
||||
await _uow.BeginAsync(null, IsolationLevel.ReadCommitted, ct);
|
||||
try
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
if (e is null) { await _uow.RollbackAsync(ct); return null; }
|
||||
|
||||
e.Name = req.Name.Trim();
|
||||
e.NameI18n = req.NameI18n;
|
||||
e.Meta = req.Meta;
|
||||
e.IsActive = req.IsActive;
|
||||
|
||||
await _repo.UpdateAsync(e, ct);
|
||||
await _uow.CommitAsync(ct);
|
||||
|
||||
return new BrandResponse(e.Id, e.Scope, e.Code, e.Name, e.NameI18n, e.OverridesGlobalId, e.IsActive, e.IsSystem, e.Meta);
|
||||
}
|
||||
catch
|
||||
{
|
||||
await _uow.RollbackAsync(ct);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.District;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.District;
|
||||
|
||||
public sealed class GetDistrictUseCase : IGetDistrictUseCase
|
||||
{
|
||||
private readonly IDistrictRepository _repo;
|
||||
|
||||
public GetDistrictUseCase(IDistrictRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public async Task<DistrictResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
if (e is null) return null;
|
||||
|
||||
return new DistrictResponse(
|
||||
e.Id,
|
||||
e.Scope,
|
||||
e.Code,
|
||||
e.Name,
|
||||
e.NameI18n,
|
||||
e.OverridesGlobalId,
|
||||
e.IsActive,
|
||||
e.IsSystem,
|
||||
e.Meta,
|
||||
e.Code,
|
||||
e.ProvinceId,
|
||||
e.Province.Name,
|
||||
e.Province.Code
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.District;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.District;
|
||||
|
||||
public sealed class ListDistrictsUseCase : IListDistrictsUseCase
|
||||
{
|
||||
private readonly IDistrictRepository _repo;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public ListDistrictsUseCase(
|
||||
IDistrictRepository repo,
|
||||
ITenantResolver tenantResolver,
|
||||
IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo;
|
||||
_tenantResolver = tenantResolver;
|
||||
_http = http;
|
||||
}
|
||||
|
||||
public async Task<PagedResponse<DistrictResponse>> ExecuteAsync(DistrictListRequest req, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
var page = await _repo.SearchEffectiveAsync(tid, req, ct);
|
||||
var items = page.Items.Select(Map).ToList();
|
||||
|
||||
return new PagedResponse<DistrictResponse>(page.Page, page.PageSize, page.Total, items);
|
||||
}
|
||||
|
||||
private static DistrictResponse Map(Domain.Entities.MasterData.District e) =>
|
||||
new(
|
||||
e.Id,
|
||||
e.Scope,
|
||||
e.Code,
|
||||
e.Name,
|
||||
e.NameI18n,
|
||||
e.OverridesGlobalId,
|
||||
e.IsActive,
|
||||
e.IsSystem,
|
||||
e.Meta,
|
||||
e.Code,
|
||||
e.ProvinceId,
|
||||
e.Province.Name,
|
||||
e.Province.Code
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Province;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Province;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Province;
|
||||
|
||||
public sealed class GetProvinceUseCase : IGetProvinceUseCase
|
||||
{
|
||||
private readonly IProvinceRepository _repo;
|
||||
|
||||
public GetProvinceUseCase(IProvinceRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public async Task<ProvinceResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
if (e is null) return null;
|
||||
|
||||
return new ProvinceResponse(
|
||||
e.Id,
|
||||
e.Scope,
|
||||
e.Code,
|
||||
e.Name,
|
||||
e.NameI18n,
|
||||
e.OverridesGlobalId,
|
||||
e.IsActive,
|
||||
e.IsSystem,
|
||||
e.Meta,
|
||||
e.Code
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Province;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Province;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Province;
|
||||
|
||||
public sealed class ListProvincesUseCase : IListProvincesUseCase
|
||||
{
|
||||
private readonly IProvinceRepository _repo;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public ListProvincesUseCase(
|
||||
IProvinceRepository repo,
|
||||
ITenantResolver tenantResolver,
|
||||
IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo;
|
||||
_tenantResolver = tenantResolver;
|
||||
_http = http;
|
||||
}
|
||||
|
||||
public async Task<PagedResponse<ProvinceResponse>> ExecuteAsync(ProvinceListRequest req, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
var page = await _repo.SearchEffectiveAsync(tid, req, ct);
|
||||
var items = page.Items.Select(Map).ToList();
|
||||
|
||||
return new PagedResponse<ProvinceResponse>(page.Page, page.PageSize, page.Total, items);
|
||||
}
|
||||
|
||||
private static ProvinceResponse Map(Domain.Entities.MasterData.Province e) =>
|
||||
new(
|
||||
e.Id,
|
||||
e.Scope,
|
||||
e.Code,
|
||||
e.Name,
|
||||
e.NameI18n,
|
||||
e.OverridesGlobalId,
|
||||
e.IsActive,
|
||||
e.IsSystem,
|
||||
e.Meta,
|
||||
e.Code
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Subdistrict;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Subdistrict;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Subdistricts;
|
||||
|
||||
public sealed class GetSubdistrictUseCase : IGetSubdistrictUseCase
|
||||
{
|
||||
private readonly ISubdistrictRepository _repo;
|
||||
|
||||
public GetSubdistrictUseCase(ISubdistrictRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
public async Task<SubdistrictResponse?> ExecuteAsync(Guid id, CancellationToken ct = default)
|
||||
{
|
||||
var e = await _repo.GetAsync(id, ct);
|
||||
if (e is null) return null;
|
||||
|
||||
return new SubdistrictResponse(
|
||||
e.Id,
|
||||
e.Scope,
|
||||
e.Code,
|
||||
e.Name,
|
||||
e.NameI18n,
|
||||
e.OverridesGlobalId,
|
||||
e.IsActive,
|
||||
e.IsSystem,
|
||||
e.Meta,
|
||||
e.Code,
|
||||
e.Postcode,
|
||||
e.DistrictId,
|
||||
e.District.Name,
|
||||
e.District.Code,
|
||||
e.District.ProvinceId,
|
||||
e.District.Province.Name,
|
||||
e.District.Province.Code
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using AMREZ.EOP.Abstractions.Applications.Tenancy;
|
||||
using AMREZ.EOP.Abstractions.Applications.UseCases.MasterData.Subdistrict;
|
||||
using AMREZ.EOP.Abstractions.Infrastructures.Repositories;
|
||||
using AMREZ.EOP.Contracts.DTOs.Common;
|
||||
using AMREZ.EOP.Contracts.DTOs.MasterData.Subdistrict;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace AMREZ.EOP.Application.UseCases.MasterData.Subdistricts;
|
||||
|
||||
public sealed class ListSubdistrictsUseCase : IListSubdistrictsUseCase
|
||||
{
|
||||
private readonly ISubdistrictRepository _repo;
|
||||
private readonly ITenantResolver _tenantResolver;
|
||||
private readonly IHttpContextAccessor _http;
|
||||
|
||||
public ListSubdistrictsUseCase(
|
||||
ISubdistrictRepository repo,
|
||||
ITenantResolver tenantResolver,
|
||||
IHttpContextAccessor http)
|
||||
{
|
||||
_repo = repo;
|
||||
_tenantResolver = tenantResolver;
|
||||
_http = http;
|
||||
}
|
||||
|
||||
public async Task<PagedResponse<SubdistrictResponse>> ExecuteAsync(SubdistrictListRequest req, CancellationToken ct = default)
|
||||
{
|
||||
var http = _http.HttpContext ?? throw new InvalidOperationException("No HttpContext");
|
||||
var tc = _tenantResolver.Resolve(http) ?? throw new InvalidOperationException("No tenant");
|
||||
var tid = Guid.Parse(tc.Id);
|
||||
|
||||
var page = await _repo.SearchEffectiveAsync(tid, req, ct);
|
||||
var items = page.Items.Select(Map).ToList();
|
||||
|
||||
return new PagedResponse<SubdistrictResponse>(page.Page, page.PageSize, page.Total, items);
|
||||
}
|
||||
|
||||
private static SubdistrictResponse Map(Domain.Entities.MasterData.Subdistrict e) =>
|
||||
new(
|
||||
e.Id,
|
||||
e.Scope,
|
||||
e.Code,
|
||||
e.Name,
|
||||
e.NameI18n,
|
||||
e.OverridesGlobalId,
|
||||
e.IsActive,
|
||||
e.IsSystem,
|
||||
e.Meta,
|
||||
e.Code,
|
||||
e.Postcode,
|
||||
e.DistrictId,
|
||||
e.District.Name,
|
||||
e.District.Code,
|
||||
e.District.ProvinceId,
|
||||
e.District.Province.Name,
|
||||
e.District.Province.Code
|
||||
);
|
||||
}
|
||||
3
AMREZ.EOP.Contracts/DTOs/Common/PagedResponse.cs
Normal file
3
AMREZ.EOP.Contracts/DTOs/Common/PagedResponse.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.Common;
|
||||
|
||||
public sealed record PagedResponse<T>(int Page, int PageSize, int Total, IReadOnlyList<T> Items);
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.ImportData.Location;
|
||||
|
||||
public sealed class LocationImportResultDto
|
||||
{
|
||||
public int RowsRead { get; set; }
|
||||
|
||||
public int ProvincesCreated { get; set; }
|
||||
public int ProvincesUpdated { get; set; }
|
||||
|
||||
public int DistrictsCreated { get; set; }
|
||||
public int DistrictsUpdated { get; set; }
|
||||
|
||||
public int SubdistrictsCreated { get; set; }
|
||||
public int SubdistrictsUpdated { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
public sealed record AllergenCreateRequest(
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
string Scope = "tenant",
|
||||
Guid? OverridesGlobalId = null,
|
||||
bool IsActive = true
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
public sealed record AllergenListRequest(
|
||||
int Page = 1,
|
||||
int PageSize = 20,
|
||||
string? Search = null,
|
||||
bool IncludeInactive = false,
|
||||
bool IncludeOverrides = true
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
public sealed record AllergenResponse(
|
||||
Guid Id,
|
||||
string Scope,
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Guid? OverridesGlobalId,
|
||||
bool IsActive,
|
||||
bool IsSystem,
|
||||
Dictionary<string, object>? Meta
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Allergen;
|
||||
|
||||
public sealed record AllergenUpdateRequest(
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
bool IsActive
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
public sealed record BrandCreateRequest(
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
string Scope = "tenant",
|
||||
Guid? OverridesGlobalId = null,
|
||||
bool IsActive = true
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
public sealed record BrandListRequest(
|
||||
int Page = 1,
|
||||
int PageSize = 20,
|
||||
string? Search = null,
|
||||
bool IncludeInactive = false,
|
||||
bool IncludeOverrides = true
|
||||
);
|
||||
13
AMREZ.EOP.Contracts/DTOs/MasterData/Brand/BrandResponse.cs
Normal file
13
AMREZ.EOP.Contracts/DTOs/MasterData/Brand/BrandResponse.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
public sealed record BrandResponse(
|
||||
Guid Id,
|
||||
string Scope,
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Guid? OverridesGlobalId,
|
||||
bool IsActive,
|
||||
bool IsSystem,
|
||||
Dictionary<string, object>? Meta
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Brand;
|
||||
|
||||
public sealed record BrandUpdateRequest(
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
bool IsActive
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Category;
|
||||
|
||||
public sealed record CategoryCreateRequest(
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
string Scope = "tenant",
|
||||
Guid? OverridesGlobalId = null,
|
||||
bool IsActive = true
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Category;
|
||||
|
||||
public sealed record CategoryListRequest(
|
||||
int Page = 1,
|
||||
int PageSize = 20,
|
||||
string? Search = null,
|
||||
bool IncludeInactive = false,
|
||||
bool IncludeOverrides = true
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Category;
|
||||
|
||||
public sealed record CategoryResponse(
|
||||
Guid Id,
|
||||
string Scope,
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Guid? OverridesGlobalId,
|
||||
bool IsActive,
|
||||
bool IsSystem,
|
||||
Dictionary<string, object>? Meta
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Category;
|
||||
|
||||
public sealed record CategoryUpdateRequest(
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
bool IsActive
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.ComplianceStatus;
|
||||
|
||||
public sealed record ComplianceStatusCreateRequest(
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
string Scope = "tenant",
|
||||
Guid? OverridesGlobalId = null,
|
||||
bool IsActive = true
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.ComplianceStatus;
|
||||
|
||||
public sealed record ComplianceStatusListRequest(
|
||||
int Page = 1,
|
||||
int PageSize = 20,
|
||||
string? Search = null,
|
||||
bool IncludeInactive = false,
|
||||
bool IncludeOverrides = true
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.ComplianceStatus;
|
||||
|
||||
public sealed record ComplianceStatusResponse(
|
||||
Guid Id,
|
||||
string Scope,
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Guid? OverridesGlobalId,
|
||||
bool IsActive,
|
||||
bool IsSystem,
|
||||
Dictionary<string, object>? Meta
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.ComplianceStatus;
|
||||
|
||||
public sealed record ComplianceStatusUpdateRequest(
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
bool IsActive
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Country;
|
||||
|
||||
public sealed record CountryCreateRequest(
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
string Scope = "tenant",
|
||||
Guid? OverridesGlobalId = null,
|
||||
bool IsActive = true
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Country;
|
||||
|
||||
public sealed record CountryListRequest(
|
||||
int Page = 1,
|
||||
int PageSize = 20,
|
||||
string? Search = null,
|
||||
bool IncludeInactive = false,
|
||||
bool IncludeOverrides = true
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Country;
|
||||
|
||||
public sealed record CountryResponse(
|
||||
Guid Id,
|
||||
string Scope,
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Guid? OverridesGlobalId,
|
||||
bool IsActive,
|
||||
bool IsSystem,
|
||||
Dictionary<string, object>? Meta
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Country;
|
||||
|
||||
public sealed record CountryUpdateRequest(
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
bool IsActive
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Currency;
|
||||
|
||||
public sealed record CurrencyCreateRequest(
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
string Scope = "tenant",
|
||||
Guid? OverridesGlobalId = null,
|
||||
bool IsActive = true
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Currency;
|
||||
|
||||
public sealed record CurrencyListRequest(
|
||||
int Page = 1,
|
||||
int PageSize = 20,
|
||||
string? Search = null,
|
||||
bool IncludeInactive = false,
|
||||
bool IncludeOverrides = true
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Currency;
|
||||
|
||||
public sealed record CurrencyResponse(
|
||||
Guid Id,
|
||||
string Scope,
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Guid? OverridesGlobalId,
|
||||
bool IsActive,
|
||||
bool IsSystem,
|
||||
Dictionary<string, object>? Meta
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.Currency;
|
||||
|
||||
public sealed record CurrencyUpdateRequest(
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
bool IsActive
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
|
||||
public sealed record DistrictListRequest(
|
||||
int Page = 1,
|
||||
int PageSize = 20,
|
||||
string? Search = null,
|
||||
Guid? ProvinceId = default,
|
||||
string? ProvinceCode = default,
|
||||
bool IncludeInactive = false,
|
||||
bool IncludeOverrides = true
|
||||
);
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.District;
|
||||
|
||||
public sealed record DistrictResponse(
|
||||
Guid Id,
|
||||
string Scope,
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Guid? OverridesGlobalId,
|
||||
bool IsActive,
|
||||
bool IsSystem,
|
||||
Dictionary<string, object>? Meta,
|
||||
string DopaCode,
|
||||
Guid ProvinceId,
|
||||
string ProvinceName,
|
||||
string ProvinceDopaCode
|
||||
);
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.DocControlStatus;
|
||||
|
||||
public sealed record DocControlStatusCreateRequest(
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
string Scope = "tenant",
|
||||
Guid? OverridesGlobalId = null,
|
||||
bool IsActive = true
|
||||
);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.DocControlStatus;
|
||||
|
||||
public sealed record DocControlStatusListRequest(
|
||||
int Page = 1,
|
||||
int PageSize = 20,
|
||||
string? Search = null,
|
||||
bool IncludeInactive = false,
|
||||
bool IncludeOverrides = true
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.DocControlStatus;
|
||||
|
||||
public sealed record DocControlStatusResponse(
|
||||
Guid Id,
|
||||
string Scope,
|
||||
string Code,
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Guid? OverridesGlobalId,
|
||||
bool IsActive,
|
||||
bool IsSystem,
|
||||
Dictionary<string, object>? Meta
|
||||
);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AMREZ.EOP.Contracts.DTOs.MasterData.DocControlStatus;
|
||||
|
||||
public sealed record DocControlStatusUpdateRequest(
|
||||
string Name,
|
||||
Dictionary<string, string>? NameI18n,
|
||||
Dictionary<string, object>? Meta,
|
||||
bool IsActive
|
||||
);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user