Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop
This commit is contained in:
commit
33f979c5ad
73 changed files with 226 additions and 172 deletions
164
.github/workflows/release_leave.yaml
vendored
164
.github/workflows/release_leave.yaml
vendored
|
|
@ -1,89 +1,89 @@
|
|||
name: release-dev
|
||||
run-name: release-dev ${{ github.actor }}
|
||||
on:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
# push:
|
||||
# tags:
|
||||
# - 'v[0-9]+.[0-9]+.[0-9]+'
|
||||
# tags-ignore:
|
||||
# - '2.*'
|
||||
# Allow run workflow manually from Action tab
|
||||
workflow_dispatch:
|
||||
env:
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-leave-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-leave
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
REGISTRY: docker.frappet.com
|
||||
IMAGE_NAME: ehr/bma-ehr-leave-service
|
||||
DEPLOY_HOST: frappet.com
|
||||
DEPLOY_PORT: 10102
|
||||
# COMPOSE_PATH: /home/frappet/docker/bma-ehr
|
||||
COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-leave
|
||||
TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0
|
||||
|
||||
jobs:
|
||||
# act workflow_dispatch -W .github/workflows/release_leave.yaml --input IMAGE_VER=leave-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Leave.Service/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
# act workflow_dispatch -W .github/workflows/release_leave.yaml --input IMAGE_VER=leave-1.0.0 -s DOCKER_USER=sorawit -s DOCKER_PASS=P@ssword -s SSH_PASSWORD=P@ssw0rd
|
||||
release-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# skip Set up QEMU because it fail on act and container
|
||||
- name: Gen Version
|
||||
id: gen_ver
|
||||
run: |
|
||||
if [[ $GITHUB_REF == 'refs/tags/'* ]]; then
|
||||
IMAGE_VER='${GITHUB_REF/refs\/tags\//}'
|
||||
else
|
||||
IMAGE_VER=${{ github.event.inputs.IMAGE_VER }}
|
||||
fi
|
||||
if [[ $IMAGE_VER == '' ]]; then
|
||||
IMAGE_VER='test-vBeta'
|
||||
fi
|
||||
echo '::set-output name=image_ver::'$IMAGE_VER
|
||||
- name: Test Version
|
||||
run: |
|
||||
echo $GITHUB_REF
|
||||
echo ${{ steps.gen_ver.outputs.image_ver }}
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- name: Login in to registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{env.REGISTRY}}
|
||||
username: ${{secrets.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_PASS}}
|
||||
- name: Build and load local docker image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
file: BMA.EHR.Leave/Dockerfile
|
||||
push: true
|
||||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:${{ steps.gen_ver.outputs.image_ver }},${{env.REGISTRY}}/${{env.IMAGE_NAME}}:latest
|
||||
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- name: Reload docker compose
|
||||
uses: appleboy/ssh-action@v0.1.8
|
||||
with:
|
||||
host: ${{env.DEPLOY_HOST}}
|
||||
username: frappet
|
||||
password: ${{ secrets.SSH_PASSWORD }}
|
||||
port: ${{env.DEPLOY_PORT}}
|
||||
script: |
|
||||
cd "${{env.COMPOSE_PATH}}"
|
||||
docker compose pull
|
||||
docker compose up -d
|
||||
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: success()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Success✅✅✅
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
- uses: snow-actions/line-notify@v1.1.0
|
||||
if: failure()
|
||||
with:
|
||||
access_token: ${{ env.TOKEN_LINE }}
|
||||
message: |
|
||||
-Failure❌❌❌
|
||||
Image: ${{env.IMAGE_NAME}}
|
||||
Version: ${{ github.event.inputs.IMAGE_VER }}
|
||||
By: ${{secrets.DOCKER_USER}}
|
||||
|
|
|
|||
13
.idea/.idea.BMA.EHR.Solution/.idea/.gitignore
generated
vendored
13
.idea/.idea.BMA.EHR.Solution/.idea/.gitignore
generated
vendored
|
|
@ -1,13 +0,0 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Rider ignored files
|
||||
/contentModel.xml
|
||||
/.idea.BMA.EHR.Solution.iml
|
||||
/modules.xml
|
||||
/projectSettingsUpdater.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
1
.idea/.idea.BMA.EHR.Solution/.idea/.name
generated
1
.idea/.idea.BMA.EHR.Solution/.idea/.name
generated
|
|
@ -1 +0,0 @@
|
|||
BMA.EHR.Solution
|
||||
|
Before Width: | Height: | Size: 16 B |
4
.idea/.idea.BMA.EHR.Solution/.idea/encodings.xml
generated
4
.idea/.idea.BMA.EHR.Solution/.idea/encodings.xml
generated
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.BMA.EHR.Solution/.idea/vcs.xml
generated
6
.idea/.idea.BMA.EHR.Solution/.idea/vcs.xml
generated
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -113,10 +113,10 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
if (entity.Type != null)
|
||||
{
|
||||
|
||||
|
||||
_dbContext.Attatch(entity.Type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return await base.UpdateAsync(entity);
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<List<LeaveRequest>> GetLeaveRequestByYearAsync(int year)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStartDate.Year == year)
|
||||
.Where(x => x.LeaveStatus != "REJECT" && x.LeaveStatus != "DELETE")
|
||||
|
|
@ -137,7 +137,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<List<LeaveRequest>> GetLeaveRequestByUserIdAsync(Guid keycloakUserId, int year, Guid type, string status)
|
||||
{
|
||||
var rawData = _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var rawData = _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId);
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<List<LeaveRequest>> GetLeaveRequestForAdminAsync(int year, Guid type, string status, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var rawData = _dbContext.Set<LeaveRequest>()
|
||||
var rawData = _dbContext.Set<LeaveRequest>().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStatus != "DRAFT")
|
||||
.AsQueryable();
|
||||
|
|
@ -182,14 +182,15 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<double> GetRestDayTotalByYearForUserAsync(Guid keycloakUserId, int year)
|
||||
{
|
||||
var leaveType = await _dbContext.Set<LeaveType>().AsQueryable().FirstOrDefaultAsync(l => l.Code.Trim().ToUpper() == "LV-005");
|
||||
var leaveType = await _dbContext.Set<LeaveType>().AsQueryable().AsNoTracking()
|
||||
.FirstOrDefaultAsync(l => l.Code.Trim().ToUpper() == "LV-005");
|
||||
|
||||
if (leaveType == null)
|
||||
{
|
||||
throw new Exception("ไม่พบข้อมูลประเภทการลาพักผ่อน โปรดติดต่อผู้ดูและระบบ");
|
||||
}
|
||||
|
||||
var data = _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveType.Id)
|
||||
|
|
@ -201,7 +202,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<double> GetSumLeaveByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId, int year)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
|
|
@ -214,7 +215,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<DateTime?> GetLeaveLastByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
|
|
@ -228,7 +229,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<LeaveRequest?> GetLastLeaveRequestByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
|
|
@ -241,7 +242,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<List<LeaveRequest>> GetCancelLeaveRequestForAdminAsync(int year, Guid type, string status)
|
||||
{
|
||||
var rawData = _dbContext.Set<LeaveRequest>()
|
||||
var rawData = _dbContext.Set<LeaveRequest>().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStatus == "DELETE")
|
||||
.AsQueryable();
|
||||
|
|
@ -517,7 +518,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
public async Task<List<GetSumApproveLeaveByTypeDto>> GetSumSendLeaveAsync(int year)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveStartDate.Year == year)
|
||||
.ToListAsync();
|
||||
|
||||
|
|
@ -603,7 +604,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<double> GetSumSendLeaveByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId, int year)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
|
|
@ -615,7 +616,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<double> GetSumApproveLeaveByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId, int year)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
|
|
@ -631,7 +632,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<double> GetSumApproveLeaveByRangeForUser(Guid keycloakUserId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
|
||||
|
|
@ -688,7 +689,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<double> GetSumApproveLeaveByTypeAndRangeForUser(Guid keycloakUserId, Guid leaveTypeId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
|
|
@ -704,7 +705,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<int> GetCountApproveLeaveByTypeAndRangeForUser(Guid keycloakUserId, Guid leaveTypeId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
|
|
@ -717,7 +718,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<double> GetSumRejectLeaveByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId, int year)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.Type.Id == leaveTypeId)
|
||||
|
|
@ -752,7 +753,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
var leaveStatus = new List<string>() { "NEW", "PENDING", "APPROVE" };
|
||||
if (range == "ALL")
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
//.Where(x => x.LeaveRange == "ALL")
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
|
|
@ -764,7 +765,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
}
|
||||
else
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.LeaveRange == range)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
|
|
@ -791,7 +792,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<LeaveRequest?> GetLeavePeriodAsync(Guid keycloakUserId, DateTime date)
|
||||
{
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
|
||||
var data = await _dbContext.Set<LeaveRequest>().AsQueryable().AsNoTracking()
|
||||
.Include(x => x.Type)
|
||||
.Where(x => x.KeycloakUserId == keycloakUserId)
|
||||
.Where(x => x.LeaveStatus == "APPROVE")
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
|
|||
|
||||
public async Task<LeaveType?> GetLeaveTypeByCodeAsync(string code)
|
||||
{
|
||||
return await _dbContext.Set<LeaveType>().FirstOrDefaultAsync(x => x.Code == code);
|
||||
return await _dbContext.Set<LeaveType>().AsNoTracking().FirstOrDefaultAsync(x => x.Code == code);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ namespace BMA.EHR.Application.Responses.Profiles
|
|||
|
||||
public string? Gender { get; set; }
|
||||
|
||||
public string? ProfileType { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class PosLevel
|
||||
|
|
@ -89,9 +91,11 @@ namespace BMA.EHR.Application.Responses.Profiles
|
|||
|
||||
public string PositionLevel { get; set; } = string.Empty;
|
||||
|
||||
public string PositionType { get; set; } = string.Empty;
|
||||
public string PositionType { get; set; } = string.Empty;
|
||||
|
||||
public string Position { get; set; } = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class ProfileInsignia
|
||||
|
|
|
|||
|
|
@ -1041,10 +1041,13 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
|
||||
|
||||
//var profile = await _context.Profiles.Include(x => x.Salaries).FirstOrDefaultAsync(x => x.Id == req.ProfileId);
|
||||
var profile = _userProfileRepository.GetOfficerProfileById(req.ProfileId, AccessToken);
|
||||
var profileTest = _userProfileRepository.GetOfficerProfileById(req.ProfileId, AccessToken);
|
||||
|
||||
if (profile == null)
|
||||
if (profileTest == null)
|
||||
return Error(GlobalMessages.DataNotFound);
|
||||
|
||||
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(profileTest.Keycloak ?? Guid.Empty, AccessToken ?? "");
|
||||
|
||||
var insignia = await _context.Insignias.FirstOrDefaultAsync(x => x.Id == req.insigniaId);
|
||||
|
||||
if (insignia == null)
|
||||
|
|
@ -1103,6 +1106,15 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
}
|
||||
|
||||
|
||||
var lastInsignia = string.Empty;
|
||||
if (profile.ProfileInsignia != null)
|
||||
{
|
||||
var id = profile.ProfileInsignia.Id ?? Guid.Empty;
|
||||
var insigniaEnt = _insigniaPeriodRepository.GetInsigniaById(id);
|
||||
if (insigniaEnt != null)
|
||||
lastInsignia = insigniaEnt.Name;
|
||||
}
|
||||
|
||||
await _context.AddAsync(new InsigniaRequestProfile
|
||||
{
|
||||
Status = "PENDING",
|
||||
|
|
@ -1112,14 +1124,30 @@ namespace BMA.EHR.Insignia.Service.Controllers
|
|||
Reason = req.Reason,
|
||||
RequestDate = DateTime.Now,
|
||||
MatchingConditions = System.Text.Json.JsonSerializer.Serialize(new List<dynamic>()), // serialize to string
|
||||
Salary = profile.ProfileSalary == null || profile.ProfileSalary.Count == 0 ? 0 :
|
||||
profile.ProfileSalary.OrderByDescending(x => x.Order).FirstOrDefault().Amount, //profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
Salary = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.Amount, //profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
|
||||
// Add Information for reused in API Call
|
||||
ProfileType = "officer",
|
||||
Prefix = profile.Prefix,
|
||||
FirstName = profile.FirstName,
|
||||
LastName = profile.LastName,
|
||||
CitizenId = profile.CitizenId,
|
||||
BirthDate = profile.BirthDate,
|
||||
DateAppoint = profile.DateAppoint,
|
||||
Position = profile.Position,
|
||||
Gender = profile.Gender,
|
||||
PosTypeName = profile.PosType!.PosTypeName,
|
||||
PosLevelName = profile.PosLevel!.PosLevelName,
|
||||
PosNo = profile.ProfileSalary == null ? "" : profile.ProfileSalary.PosNo,
|
||||
Amount = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.Amount,
|
||||
PositionSalaryAmount = profile.ProfileSalary == null ? 0 : profile.ProfileSalary.PositionSalaryAmount,
|
||||
LastInsigniaName = lastInsignia
|
||||
});
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DockerfileContext>.</DockerfileContext>
|
||||
<RootNamespace>BMA.EHR.Leave.Service</RootNamespace>
|
||||
<AssemblyName>BMA.EHR.Leave</AssemblyName>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
@ -869,18 +869,24 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
//var count = await _processUserTimeStampRepository.GetTimeStampHistoryForAdminCountAsync(startDate, endDate);
|
||||
|
||||
var imgUrl = $"{_configuration["MinIO:Endpoint"]}{_configuration["MinIO:BucketName"]}";
|
||||
var data = (await _processUserTimeStampRepository.GetTimeStampHistoryForAdminAsync(startDate, endDate))
|
||||
.Select(d => new CheckInProcessHistoryForAdminDto
|
||||
{
|
||||
Id = d.Id,
|
||||
FullName = _userProfileRepository.GetUserFullName(d.KeycloakUserId, AccessToken),
|
||||
|
||||
CheckInDate = d.CheckIn.Date,
|
||||
CheckInTime = d.CheckIn.ToString("HH:mm"),
|
||||
CheckInLocation = d.CheckInPOI,
|
||||
CheckInLat = d.CheckInLat,
|
||||
CheckInLon = d.CheckInLon,
|
||||
CheckInStatus = d.CheckInStatus != "" ? d.CheckInStatus :
|
||||
var resultData = await _processUserTimeStampRepository.GetTimeStampHistoryForAdminAsync(startDate, endDate);
|
||||
var data = new List<CheckInProcessHistoryForAdminDto>();
|
||||
|
||||
foreach (var d in resultData)
|
||||
{
|
||||
var pf = await _userProfileRepository.GetProfileByKeycloakIdAsync(d.KeycloakUserId, AccessToken);
|
||||
if (pf == null) continue;
|
||||
data.Add(new CheckInProcessHistoryForAdminDto
|
||||
{
|
||||
Id = d.Id,
|
||||
FullName = $"{pf.Prefix}{pf.FirstName} {pf.LastName}",
|
||||
CheckInDate = d.CheckIn.Date,
|
||||
CheckInTime = d.CheckIn.ToString("HH:mm"),
|
||||
CheckInLocation = d.CheckInPOI,
|
||||
CheckInLat = d.CheckInLat,
|
||||
CheckInLon = d.CheckInLon,
|
||||
CheckInStatus = d.CheckInStatus != "" ? d.CheckInStatus :
|
||||
DateTime.Parse(d.CheckIn.ToString("yyyy-MM-dd HH:mm")) >
|
||||
DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}") ?
|
||||
|
||||
|
|
@ -891,16 +897,16 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
|
||||
"NORMAL",
|
||||
CheckInIsLocation = d.IsLocationCheckIn,
|
||||
CheckInLocationName = d.CheckInLocationName,
|
||||
//CheckInImageUrl = $"{imgUrl}/{d.CheckInImageUrl}",
|
||||
CheckInIsLocation = d.IsLocationCheckIn,
|
||||
CheckInLocationName = d.CheckInLocationName,
|
||||
//CheckInImageUrl = $"{imgUrl}/{d.CheckInImageUrl}",
|
||||
|
||||
CheckOutDate = d.CheckOut == null ? null : d.CheckOut.Value.Date,
|
||||
CheckOutTime = d.CheckOut == null ? "" : d.CheckOut.Value.ToString("HH:mm"),
|
||||
CheckOutLocation = d.CheckOut == null ? "" : d.CheckOutPOI,
|
||||
CheckOutLat = d.CheckOut == null ? null : d.CheckOutLat,
|
||||
CheckOutLon = d.CheckOut == null ? null : d.CheckOutLon,
|
||||
CheckOutStatus = d.CheckOutStatus != "" ? d.CheckOutStatus :
|
||||
CheckOutDate = d.CheckOut == null ? null : d.CheckOut.Value.Date,
|
||||
CheckOutTime = d.CheckOut == null ? "" : d.CheckOut.Value.ToString("HH:mm"),
|
||||
CheckOutLocation = d.CheckOut == null ? "" : d.CheckOutPOI,
|
||||
CheckOutLat = d.CheckOut == null ? null : d.CheckOutLat,
|
||||
CheckOutLon = d.CheckOut == null ? null : d.CheckOutLon,
|
||||
CheckOutStatus = d.CheckOutStatus != "" ? d.CheckOutStatus :
|
||||
d.CheckOut == null ? null : DateTime.Parse(d.CheckOut.Value.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
"ABSENT" :
|
||||
|
|
@ -908,12 +914,58 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
||||
"ABSENT" :
|
||||
"NORMAL",
|
||||
CheckOutIsLocation = d.IsLocationCheckOut,
|
||||
CheckOutLocationName = d.CheckOutLocationName
|
||||
//CheckOutImageUrl = d.CheckOut == null ? "" : $"{imgUrl}/{d.CheckOutImageUrl}",
|
||||
})
|
||||
CheckOutIsLocation = d.IsLocationCheckOut,
|
||||
CheckOutLocationName = d.CheckOutLocationName
|
||||
//CheckOutImageUrl = d.CheckOut == null ? "" : $"{imgUrl}/{d.CheckOutImageUrl}",
|
||||
});
|
||||
}
|
||||
|
||||
.ToList();
|
||||
|
||||
// var data = (await _processUserTimeStampRepository.GetTimeStampHistoryForAdminAsync(startDate, endDate))
|
||||
// .Select(d => new CheckInProcessHistoryForAdminDto
|
||||
// {
|
||||
// Id = d.Id,
|
||||
// FullName = _userProfileRepository.GetUserFullName(d.KeycloakUserId, AccessToken),
|
||||
|
||||
// CheckInDate = d.CheckIn.Date,
|
||||
// CheckInTime = d.CheckIn.ToString("HH:mm"),
|
||||
// CheckInLocation = d.CheckInPOI,
|
||||
// CheckInLat = d.CheckInLat,
|
||||
// CheckInLon = d.CheckInLon,
|
||||
// CheckInStatus = d.CheckInStatus != "" ? d.CheckInStatus :
|
||||
// DateTime.Parse(d.CheckIn.ToString("yyyy-MM-dd HH:mm")) >
|
||||
// DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}") ?
|
||||
|
||||
// DateTime.Parse(d.CheckIn.ToString("yyyy-MM-dd HH:mm")) >
|
||||
// DateTime.Parse($"{d.CheckIn.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
||||
// "ABSENT" :
|
||||
// "LATE" :
|
||||
|
||||
|
||||
// "NORMAL",
|
||||
// CheckInIsLocation = d.IsLocationCheckIn,
|
||||
// CheckInLocationName = d.CheckInLocationName,
|
||||
// //CheckInImageUrl = $"{imgUrl}/{d.CheckInImageUrl}",
|
||||
|
||||
// CheckOutDate = d.CheckOut == null ? null : d.CheckOut.Value.Date,
|
||||
// CheckOutTime = d.CheckOut == null ? "" : d.CheckOut.Value.ToString("HH:mm"),
|
||||
// CheckOutLocation = d.CheckOut == null ? "" : d.CheckOutPOI,
|
||||
// CheckOutLat = d.CheckOut == null ? null : d.CheckOutLat,
|
||||
// CheckOutLon = d.CheckOut == null ? null : d.CheckOutLon,
|
||||
// CheckOutStatus = d.CheckOutStatus != "" ? d.CheckOutStatus :
|
||||
// d.CheckOut == null ? null : DateTime.Parse(d.CheckOut.Value.ToString("yyyy-MM-dd HH:mm")) <
|
||||
// DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
// "ABSENT" :
|
||||
// DateTime.Parse(d.CheckOut.Value.ToString("yyyy-MM-dd HH:mm")) <
|
||||
// DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeMorning}") ?
|
||||
// "ABSENT" :
|
||||
// "NORMAL",
|
||||
// CheckOutIsLocation = d.IsLocationCheckOut,
|
||||
// CheckOutLocationName = d.CheckOutLocationName
|
||||
// //CheckOutImageUrl = d.CheckOut == null ? "" : $"{imgUrl}/{d.CheckOutImageUrl}",
|
||||
// })
|
||||
|
||||
// .ToList();
|
||||
|
||||
if (keyword != "")
|
||||
{
|
||||
|
|
@ -11,17 +11,17 @@ WORKDIR /src
|
|||
COPY ["BMA.EHR.Domain/BMA.EHR.Domain.csproj", "BMA.EHR.Domain/"]
|
||||
COPY ["BMA.EHR.Application/BMA.EHR.Application.csproj", "BMA.EHR.Application/"]
|
||||
COPY ["BMA.EHR.Infrastructure/BMA.EHR.Infrastructure.csproj", "BMA.EHR.Infrastructure/"]
|
||||
COPY ["BMA.EHR.Leave.Service/BMA.EHR.Leave.Service.csproj", "BMA.EHR.Leave.Service/"]
|
||||
COPY ["BMA.EHR.Leave/BMA.EHR.Leave.csproj", "BMA.EHR.Leave/"]
|
||||
|
||||
RUN dotnet restore "BMA.EHR.Leave.Service/BMA.EHR.Leave.Service.csproj"
|
||||
RUN dotnet restore "BMA.EHR.Leave/BMA.EHR.Leave.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/BMA.EHR.Leave.Service"
|
||||
RUN dotnet build "BMA.EHR.Leave.Service.csproj" -c Release -o /app/build
|
||||
WORKDIR "/src/BMA.EHR.Leave"
|
||||
RUN dotnet build "BMA.EHR.Leave.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "BMA.EHR.Leave.Service.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
RUN dotnet publish "BMA.EHR.Leave.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "BMA.EHR.Leave.Service.dll"]
|
||||
ENTRYPOINT ["dotnet", "BMA.EHR.Leave.dll"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue