lock insignia
Some checks failed
release-dev / release-dev (push) Failing after 12s

This commit is contained in:
kittapath 2025-08-01 17:08:11 +07:00
parent f6594f9773
commit 0c9ec3dd43
5 changed files with 99 additions and 70 deletions

View file

@ -68,40 +68,40 @@ jobs:
docker compose pull
docker compose up -d
echo "${{ steps.gen_ver.outputs.image_ver }}"> success
- name: Notify Discord Success
if: success()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "✅ Deployment Success!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
"color": 3066993,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/success-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}
# - name: Notify Discord Success
# if: success()
# run: |
# curl -H "Content-Type: application/json" \
# -X POST \
# -d '{
# "embeds": [{
# "title": "✅ Deployment Success!",
# "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Deployed by: `${{github.actor}}`",
# "color": 3066993,
# "footer": {
# "text": "Release Notification",
# "icon_url": "https://example.com/success-icon.png"
# },
# "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
# }]
# }' \
# ${{ secrets.DISCORD_WEBHOOK }}
- name: Notify Discord Failure
if: failure()
run: |
curl -H "Content-Type: application/json" \
-X POST \
-d '{
"embeds": [{
"title": "❌ Deployment Failed!",
"description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
"color": 15158332,
"footer": {
"text": "Release Notification",
"icon_url": "https://example.com/failure-icon.png"
},
"timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
}]
}' \
${{ secrets.DISCORD_WEBHOOK }}
# - name: Notify Discord Failure
# if: failure()
# run: |
# curl -H "Content-Type: application/json" \
# -X POST \
# -d '{
# "embeds": [{
# "title": "❌ Deployment Failed!",
# "description": "**Details:**\n- Image: `${{env.IMAGE_NAME}}`\n- Version: `${{ steps.gen_ver.outputs.image_ver }}`\n- Attempted by: `${{github.actor}}`",
# "color": 15158332,
# "footer": {
# "text": "Release Notification",
# "icon_url": "https://example.com/failure-icon.png"
# },
# "timestamp": "'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"
# }]
# }' \
# ${{ secrets.DISCORD_WEBHOOK }}

View file

@ -1188,6 +1188,29 @@ namespace BMA.EHR.Application.Repositories
throw;
}
}
public GetOrgProfileByProfileIdDto GetOrgProfileByProfileId(Guid id, string? accessToken)
{
try
{
var apiPath = $"{_configuration["API"]}/org/profile/org-user/{id}";
var apiKey = _configuration["API_KEY"];
var apiResult = GetExternalAPIAsync(apiPath, accessToken ?? "", apiKey);
if (apiResult.Result != null)
{
var raw = JsonConvert.DeserializeObject<GetOrgProfileByProfileIdResultDto>(apiResult.Result);
if (raw != null)
return raw.Result;
}
return null;
}
catch
{
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1,11 @@
namespace BMA.EHR.Application.Responses.Profiles
{
public class GetOrgProfileByProfileIdDto
{
public string? Root { get; set; }
public string? Child1 { get; set; }
public string? Child2 { get; set; }
public string? Child3 { get; set; }
public string? Child4 { get; set; }
}
}

View file

@ -0,0 +1,11 @@
namespace BMA.EHR.Application.Responses.Profiles
{
public class GetOrgProfileByProfileIdResultDto
{
public string Message { get; set; } = string.Empty;
public int Status { get; set; } = -1;
public GetOrgProfileByProfileIdDto? Result { get; set; }
}
}

View file

@ -336,14 +336,8 @@ namespace BMA.EHR.Insignia.Service.Controllers
//}
if (role.Trim().ToLower() == "officer")
{
/* resend.Items = (await _repository.InsigniaHasProfile(result.PeriodId, ocId, status, type))
.Where(x => x.ProfileType!.ToLower() == type.ToLower()).ToList();*/
var items = await _repository.InsigniaHasProfile(result.PeriodId, ocId, status, type);
resend.Items = (items ?? new List<InsigniaRequestItem>())
.Where(x => x != null && !string.IsNullOrEmpty(x.ProfileType) && x.ProfileType.ToLower() == type.ToLower())
.ToList();
resend.Items = (await _repository.InsigniaHasProfile(result.PeriodId, ocId, status, type))
.Where(x => x.ProfileType!.ToLower() == type.ToLower()).ToList();
return Success(resend);
}
else
@ -1318,9 +1312,7 @@ namespace BMA.EHR.Insignia.Service.Controllers
if (profileOld.ProfileId == null)
continue;
var pf = _userProfileRepository.GetOfficerProfileById(profileOld.ProfileId, AccessToken);
if (pf == null)
pf = _userProfileRepository.GetEmployeeProfileById(profileOld.ProfileId, AccessToken);
var pf = _userProfileRepository.GetOrgProfileByProfileId(profileOld.ProfileId, AccessToken);
var orgSend = "";
var orgRecv = "";
@ -1340,27 +1332,19 @@ namespace BMA.EHR.Insignia.Service.Controllers
if (pf != null)
{
var kk = pf.Keycloak == null ? Guid.Empty : pf.Keycloak.Value;
var pfData = await _userProfileRepository.GetProfileByKeycloakIdAsync(kk, AccessToken);
if (pfData != null)
{
if (pfData.Child4 != null || pfData.Child4 != "")
orgRecv += $"{pfData.Child4}";
if (pfData.Child3 != null || pfData.Child3 != "")
orgRecv += $" {pfData.Child3}";
if (pfData.Child2 != null || pfData.Child2 != "")
orgRecv += $" {pfData.Child2}";
if (pfData.Child1 != null || pfData.Child1 != "")
orgRecv += $" {pfData.Child1}";
if (pfData.Root != null || pfData.Root != "")
orgRecv += $" {pfData.Root}";
orgRecv = orgRecv.Trim();
}
if (pf.Child4 != null || pf.Child4 != "")
orgRecv += $"{pf.Child4}";
if (pf.Child3 != null || pf.Child3 != "")
orgRecv += $" {pf.Child3}";
if (pf.Child2 != null || pf.Child2 != "")
orgRecv += $" {pf.Child2}";
if (pf.Child1 != null || pf.Child1 != "")
orgRecv += $" {pf.Child1}";
if (pf.Root != null || pf.Root != "")
orgRecv += $" {pf.Root}";
orgRecv = orgRecv.Trim();
}
await _context.InsigniaNoteProfiles.AddAsync(new InsigniaNoteProfile
{
RequestDate = profileOld.RequestDate,
@ -2484,11 +2468,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
receiveDate = profile.DateReceive!.Value,
dateAnnounce = profile.Date!.Value,
insigniaId = profile.RequestInsignia!.Id,
issue = profile!.Issue ?? "",
issue = "",
note = "",
refCommandDate = null,
refCommandNo = "",
volume = profile!.VolumeNo ?? "",
volume = "",
};
await _userProfileRepository.PostProfileInsigniaAsync(profileInsigniaBody, AccessToken);
@ -2506,11 +2490,11 @@ namespace BMA.EHR.Insignia.Service.Controllers
receiveDate = profile.DateReceive!.Value,
dateAnnounce = profile.Date!.Value,
insigniaId = profile.RequestInsignia!.Id,
issue = profile!.Issue ?? "",
issue = "",
note = "",
refCommandDate = null,
refCommandNo = "",
volume = profile!.VolumeNo ?? "",
volume = "",
};
await _userProfileRepository.PostProfileEmpInsigniaAsync(profileInsigniaBody, AccessToken);