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

View file

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