api ลาออก

This commit is contained in:
Kittapath 2023-08-08 11:04:41 +07:00
parent 7b038f0131
commit ed52581e58
15 changed files with 788 additions and 72 deletions

View file

@ -1,8 +1,6 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.MetaData;
using BMA.EHR.Domain.Models.Placement;
using BMA.EHR.Domain.Models.Retirement;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
@ -11,10 +9,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;
using System.Drawing;
using System.Linq;
using System.Security.Claims;
using System.Security.Cryptography;
namespace BMA.EHR.Retirement.Service.Controllers
{
@ -363,7 +358,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var retireOld = await _context.RetirementPeriods
.FirstOrDefaultAsync(x => x.Id == req.RetireHistoryId);
if (retireOld == null)
return Error(GlobalMessages.InvalidRetirementRequest, 404);
return Error(GlobalMessages.RetirementNotFound, 404);
var profileOlds = await _context.RetirementProfiles.AsQueryable()
.Where(x => x.RetirementPeriod == retireOld)
.ToListAsync();
@ -441,7 +436,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var profileHistorys = await _context.RetirementPeriodHistorys.AsQueryable()
.FirstOrDefaultAsync(x => x.Id == retireId);
if (profileHistorys == null)
return Error(GlobalMessages.InvalidRetirementHistoryRequest, 404);
return Error(GlobalMessages.RetirementHistoryNotFound, 404);
using (var client = new HttpClient())
{
var url = $"https://s3cluster.frappet.com/bma-ehr-fpt/{profileHistorys.ProfileFile}.json";
@ -526,7 +521,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.ThenInclude(x => x.Profile)
.FirstOrDefaultAsync(x => x.Id == retireId);
if (retire == null)
return Error(GlobalMessages.InvalidRetirementRequest, 404);
return Error(GlobalMessages.RetirementNotFound, 404);
if (retire.RetirementProfiles.Where(x => x.Profile == profile).Count() > 0)
return Error("บุคคลนี้ได้ทำการเลือกไว้อยู่แล้ว");
foreach (var retire_profile in retire.RetirementProfiles)
@ -671,7 +666,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var retire = await _context.RetirementPeriods
.FirstOrDefaultAsync(x => x.Id == retireId);
if (retire == null)
return Error(GlobalMessages.InvalidRetirementRequest, 404);
return Error(GlobalMessages.RetirementNotFound, 404);
await GenOrderByYear(retire.Id);