From b1b8d96e57c5e944955fcdf2e7e52b1b462b5109 Mon Sep 17 00:00:00 2001 From: kittapath Date: Sat, 21 Dec 2024 01:11:42 +0700 Subject: [PATCH] api holiday --- .github/workflows/release_metadata.yaml | 107 +++ .../Controllers/HolidayController.cs | 310 ++++++++ .../Controllers/PrefixController.cs | 27 - BMA.EHR.MetaData.Service/Program.cs | 2 + .../Request/HolidayCopyRequest.cs | 9 + .../Request/HolidayRequest.cs | 14 + .../Request/HolidayUpdateRequest.cs | 13 + .../Response/DashboardResponseItem.cs | 11 + .../Response/GetOrganizationTypeResponse.cs | 10 + .../Response/ResponseObject.cs | 13 + .../SummaryHolidayByMonthResponseItem.cs | 14 + .../Services/HolidayService.cs | 678 ++++++++++++++++++ BMA.EHR.MetaData.Service/appsettings.json | 72 +- .../wwwroot/keycloak.json | 2 +- 14 files changed, 1217 insertions(+), 65 deletions(-) create mode 100644 .github/workflows/release_metadata.yaml create mode 100644 BMA.EHR.MetaData.Service/Controllers/HolidayController.cs delete mode 100644 BMA.EHR.MetaData.Service/Controllers/PrefixController.cs create mode 100644 BMA.EHR.MetaData.Service/Request/HolidayCopyRequest.cs create mode 100644 BMA.EHR.MetaData.Service/Request/HolidayRequest.cs create mode 100644 BMA.EHR.MetaData.Service/Request/HolidayUpdateRequest.cs create mode 100644 BMA.EHR.MetaData.Service/Response/DashboardResponseItem.cs create mode 100644 BMA.EHR.MetaData.Service/Response/GetOrganizationTypeResponse.cs create mode 100644 BMA.EHR.MetaData.Service/Response/ResponseObject.cs create mode 100644 BMA.EHR.MetaData.Service/Response/SummaryHolidayByMonthResponseItem.cs create mode 100644 BMA.EHR.MetaData.Service/Services/HolidayService.cs diff --git a/.github/workflows/release_metadata.yaml b/.github/workflows/release_metadata.yaml new file mode 100644 index 00000000..a1deeb47 --- /dev/null +++ b/.github/workflows/release_metadata.yaml @@ -0,0 +1,107 @@ +name: release-dev +run-name: release-dev ${{ github.actor }} +on: + push: + tags: + - "metadata-[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: +env: + REGISTRY: docker.frappet.com + IMAGE_NAME: ehr/bma-ehr-metadata-service + DEPLOY_HOST: frappet.com + DEPLOY_PORT: 10102 + # COMPOSE_PATH: /home/frappet/docker/bma-ehr + COMPOSE_PATH: /home/frappet/docker/bma/bma-ehr-metadata + TOKEN_LINE: uxuK5hDzS2DsoC5piJBrWRLiz8GgY7iMZZldOWsDDF0 + +jobs: + # act workflow_dispatch -W .github/workflows/release_metadata.yaml --input IMAGE_VER=latest -s DOCKER_USER=admin -s DOCKER_PASS=FPTadmin2357 -s SSH_PASSWORD=FPTadmin2357 + release-dev: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set output tags + id: vars + run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + - name: Gen Version + id: gen_ver + run: | + if [[ $GITHUB_REF == 'refs/tags/'* ]]; then + IMAGE_VER=${{ steps.vars.outputs.tag }} + 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: Check 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.MetaData.Service/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 + - 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 }} diff --git a/BMA.EHR.MetaData.Service/Controllers/HolidayController.cs b/BMA.EHR.MetaData.Service/Controllers/HolidayController.cs new file mode 100644 index 00000000..7a3fc813 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Controllers/HolidayController.cs @@ -0,0 +1,310 @@ +using BMA.EHR.Domain.Common; +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.MetaData.Service.Request; +using BMA.EHR.MetaData.Service.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; + +namespace BMA.EHR.MetaData.Service.Controllers +{ + [Route("api/v{version:apiVersion}/metadata/holiday")] + [ApiVersion("1.0")] + [ApiController] + [Produces("application/json")] + [Authorize] + [SwaggerTag("จัดการข้อมูลปฏิทินวันหยุด")] + public class HolidayController : BaseController + { + #region " Fields " + + private readonly HolidayService _holidayService; + + #endregion + + #region " Constructor and Destructor " + + public HolidayController(HolidayService holidayService) + { + _holidayService = holidayService; + } + + #endregion + + #region " Methods " + + /// + /// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น ตามปี + /// + /// ปี่ที่ต้องการ + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("{year:int}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetsAsync(int year) + { + try + { + var items1 = await _holidayService.GetNormalAsync(year); + var items2 = await _holidayService.Get6DayAsync(year); + + return Success(new { Normal = items1, SixDays = items2 }); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// อ่านข้อมูลจาก Relational Db โดยแสดงเฉพาะข้อมูลที่ Active เท่านั้น ตามเดือน + /// + /// ปี่ที่ต้องการ + /// เดือนที่ต้องการ + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("{year:int}/{month:int}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetsAsyncByMonth(int year, int month) + { + try + { + var items1 = await _holidayService.GetNormalByMonthAsync(year, month); + var items2 = await _holidayService.Get6DayByMonthAsync(year, month); + + return Success(new { Normal = items1, SixDays = items2 }); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// สร้างรายการวันหยุดใหม่แบบรายการเดียว + /// + /// + /// ทำรายการสำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> CreateAsync(Holiday inserted) + { + try + { + // create normal + await _holidayService.CreateAsync(inserted); + + // create 6days + await _holidayService.Create6DayAsync(inserted); + + //save database + await _holidayService.SaveDatabase(); + + return Success(inserted); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// สร้างรายการวันหยุดใหม่แบบหลายรายการ + /// + /// ช่วงวันที่ที่ต้องการเพิ่ม + /// ประเภทวันหยุด ส่งค่ามาเป็น normal / 6day + /// + /// ทำรายการสำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("range/add/{category}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> CreateRangeAsync(List inserted, string category) + { + try + { + await _holidayService.CreateRangeAsync(inserted, category); + + return Success(inserted); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// แก้ไขรายการวันหยุด + /// + /// รหัส + /// ข้อมูลที่ต้องการแก้ไข + /// + /// ทำรายการสำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPut("{category}/{id:length(36)}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> UpdateAsync(string id, Holiday updated) + { + try + { + await _holidayService.UpdateAsync(Guid.Parse(id), updated); + + return Success(updated); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// แก้ไขรายการวันหยุด + /// + /// Group ข่อมูลที่แก้ไข + /// ประเภทวันหยุด ส่งค่ามาเป็น normal / 6day + /// + /// ทำรายการสำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("range/edit/{category}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> UpdateRangeAsync(HolidayUpdateRequest data, string category) + { + try + { + var isNormal = category.ToUpper() == "NORMAL"; + await _holidayService.UpdateRangeAsync(data.history, data.updated, isNormal); + + return Success(data.updated); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// ลบรายการวันหยุด + /// + /// รหัส + /// + /// ทำรายการสำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpDelete("{id:length(36)}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> DeleteAsync(string id) + { + try + { + await _holidayService.DeleteAsync(Guid.Parse(id)); + + return Success(); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// ลบรายการวันหยุด + /// + /// ช่วงวันที่ที่ต้องการลบ + /// ประเภทวันหยุด ส่งค่ามาเป็น normal / 6day + /// + /// ทำรายการสำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpPost("range/delete/{category}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> DeleteRangeAsync(List delete, string category) + { + try + { + var isNormal = category.ToUpper() == "NORMAL"; + await _holidayService.DeleteRangeAsync(delete, isNormal); + + return Success(); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// คัดลอกข้อมูลวันหยุด โดยระบุปีที่ต้องการคัดลอก และ ปีที่ต้องการบันทึก + /// + /// Request Body + /// + [HttpPost("copy")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> CopyAsync([FromBody] HolidayCopyRequest request) + { + try + { + await _holidayService.CopyAsync(request.FromYear, request.ToYear); + + return Success(); + } + catch (Exception ex) + { + return Error(ex); + } + } + + /// + /// สรุปวันหยุดในแต่ละปี + /// + /// ปี่ที่ต้องการ + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("summary/{year:int}")] + [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status401Unauthorized)] + [ProducesResponseType(StatusCodes.Status500InternalServerError)] + public async Task> GetDataGroupMonthAsync(int year) + { + try + { + var items = await _holidayService.GetDataGroupMonthAsync(year); + + return Success(items); + } + catch (Exception ex) + { + return Error(ex); + } + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs b/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs deleted file mode 100644 index 82e3663e..00000000 --- a/BMA.EHR.MetaData.Service/Controllers/PrefixController.cs +++ /dev/null @@ -1,27 +0,0 @@ -using BMA.EHR.Application.Repositories; -using BMA.EHR.Domain.Common; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; - -namespace BMA.EHR.MetaData.Service.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class PrefixController : BaseController - { - private readonly PrefixRepository _repository; - - public PrefixController(PrefixRepository repository) - { - _repository = repository; - } - - [HttpGet] - public async Task> Get() - { - var data = await _repository.GetAllAsync(); - - return Success(data); - } - } -} diff --git a/BMA.EHR.MetaData.Service/Program.cs b/BMA.EHR.MetaData.Service/Program.cs index 682558f1..409512a1 100644 --- a/BMA.EHR.MetaData.Service/Program.cs +++ b/BMA.EHR.MetaData.Service/Program.cs @@ -3,6 +3,7 @@ using BMA.EHR.Domain.Middlewares; using BMA.EHR.Infrastructure; using BMA.EHR.Infrastructure.Persistence; using BMA.EHR.MetaData.Service; +using BMA.EHR.MetaData.Service.Services; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ApiExplorer; @@ -80,6 +81,7 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddApplication(); builder.Services.AddPersistence(builder.Configuration); + builder.Services.AddTransient(); builder.Services.AddControllers(options => { options.SuppressAsyncSuffixInActionNames = false; diff --git a/BMA.EHR.MetaData.Service/Request/HolidayCopyRequest.cs b/BMA.EHR.MetaData.Service/Request/HolidayCopyRequest.cs new file mode 100644 index 00000000..79f6b098 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Request/HolidayCopyRequest.cs @@ -0,0 +1,9 @@ +namespace BMA.EHR.MetaData.Service.Request +{ + public class HolidayCopyRequest + { + public int FromYear { get; set; } = DateTime.Now.Year; + + public int ToYear { get; set; } = DateTime.Now.Year; + } +} diff --git a/BMA.EHR.MetaData.Service/Request/HolidayRequest.cs b/BMA.EHR.MetaData.Service/Request/HolidayRequest.cs new file mode 100644 index 00000000..f534ed4e --- /dev/null +++ b/BMA.EHR.MetaData.Service/Request/HolidayRequest.cs @@ -0,0 +1,14 @@ +namespace BMA.EHR.MetaData.Service.Request +{ + public class HolidayRequest + { + public DateTime dateStart { get; set; } = DateTime.Now; + + public DateTime dateEnd { get; set; } = DateTime.Now; + + public int Year { get; set; } = DateTime.Now.Year; + + public string Name { get; set; } = string.Empty; + + } +} diff --git a/BMA.EHR.MetaData.Service/Request/HolidayUpdateRequest.cs b/BMA.EHR.MetaData.Service/Request/HolidayUpdateRequest.cs new file mode 100644 index 00000000..cc135fac --- /dev/null +++ b/BMA.EHR.MetaData.Service/Request/HolidayUpdateRequest.cs @@ -0,0 +1,13 @@ + +using BMA.EHR.Domain.Models.MetaData; + +namespace BMA.EHR.MetaData.Service.Request +{ + public class HolidayUpdateRequest + { + public List history { get; set; } + + public List updated { get; set; } + + } +} diff --git a/BMA.EHR.MetaData.Service/Response/DashboardResponseItem.cs b/BMA.EHR.MetaData.Service/Response/DashboardResponseItem.cs new file mode 100644 index 00000000..22f69984 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Response/DashboardResponseItem.cs @@ -0,0 +1,11 @@ +namespace BMA.EHR.MetaData.Service.Response +{ + public class DashboardResponseItem + { + public int? Id { get; set; } + + public string? Name { get; set; } + + public int? Count { get; set; } + } +} diff --git a/BMA.EHR.MetaData.Service/Response/GetOrganizationTypeResponse.cs b/BMA.EHR.MetaData.Service/Response/GetOrganizationTypeResponse.cs new file mode 100644 index 00000000..b8937cc2 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Response/GetOrganizationTypeResponse.cs @@ -0,0 +1,10 @@ +namespace BMA.EHR.MetaData.Service.Response +{ + public class GetOrganizationTypeResponse + { + + public Guid Id { get; set; } + + public string Name { get; set; } = string.Empty; + } +} diff --git a/BMA.EHR.MetaData.Service/Response/ResponseObject.cs b/BMA.EHR.MetaData.Service/Response/ResponseObject.cs new file mode 100644 index 00000000..c1347625 --- /dev/null +++ b/BMA.EHR.MetaData.Service/Response/ResponseObject.cs @@ -0,0 +1,13 @@ +using System.Net; + +namespace BMA.EHR.MetaData.Service.Response +{ + public class ResponseObject + { + public int Status { get; set; } + + public string? Message { get; set; } + + public object? Result { get; set; } + } +} diff --git a/BMA.EHR.MetaData.Service/Response/SummaryHolidayByMonthResponseItem.cs b/BMA.EHR.MetaData.Service/Response/SummaryHolidayByMonthResponseItem.cs new file mode 100644 index 00000000..dbe7468d --- /dev/null +++ b/BMA.EHR.MetaData.Service/Response/SummaryHolidayByMonthResponseItem.cs @@ -0,0 +1,14 @@ +namespace BMA.EHR.MetaData.Service.Response +{ + public class SummaryHolidayByMonthResponseItem + { + public int? Id { get; set; } + + public int? Count { get; set; } + + public string? Month { get; set; } + + public string? MonthFull { get; set; } + + } +} diff --git a/BMA.EHR.MetaData.Service/Services/HolidayService.cs b/BMA.EHR.MetaData.Service/Services/HolidayService.cs new file mode 100644 index 00000000..fd17294d --- /dev/null +++ b/BMA.EHR.MetaData.Service/Services/HolidayService.cs @@ -0,0 +1,678 @@ +using System.Security.Claims; +using BMA.EHR.Domain.Models.MetaData; +using BMA.EHR.Domain.Shared; +using BMA.EHR.Infrastructure.Persistence; +using BMA.EHR.MetaData.Service.Response; +using Microsoft.EntityFrameworkCore; +using BMA.EHR.Domain.Extensions; + +namespace BMA.EHR.MetaData.Service.Services +{ + public class HolidayService + { + #region " Fields " + + private readonly ApplicationDBContext _context; + private readonly IHttpContextAccessor _httpContextAccessor; + + #endregion + + #region " Constructor and Destructor " + + public HolidayService(ApplicationDBContext context, + IHttpContextAccessor httpContextAccessor) + { + _context = context; + _httpContextAccessor = httpContextAccessor; + } + + #endregion + + #region " Properties " + + private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value; + + #endregion + + #region " Methods " + + #region " Private " + + private async Task IsHoliday(DateTime date) + { + var holidays = (await GetsAsync(date.Date.Year)) + .Where(d => d.Category.ToUpper() == "NORMAL") + .Select(d => d.HolidayDate.Date).ToList(); + + if (holidays.Any()) + { + return holidays.Contains(date); + } + else + return false; + } + + private async Task IsHoliday6Days(DateTime date) + { + var holidays = (await GetsAsync(date.Date.Year)) + .Where(d => d.Category.ToUpper() != "NORMAL") + .Select(d => d.HolidayDate.Date).ToList(); + + if (holidays.Any()) + { + return holidays.Contains(date); + } + else + return false; + } + + private async Task IsWeekend(DateTime date) + { + var res = date.DayOfWeek == DayOfWeek.Saturday + || date.DayOfWeek == DayOfWeek.Sunday; + + return await Task.FromResult(res); + } + + private async Task IsWeekend6Days(DateTime date) + { + var res = date.DayOfWeek == DayOfWeek.Sunday; + + return await Task.FromResult(res); + } + + private async Task GetNextWorkingDay(DateTime date) + { + while ((await IsHoliday(date)) || (await IsWeekend(date))) + { + date = date.AddDays(1); + } + + return date; + } + + private async Task GetNextWorkingDay6Days(DateTime date) + { + while ((await IsHoliday6Days(date)) || (await IsWeekend6Days(date))) + { + date = date.AddDays(1); + } + + return date; + } + + private async Task CheckWorkingDay(DateTime date) + { + + while ((await IsHoliday(date)) || (await IsWeekend(date))) + { + return true; + } + + return false; + } + + private async Task CheckWorkingDay6Days(DateTime date) + { + + while ((await IsHoliday6Days(date)) || (await IsWeekend6Days(date))) + { + return true; + } + + return false; + } + + #endregion + + + public async Task> GetsAsync(int year, bool showSpecial = true) + { + var holidays = _context.Holidays.AsQueryable() + .Where(x => x.Year == year.ToCeYear()); + + if (!showSpecial) + { + holidays = holidays.Where(x => !x.IsSpecial); + } + + return await holidays.OrderBy(d => d.HolidayDate.Date).ToListAsync(); + } + + public async Task> GetNormalAsync(int year, bool showSpecial = true) + { + var holidays = _context.Holidays.AsQueryable() + .Where(x => x.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()); + + if (!showSpecial) + { + holidays = holidays.Where(x => !x.IsSpecial); + } + + return await holidays.OrderBy(d => d.HolidayDate.Date).ToListAsync(); + } + + public async Task> Get6DayAsync(int year, bool showSpecial = true) + { + var holidays = _context.Holidays.AsQueryable() + .Where(x => x.Category.ToUpper() != "NORMAL") + .Where(x => x.Year == year.ToCeYear()); + + if (!showSpecial) + { + holidays = holidays.Where(x => !x.IsSpecial); + } + + return await holidays.OrderBy(d => d.HolidayDate.Date).ToListAsync(); + } + + public async Task> GetsAsyncByMonth(int year, int month) + { + return await _context.Holidays.AsQueryable() + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == month) + .OrderBy(d => d.HolidayDate.Date) + .ToListAsync(); + } + + public async Task> GetNormalByMonthAsync(int year, int month) + { + return await _context.Holidays.AsQueryable() + .Where(x => x.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == month) + .OrderBy(d => d.HolidayDate.Date) + .ToListAsync(); + } + + public async Task> Get6DayByMonthAsync(int year, int month) + { + return await _context.Holidays.AsQueryable() + .Where(x => x.Category.ToUpper() != "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == month) + .OrderBy(d => d.HolidayDate.Date) + .ToListAsync(); + } + + public async Task GetByIdAsync(Guid id) + { + return await _context.Holidays.FirstOrDefaultAsync(x => x.Id == id); + } + + public async Task DeleteAsync(Guid id) + { + var existData = await _context.Holidays.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + _context.Holidays.Remove(existData); + await _context.SaveChangesAsync(); + } + } + + public async Task DeleteRangeAsync(List holidays, bool isNormal = true) + { + foreach (var holiday in holidays) + { + if (isNormal) + { + var existData = await _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .FirstOrDefaultAsync(x => DateTime.Compare(x.HolidayDate.Date, holiday.HolidayDate.Date) == 0); + if (existData != null) + { + _context.Holidays.Remove(existData); + await _context.SaveChangesAsync(); + } + } + else + { + var existData = await _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() != "NORMAL") + .FirstOrDefaultAsync(x => DateTime.Compare(x.HolidayDate.Date, holiday.HolidayDate.Date) == 0); + if (existData != null) + { + _context.Holidays.Remove(existData); + await _context.SaveChangesAsync(); + } + } + } + } + + public async Task UpdateAsync(Guid id, Holiday updated) + { + var existData = await _context.Holidays.FirstOrDefaultAsync(x => x.Id == id); + if (existData != null) + { + // if (!existData.Compare(updated)) + if (existData.Name != updated.Name) + { + existData.Name = updated.Name; + // existData.Year = updated.Year.ToCeYear(); + existData.HolidayDate = updated.HolidayDate.Date; + // existData.HolidayDate = await GetNextWorkingDay(updated.HolidayDate.Date); + existData.OriginalDate = updated.OriginalDate; + existData.LastUpdatedAt = DateTime.Now; + existData.LastUpdateUserId = UserId ?? ""; + existData.LastUpdateFullName = FullName ?? ""; + + await _context.SaveChangesAsync(); + } + } + } + + public async Task UpdateRangeAsync(List historys, List holidays, bool isNormal = true) + { + if (isNormal) + { + // foreach (var holiday in holidays) + // { + // var dupData = await _context.Holidays.AsQueryable() + // .Where(h => h.Category.ToUpper() == "NORMAL") + // .FirstOrDefaultAsync(h => h.Year == holiday.Year && h.Name == holiday.Name && DateTime.Compare(h.HolidayDate.Date, holiday.HolidayDate.Date) != 0); + // if (dupData != null) + // throw new Exception(GlobalMessages.NameDupicate); + // } + + foreach (var history in historys) + { + var existData = await _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .FirstOrDefaultAsync(x => DateTime.Compare(x.HolidayDate.Date, history.HolidayDate.Date) == 0); + if (existData != null) + { + _context.Holidays.Remove(existData); + await _context.SaveChangesAsync(); + } + } + + foreach (var holiday in holidays) + { + // if (!(await IsHoliday(holiday.HolidayDate.Date)) && !(await IsWeekend(holiday.HolidayDate.Date))) + // { + await CreateAsync(holiday); + // } + } + // apply to database + await _context.SaveChangesAsync(); + } + else + { + // foreach (var holiday in holidays) + // { + // var dupData = await _context.Holidays.AsQueryable() + // .Where(h => h.Category.ToUpper() != "NORMAL") + // .FirstOrDefaultAsync(h => h.Year == holiday.Year && h.Name == holiday.Name && DateTime.Compare(h.HolidayDate.Date, holiday.HolidayDate.Date) != 0); + // if (dupData != null) + // throw new Exception(GlobalMessages.NameDupicate); + // } + + foreach (var history in historys) + { + var existData = await _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() != "NORMAL") + .FirstOrDefaultAsync(x => DateTime.Compare(x.HolidayDate.Date, history.HolidayDate.Date) == 0); + if (existData != null) + { + _context.Holidays.Remove(existData); + await _context.SaveChangesAsync(); + } + } + + foreach (var holiday in holidays) + { + // if (!(await IsHoliday6Days(holiday.HolidayDate.Date)) && !(await IsWeekend6Days(holiday.HolidayDate.Date))) + // { + await Create6DayAsync(holiday); + // } + } + // apply to database + await _context.SaveChangesAsync(); + } + + } + + public async Task CreateAsync(Holiday inserted) + { + var existData = await _context.Holidays.AsQueryable() + .Where(d => d.Category.ToUpper() == "NORMAL") + .FirstOrDefaultAsync(h => h.Year == inserted.Year && DateTime.Compare(h.HolidayDate.Date, inserted.HolidayDate.Date) == 0); + + if (existData != null) + throw new Exception(GlobalMessages.DataExist5); + + // var dupData = await _context.Holidays.AsQueryable() + // .Where(d => d.Category.ToUpper() == "NORMAL") + // .FirstOrDefaultAsync(h => h.Year == inserted.Year && h.Name == inserted.Name); + + // if (dupData != null) + // throw new Exception(GlobalMessages.NameDupicate); + + inserted.Id = Guid.NewGuid(); + inserted.Year = inserted.Year.ToCeYear(); + inserted.HolidayDate = inserted.HolidayDate.Date; + // inserted.HolidayDate = await GetNextWorkingDay(inserted.HolidayDate.Date); + inserted.OriginalDate = inserted.HolidayDate.Date; + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + inserted.Category = "NORMAL"; + + await _context.Holidays.AddAsync(inserted); + + // apply to database + // await _context.SaveChangesAsync(); + } + + public async Task Create6DayAsync(Holiday inserted) + { + var existData = await _context.Holidays.AsQueryable() + .Where(d => d.Category.ToUpper() != "NORMAL") + .FirstOrDefaultAsync(h => h.Year == inserted.Year && DateTime.Compare(h.HolidayDate.Date, inserted.HolidayDate.Date) == 0); + + if (existData != null) + throw new Exception(GlobalMessages.DataExist6); + + // var dupData = await _context.Holidays.AsQueryable() + // .Where(d => d.Category.ToUpper() != "NORMAL") + // .FirstOrDefaultAsync(h => h.Year == inserted.Year && h.Name == inserted.Name); + + // if (dupData != null) + // throw new Exception(GlobalMessages.NameDupicate); + + inserted.Id = Guid.NewGuid(); + inserted.Year = inserted.Year.ToCeYear(); + inserted.HolidayDate = inserted.HolidayDate.Date; + // inserted.HolidayDate = await GetNextWorkingDay6Days(inserted.HolidayDate.Date); + inserted.OriginalDate = inserted.HolidayDate.Date; + inserted.CreatedUserId = UserId ?? ""; + inserted.CreatedFullName = FullName ?? "System Administrator"; + inserted.CreatedAt = DateTime.Now; + inserted.LastUpdatedAt = DateTime.Now; + inserted.LastUpdateFullName = FullName ?? "System Administrator"; + inserted.LastUpdateUserId = UserId ?? ""; + inserted.Category = "6DAYS"; + + await _context.Holidays.AddAsync(inserted); + + // apply to database + // await _context.SaveChangesAsync(); + } + + public async Task CreateRangeAsync(List holidays, string category) + { + foreach (var holiday in holidays) + { + if (category.ToUpper() == "NORMAL" || category.ToUpper() == "ALL") + { + var existData1 = await _context.Holidays.AsQueryable() + .Where(d => d.Category.ToUpper() == "NORMAL") + .FirstOrDefaultAsync(h => h.Year == holiday.Year && DateTime.Compare(h.HolidayDate.Date, holiday.HolidayDate.Date) == 0); + + if (existData1 != null) + throw new Exception(GlobalMessages.DataExist5); + + // var dupData1 = await _context.Holidays.AsQueryable() + // .Where(d => d.Category.ToUpper() != "NORMAL") + // .FirstOrDefaultAsync(h => h.Year == holiday.Year && h.Name == holiday.Name); + + // if (dupData1 != null) + // throw new Exception(GlobalMessages.NameDupicate); + + // create for normal + var inserted = new Holiday + { + Id = Guid.NewGuid(), + Year = holiday.Year.ToCeYear(), + Name = holiday.Name, + HolidayDate = holiday.HolidayDate.Date, + OriginalDate = holiday.HolidayDate.Date, + CreatedUserId = UserId ?? "", + CreatedFullName = FullName ?? "System Administrator", + CreatedAt = DateTime.Now, + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + Category = "NORMAL", + }; + + await _context.Holidays.AddAsync(inserted); + } + + if (category.ToUpper() == "6DAYS" || category.ToUpper() == "ALL") + { + var existData2 = await _context.Holidays.AsQueryable() + .Where(d => d.Category.ToUpper() != "NORMAL") + .FirstOrDefaultAsync(h => h.Year == holiday.Year && DateTime.Compare(h.HolidayDate.Date, holiday.HolidayDate.Date) == 0); + + if (existData2 != null) + throw new Exception(GlobalMessages.DataExist6); + + // var dupData2 = await _context.Holidays.AsQueryable() + // .Where(d => d.Category.ToUpper() != "6DAYS") + // .FirstOrDefaultAsync(h => h.Year == holiday.Year && h.Name == holiday.Name); + + // if (dupData2 != null) + // throw new Exception(GlobalMessages.NameDupicate); + + // create for 6days + var inserted2 = new Holiday + { + Id = Guid.NewGuid(), + Year = holiday.Year.ToCeYear(), + Name = holiday.Name, + HolidayDate = holiday.HolidayDate.Date, + OriginalDate = holiday.HolidayDate.Date, + CreatedUserId = UserId ?? "", + CreatedFullName = FullName ?? "System Administrator", + CreatedAt = DateTime.Now, + LastUpdatedAt = DateTime.Now, + LastUpdateFullName = FullName ?? "System Administrator", + LastUpdateUserId = UserId ?? "", + Category = "6DAYS", + }; + await _context.Holidays.AddAsync(inserted2); + } + } + // apply to database + await _context.SaveChangesAsync(); + } + + public async Task CopyAsync(int fromYear, int toYear) + { + if (toYear <= fromYear) + throw new Exception(GlobalMessages.HolidayOfYearNotCopy); + + var source = await GetsAsync(fromYear.ToCeYear()); + if (source == null) + throw new Exception(GlobalMessages.HolidayOfYearNotFound); + + // JACK EDIT : เพิ่ม Logic การตรวจเช็คว่าปีที่จะ Copy ไปมีในฐานข้อมูลแล้วหรือไม่? + var dest = await GetsAsync(toYear.ToCeYear()); + if (dest.Count() > 0) + throw new Exception(GlobalMessages.DestinationHolidayIsExist); + source = source.Where(x => x.Category == "NORMAL"); + foreach (var holiday in source) + { + // create for normal + var inserted = new Holiday + { + Id = Guid.NewGuid(), + Year = toYear.ToCeYear(), + Name = holiday.Name, + HolidayDate = await GetNextWorkingDay(holiday.OriginalDate.AddYears(toYear - fromYear)), + OriginalDate = holiday.OriginalDate.AddYears(toYear - fromYear), + CreatedUserId = UserId ?? "", + CreatedFullName = FullName ?? "", + CreatedAt = DateTime.Now, + Category = "NORMAL" + }; + + await _context.Holidays.AddAsync(inserted); + + + // create for 6days + var inserted2 = new Holiday + { + Id = Guid.NewGuid(), + Year = toYear.ToCeYear(), + Name = holiday.Name, + HolidayDate = await GetNextWorkingDay6Days(holiday.OriginalDate.AddYears(toYear - fromYear)), + OriginalDate = holiday.OriginalDate.AddYears(toYear - fromYear), + CreatedUserId = UserId ?? "", + CreatedFullName = FullName ?? "", + CreatedAt = DateTime.Now, + Category = "6DAYS" + }; + await _context.Holidays.AddAsync(inserted2); + + // apply to database + await _context.SaveChangesAsync(); + } + } + + public async Task SaveDatabase() + { + // apply to database + await _context.SaveChangesAsync(); + } + + public async Task> GetDataGroupMonthAsync(int year) + { + var res = new List + {new SummaryHolidayByMonthResponseItem + { + Id = 1, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 1) + .OrderBy(d => d.Name).Count(), + Month = "ม.ค.", + MonthFull = "มกราคม", + },new SummaryHolidayByMonthResponseItem + { + Id = 2, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 2) + .OrderBy(d => d.Name).Count(), + Month = "ก.พ.", + MonthFull = "กุมภาพันธ์", + },new SummaryHolidayByMonthResponseItem + { + Id = 3, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 3) + .OrderBy(d => d.Name).Count(), + Month = "มี.ค.", + MonthFull = "มีนาคม", + },new SummaryHolidayByMonthResponseItem + { + Id = 4, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 4) + .OrderBy(d => d.Name).Count(), + Month = "เม.ย.", + MonthFull = "เมษายน", + },new SummaryHolidayByMonthResponseItem + { + Id = 5, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 5) + .OrderBy(d => d.Name).Count(), + Month = "พ.ค.", + MonthFull = "พฤษภาคม", + },new SummaryHolidayByMonthResponseItem + { + Id = 6, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 6) + .OrderBy(d => d.Name).Count(), + Month = "มิ.ย.", + MonthFull = "มิถุนายน", + },new SummaryHolidayByMonthResponseItem + { + Id = 7, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 7) + .OrderBy(d => d.Name).Count(), + Month = "ก.ค.", + MonthFull = "กรกฎาคม", + },new SummaryHolidayByMonthResponseItem + { + Id = 8, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 8) + .OrderBy(d => d.Name).Count(), + Month = "ส.ค.", + MonthFull = "สิงหาคม", + },new SummaryHolidayByMonthResponseItem + { + Id = 9, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 9) + .OrderBy(d => d.Name).Count(), + Month = "ก.ย.", + MonthFull = "กันยายน", + },new SummaryHolidayByMonthResponseItem + { + Id = 10, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 10) + .OrderBy(d => d.Name).Count(), + Month = "ต.ค.", + MonthFull = "ตุลาคม", + },new SummaryHolidayByMonthResponseItem + { + Id = 11, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 11) + .OrderBy(d => d.Name).Count(), + Month = "พ.ย.", + MonthFull = "พฤศจิกายน", + },new SummaryHolidayByMonthResponseItem + { + Id = 12, + Count = _context.Holidays.AsQueryable() + .Where(h => h.Category.ToUpper() == "NORMAL") + .Where(x => x.Year == year.ToCeYear()) + .Where(x => x.HolidayDate.Month == 12) + .OrderBy(d => d.Name).Count(), + Month = "ธ.ค.", + MonthFull = "ธันวาคม", + } + }; + + + return await Task.FromResult(res); + } + + #endregion + } +} diff --git a/BMA.EHR.MetaData.Service/appsettings.json b/BMA.EHR.MetaData.Service/appsettings.json index 08bad634..cb1c58f4 100644 --- a/BMA.EHR.MetaData.Service/appsettings.json +++ b/BMA.EHR.MetaData.Service/appsettings.json @@ -1,38 +1,36 @@ { - "Serilog": { - "MinimumLevel": { - "Default": "Information", - "Override": { - "Microsoft": "Information", - "System": "Warning" - } - } - }, - "ElasticConfiguration": { - "Uri": "http://localhost:9200" - }, - "AllowedHosts": "*", - "ConnectionStrings": { - //"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB", - // "DefaultConnection": "server=127.0.0.1;user=root;password=P@ssw0rd;port=3308;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" - "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", - "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" - }, - "Jwt": { - "Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI", - "Issuer": "https://identity.frappet.com/realms/bma-ehr" - }, - "EPPlus": { - "ExcelPackage": { - "LicenseContext": "NonCommercial" - } - }, - "MinIO": { - "Endpoint": "https://s3.frappet.com/", - "AccessKey": "frappet", - "SecretKey": "P@ssw0rd", - "BucketName": "bma-recruit" - }, - "Protocol": "HTTPS", - "API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz" -} + "Serilog": { + "MinimumLevel": { + "Default": "Information", + "Override": { + "Microsoft": "Information", + "System": "Warning" + } + } + }, + "ElasticConfiguration": { + "Uri": "http://localhost:9200" + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;", + "ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_exam_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;" + }, + "Jwt": { + "Key": "Hp3234M8rH1KjIdvhlUStayo6vIUOIeI76NKyIsiXJ8", + "Issuer": "https://id.frappet.synology.me/realms/bma-ehr" + }, + "EPPlus": { + "ExcelPackage": { + "LicenseContext": "NonCommercial" + } + }, + "MinIO": { + "Endpoint": "https://s3.frappet.com/", + "AccessKey": "frappet", + "SecretKey": "P@ssw0rd", + "BucketName": "bma-recruit" + }, + "Protocol": "HTTPS", + "API_KEY": "fKRL16yyEgbyTEJdsMw2h64tGSCmkW685PRtM3CygzX1JOSdptT9UJtpgWwKM8FybRTJups3GTFwj27ZRvlPdIkv3XgCoVJaD5LmR06ozuEPvCCRSdp2WFthg08V5xHc56fTPfZLpr1VmXrhd6dvYhHIqKkQUJR02Rlkss11cLRWEQOssEFVA4xdu2J5DIRO1EM5m7wRRvEwcDB4mYRXD9HH52SMq6iYqUWEWsMwLdbk7QW9yYESUEuzMW5gWrb6vIeWZxJV5bTz1PcWUyR7eO9Fyw1F5DiQYc9JgzTC1mW7cv31fEtTtrfbJYKIb5EbWilqIEUKC6A0UKBDDek35ML0006cqRVm0pvdOH6jeq7VQyYrhdXe59dBEyhYGUIfozoVBvW7Up4QBuOMjyPjSqJPlMBKwaseptfrblxQV1AOOivSBpf1ZcQyOZ8JktRtKUDSuXsmG0lsXwFlI3JCeSHdpVdgZWFYcJPegqfrB6KotR02t9AVkpLs1ZWrixwz" +} \ No newline at end of file diff --git a/BMA.EHR.MetaData.Service/wwwroot/keycloak.json b/BMA.EHR.MetaData.Service/wwwroot/keycloak.json index 9eba3b39..a023eb38 100644 --- a/BMA.EHR.MetaData.Service/wwwroot/keycloak.json +++ b/BMA.EHR.MetaData.Service/wwwroot/keycloak.json @@ -1,6 +1,6 @@ { "realm": "bma-ehr", - "auth-server-url": "https://identity.frappet.com", + "auth-server-url": "https://id.frappet.synology.me", "ssl-required": "external", "resource": "bma-ehr", "public-client": true