Merge branch 'dev' into develop
# Conflicts: # obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfo.cs # obj/Debug/net7.0/BMA.EHR.Recruit.Service.AssemblyInfoInputs.cache
This commit is contained in:
commit
7cb50f594b
16 changed files with 238 additions and 39 deletions
49
.forgejo/workflows/build.yml
Normal file
49
.forgejo/workflows/build.yml
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
# on:
|
||||||
|
# push:
|
||||||
|
# tags:
|
||||||
|
# - "v[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
# - "v[0-9]+.[0-9]+.[0-9]+*"
|
||||||
|
# workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
|
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }}
|
||||||
|
IMAGE_VERSION: build
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
config-inline: |
|
||||||
|
[registry."${{ env.REGISTRY }}"]
|
||||||
|
ca=["/etc/ssl/certs/ca-certificates.crt"]
|
||||||
|
- name: Tag Version
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" == "push" ]]; then
|
||||||
|
echo "IMAGE_VERSION=${{ github.ref_name }}" | sed 's/v//g' >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=${{ env.IMAGE_VERSION }}-${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
- name: Build and push docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||||
|
push: true
|
||||||
82
.forgejo/workflows/ci-cd.yml
Normal file
82
.forgejo/workflows/ci-cd.yml
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
name: Build & Deploy on Dev
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ${{ vars.CONTAINER_REGISTRY }}
|
||||||
|
REGISTRY_USERNAME: ${{ vars.CONTAINER_REGISTRY_USERNAME }}
|
||||||
|
REGISTRY_PASSWORD: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }}
|
||||||
|
CONTAINER_IMAGE_NAME: ${{ vars.CONTAINER_REGISTRY }}/${{ vars.CONTAINER_IMAGE_OWNER }}/${{ vars.CONTAINER_IMAGE_NAME }}
|
||||||
|
IMAGE_VERSION: latest
|
||||||
|
DISCORD_WEBHOOK: ${{ vars.DISCORD_WEBHOOK }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
with:
|
||||||
|
config-inline: |
|
||||||
|
[registry."${{ env.REGISTRY }}"]
|
||||||
|
ca=["/etc/ssl/certs/ca-certificates.crt"]
|
||||||
|
- name: Tag Version
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.ref_type }}" == "tag" ]; then
|
||||||
|
echo "IMAGE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "IMAGE_VERSION=latest" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
- name: Login in to registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ env.REGISTRY_USERNAME }}
|
||||||
|
password: ${{ env.REGISTRY_PASSWORD }}
|
||||||
|
- name: Build and push docker image
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
platforms: linux/amd64
|
||||||
|
context: .
|
||||||
|
file: Dockerfile
|
||||||
|
tags: ${{ env.CONTAINER_IMAGE_NAME }}:latest,${{ env.CONTAINER_IMAGE_NAME }}:${{ env.IMAGE_VERSION }}
|
||||||
|
push: true
|
||||||
|
- name: Remote Deploy
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
cd ~/repo
|
||||||
|
./replace-env.sh API_RECRUIT "${{ env.IMAGE_VERSION }}"
|
||||||
|
./deploy.sh hrms-api-recruit
|
||||||
|
|
||||||
|
- name: Discord Notification
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
STATUS="${{ job.status == 'success' && '✅ Success' || '❌ Failed' }}"
|
||||||
|
COLOR="${{ job.status == 'success' && '3066993' || '15158332' }}"
|
||||||
|
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{
|
||||||
|
\"embeds\": [{
|
||||||
|
\"title\": \"$STATUS\",
|
||||||
|
\"description\": \"**Build & Deploy**\\n- Image: \`${{ env.CONTAINER_IMAGE_NAME }}\`\\n- Version: \`${{ env.IMAGE_VERSION }}\`\\n- By: \`${{ github.actor }}\`\",
|
||||||
|
\"color\": $COLOR,
|
||||||
|
\"footer\": {
|
||||||
|
\"text\": \"Release Notification\",
|
||||||
|
\"icon_url\": \"https://example.com/success-icon.png\"
|
||||||
|
},
|
||||||
|
\"timestamp\": \"$TIMESTAMP\"
|
||||||
|
}]
|
||||||
|
}" \
|
||||||
|
${{ env.DISCORD_WEBHOOK }}
|
||||||
29
.forgejo/workflows/deploy.yml
Normal file
29
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: "Version to deploy"
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: "latest"
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_VERSION: build
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Remote Deploy
|
||||||
|
uses: appleboy/ssh-action@v1.2.1
|
||||||
|
with:
|
||||||
|
host: ${{ vars.SSH_DEPLOY_HOST }}
|
||||||
|
port: ${{ vars.SSH_DEPLOY_PORT }}
|
||||||
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
|
password: ${{ secrets.SSH_DEPLOY_PASSWORD }}
|
||||||
|
script: |
|
||||||
|
cd ~/repo
|
||||||
|
./replace-env.sh API_RECRUIT "${{ inputs.version }}"
|
||||||
|
./deploy.sh hrms-api-recruit
|
||||||
13
.idea/.idea.BMA.EHR.Recruit.Service/.idea/.gitignore
generated
vendored
Normal file
13
.idea/.idea.BMA.EHR.Recruit.Service/.idea/.gitignore
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Rider ignored files
|
||||||
|
/contentModel.xml
|
||||||
|
/projectSettingsUpdater.xml
|
||||||
|
/modules.xml
|
||||||
|
/.idea.BMA.EHR.Recruit.Service.iml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
1
.idea/.idea.BMA.EHR.Recruit.Service/.idea/.name
generated
Normal file
1
.idea/.idea.BMA.EHR.Recruit.Service/.idea/.name
generated
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
BMA.EHR.Recruit.Service
|
||||||
|
After Width: | Height: | Size: 23 B |
4
.idea/.idea.BMA.EHR.Recruit.Service/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.BMA.EHR.Recruit.Service/.idea/encodings.xml
generated
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||||
|
</project>
|
||||||
8
.idea/.idea.BMA.EHR.Recruit.Service/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.BMA.EHR.Recruit.Service/.idea/indexLayout.xml
generated
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="UserContentModel">
|
||||||
|
<attachedFolders />
|
||||||
|
<explicitIncludes />
|
||||||
|
<explicitExcludes />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/.idea.BMA.EHR.Recruit.Service/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.BMA.EHR.Recruit.Service/.idea/vcs.xml
generated
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
|
|
@ -752,6 +752,8 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
||||||
var cols = workSheet.GetHeaderColumns();
|
var cols = workSheet.GetHeaderColumns();
|
||||||
|
|
||||||
int row = 2;
|
int row = 2;
|
||||||
|
int batchCount = 0;
|
||||||
|
const int batchSize = 500;
|
||||||
|
|
||||||
while (row <= totalRows)
|
while (row <= totalRows)
|
||||||
{
|
{
|
||||||
|
|
@ -860,13 +862,23 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
||||||
|
|
||||||
//imported.Recruits.Add(r);
|
//imported.Recruits.Add(r);
|
||||||
row++;
|
row++;
|
||||||
|
batchCount++;
|
||||||
|
|
||||||
|
// Batch save to prevent OutOfMemoryException on large imports
|
||||||
|
if (batchCount >= batchSize)
|
||||||
|
{
|
||||||
|
_context.SaveChanges();
|
||||||
|
_context.ChangeTracker.Clear();
|
||||||
|
// Re-attach the import entity after clearing the tracker
|
||||||
|
_context.RecruitImports.Attach(imported);
|
||||||
|
batchCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally save to database
|
// Save remaining records in the last batch
|
||||||
|
|
||||||
_context.SaveChanges();
|
_context.SaveChanges();
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
@ -1371,6 +1383,8 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
||||||
var cols = workSheet.GetHeaderColumns();
|
var cols = workSheet.GetHeaderColumns();
|
||||||
|
|
||||||
int row = 8;
|
int row = 8;
|
||||||
|
int batchCount = 0;
|
||||||
|
const int batchSize = 500;
|
||||||
var endRow = workSheet.Dimension.End.Row; // แถวสุดท้ายที่มีข้อมูล
|
var endRow = workSheet.Dimension.End.Row; // แถวสุดท้ายที่มีข้อมูล
|
||||||
while (row <= endRow)
|
while (row <= endRow)
|
||||||
{
|
{
|
||||||
|
|
@ -1461,14 +1475,31 @@ namespace BMA.EHR.Recruit.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
row++;
|
row++;
|
||||||
|
batchCount++;
|
||||||
|
|
||||||
|
// Batch save to prevent OutOfMemoryException on large imports
|
||||||
|
if (batchCount >= batchSize)
|
||||||
|
{
|
||||||
|
rec_import.ScoreImport = imported;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
_context.ChangeTracker.Clear();
|
||||||
|
// Re-attach entities after clearing the tracker
|
||||||
|
_context.Attach(rec_import);
|
||||||
|
_context.Attach(imported);
|
||||||
|
imported.Scores.Clear();
|
||||||
|
batchCount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // end of sheet loop
|
} // end of sheet loop
|
||||||
} // end of all file loop
|
} // end of all file loop
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally save to database
|
// Save remaining records in the last batch
|
||||||
rec_import.ScoreImport = imported;
|
if (imported.Scores.Count > 0)
|
||||||
await _context.SaveChangesAsync();
|
{
|
||||||
|
rec_import.ScoreImport = imported;
|
||||||
|
await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
return Success();
|
return Success();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
"auditLevel": "low",
|
"auditLevel": "low",
|
||||||
"auditMode": "direct"
|
"auditMode": "direct"
|
||||||
},
|
},
|
||||||
"SdkAnalysisLevel": "9.0.300"
|
"SdkAnalysisLevel": "10.0.200"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net7.0": {
|
"net7.0": {
|
||||||
|
|
@ -203,7 +203,7 @@
|
||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/9.0.305/RuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.203/RuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/suphonchaip/.nuget/packages/</NuGetPackageRoot>
|
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/suphonchaip/.nuget/packages/</NuGetPackageRoot>
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/suphonchaip/.nuget/packages/</NuGetPackageFolders>
|
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/suphonchaip/.nuget/packages/</NuGetPackageFolders>
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
|
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||||
<SourceRoot Include="/Users/suphonchaip/.nuget/packages/" />
|
<SourceRoot Include="/Users/suphonchaip/.nuget/packages/" />
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// <autogenerated />
|
// <autogenerated />
|
||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
|
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
|
||||||
|
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// This code was generated by a tool.
|
|
||||||
//
|
|
||||||
// Changes to this file may cause incorrect behavior and will be lost if
|
|
||||||
// the code is regenerated.
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
[assembly: Microsoft.Extensions.Configuration.UserSecrets.UserSecretsIdAttribute("d45c95ce-6b9d-4aa7-aaaf-62fe8b792934")]
|
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("BMA.EHR.Recruit.Service")]
|
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e1d869c9329ffd1d9e4fdb73f077eee60b67e09c")]
|
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("BMA.EHR.Recruit.Service")]
|
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("BMA.EHR.Recruit.Service")]
|
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
115668deb371dd5b1a7e9691f5117e5e4acdd7bef73f049871879b64ab58463e
|
|
||||||
|
|
@ -13782,7 +13782,7 @@
|
||||||
"auditLevel": "low",
|
"auditLevel": "low",
|
||||||
"auditMode": "direct"
|
"auditMode": "direct"
|
||||||
},
|
},
|
||||||
"SdkAnalysisLevel": "9.0.300"
|
"SdkAnalysisLevel": "10.0.200"
|
||||||
},
|
},
|
||||||
"frameworks": {
|
"frameworks": {
|
||||||
"net7.0": {
|
"net7.0": {
|
||||||
|
|
@ -13946,7 +13946,7 @@
|
||||||
"privateAssets": "all"
|
"privateAssets": "all"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/9.0.305/RuntimeIdentifierGraph.json"
|
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.203/RuntimeIdentifierGraph.json"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"version": 2,
|
"version": 2,
|
||||||
"dgSpecHash": "z4TN+iW9Ey8=",
|
"dgSpecHash": "6/jNsBvJ3SY=",
|
||||||
"success": true,
|
"success": true,
|
||||||
"projectFilePath": "/Users/suphonchaip/Develop/hrms/hrms-api-recruit/BMA.EHR.Recruit.Service.csproj",
|
"projectFilePath": "/Users/suphonchaip/Develop/hrms/hrms-api-recruit/BMA.EHR.Recruit.Service.csproj",
|
||||||
"expectedPackageFiles": [
|
"expectedPackageFiles": [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue