Refactor LeaveBeginningController to simplify duplicate check and comment out LeaveYear property in EditLeaveBeginningDto #2341
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 1m41s

This commit is contained in:
Suphonchai Phoonsawat 2026-02-25 16:26:28 +07:00
parent 006cea048d
commit f866435897
2 changed files with 3 additions and 4 deletions

View file

@ -590,8 +590,7 @@ namespace BMA.EHR.Leave.Service.Controllers
return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound);
}
// check duplicate
var oldData = await _context.LeaveBeginnings.Where(x => x.ProfileId == req.ProfileId
&& x.LeaveYear == req.LeaveYear).ToListAsync();
var oldData = await _context.LeaveBeginnings.Where(x => x.ProfileId == req.ProfileId).ToListAsync();
foreach(var item in oldData)
{

View file

@ -51,8 +51,8 @@ namespace BMA.EHR.Leave.Service.DTOs.LeaveBeginnings
[Required]
public Guid ProfileId { get; set; } = Guid.Empty;
[Required, Comment("ปีงบประมาณ")]
public int LeaveYear { get; set; } = 0;
// [Required, Comment("ปีงบประมาณ")]
// public int LeaveYear { get; set; } = 0;
public Guid? RootDnaId { get; set; }
public Guid? Child1DnaId { get; set; }