diff --git a/BMA.EHR.Leave/Controllers/LeaveBeginningController.cs b/BMA.EHR.Leave/Controllers/LeaveBeginningController.cs index 245176da..28f88302 100644 --- a/BMA.EHR.Leave/Controllers/LeaveBeginningController.cs +++ b/BMA.EHR.Leave/Controllers/LeaveBeginningController.cs @@ -500,15 +500,15 @@ namespace BMA.EHR.Leave.Service.Controllers [HttpPut("schedule")] [AllowAnonymous] - public async Task> ScheduleUpdateLeaveBeginningAsync([FromBody] EditLeaveBeginningDto req) + public async Task> ScheduleUpdateLeaveBeginningAsync([FromBody] ScheduleEditLeaveBeginningDto req) { try { - var profile = await _userProfileRepository.GetProfileByProfileIdNoAuthAsync(req.ProfileId, AccessToken); - if(profile == null) - { - return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound); - } + // var profile = await _userProfileRepository.GetProfileByProfileIdNoAuthAsync(req.ProfileId, AccessToken); + // if(profile == null) + // { + // return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound); + // } // check duplicate var oldData = await _context.LeaveBeginnings.FirstOrDefaultAsync(x => x.ProfileId == req.ProfileId && x.LeaveTypeId == req.LeaveTypeId @@ -520,23 +520,23 @@ namespace BMA.EHR.Leave.Service.Controllers oldData.LeaveTypeId = req.LeaveTypeId; oldData.LeaveYear = req.LeaveYear; oldData.LeaveDays = req.LeaveDays; - oldData.LeaveDaysUsed = req.LeaveDaysUsed; - oldData.LeaveCount = req.LeaveCount; - oldData.BeginningLeaveDays = req.BeginningLeaveDays; - oldData.BeginningLeaveCount = req.BeginningLeaveCount; + // oldData.LeaveDaysUsed = req.LeaveDaysUsed; + // oldData.LeaveCount = req.LeaveCount; + // oldData.BeginningLeaveDays = req.BeginningLeaveDays; + // oldData.BeginningLeaveCount = req.BeginningLeaveCount; - oldData.ProfileId = req.ProfileId; - oldData.Prefix = profile.Prefix; - oldData.FirstName = profile.FirstName; - oldData.LastName = profile.LastName; - oldData.RootDnaId = profile.RootDnaId; - oldData.Child1DnaId = profile.Child1DnaId; - oldData.Child2DnaId = profile.Child2DnaId; - oldData.Child3DnaId = profile.Child3DnaId; - oldData.Child4DnaId = profile.Child4DnaId; + // oldData.ProfileId = req.ProfileId; + // oldData.Prefix = profile.Prefix; + // oldData.FirstName = profile.FirstName; + // oldData.LastName = profile.LastName; + // oldData.RootDnaId = profile.RootDnaId; + // oldData.Child1DnaId = profile.Child1DnaId; + // oldData.Child2DnaId = profile.Child2DnaId; + // oldData.Child3DnaId = profile.Child3DnaId; + // oldData.Child4DnaId = profile.Child4DnaId; oldData.LastUpdateUserId = ""; - oldData.LastUpdateFullName = FullName ?? ""; + oldData.LastUpdateFullName = "System"; oldData.LastUpdatedAt = DateTime.Now; await _leaveBeginningRepository.UpdateAsync(oldData); diff --git a/BMA.EHR.Leave/DTOs/LeaveBeginnings/EditLeaveBeginningDto.cs b/BMA.EHR.Leave/DTOs/LeaveBeginnings/EditLeaveBeginningDto.cs index d4a2661f..fe0c433f 100644 --- a/BMA.EHR.Leave/DTOs/LeaveBeginnings/EditLeaveBeginningDto.cs +++ b/BMA.EHR.Leave/DTOs/LeaveBeginnings/EditLeaveBeginningDto.cs @@ -29,4 +29,20 @@ namespace BMA.EHR.Leave.Service.DTOs.LeaveBeginnings [Comment("จำนวนครั้งที่ลายกมา")] public int BeginningLeaveCount { get; set; } = 0; } + + + public class ScheduleEditLeaveBeginningDto + { + [Required] + public Guid ProfileId { get; set; } = Guid.Empty; + + [Required] + public Guid LeaveTypeId { get; set; } = Guid.Empty; + + [Required, Comment("ปีงบประมาณ")] + public int LeaveYear { get; set; } = 0; + + [Required, Comment("จำนวนวันลายกมา")] + public double LeaveDays { get; set; } = 0.0; + } }