แก้ไข
- format response - ส่ง noti โดยมีการแนบลิงค์
This commit is contained in:
parent
19c30e69df
commit
92847e6be2
6 changed files with 211 additions and 21 deletions
|
|
@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OfficeOpenXml.ConditionalFormatting;
|
||||
using Swashbuckle.AspNetCore.Annotations;
|
||||
using System.Security.Claims;
|
||||
|
||||
|
|
@ -102,15 +103,40 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
|
||||
var result = await _leaveBeginningRepository.GetAllByYearAsync(req.Year);
|
||||
var resData = await _leaveBeginningRepository.GetAllByYearAsync(req.Year);
|
||||
|
||||
if (req.Type != Guid.Empty)
|
||||
result = result.Where(x => x.LeaveTypeId == req.Type).ToList();
|
||||
resData = resData.Where(x => x.LeaveTypeId == req.Type).ToList();
|
||||
|
||||
if (req.Keyword != "")
|
||||
result = result.Where(x => x.FirstName!.Contains(req.Keyword) || x.LastName!.Contains(req.Keyword)).ToList();
|
||||
resData = resData.Where(x => x.FirstName!.Contains(req.Keyword) || x.LastName!.Contains(req.Keyword)).ToList();
|
||||
|
||||
var result = new List<object>();
|
||||
|
||||
foreach (var item in resData)
|
||||
{
|
||||
result.Add(new
|
||||
{
|
||||
item.Id,
|
||||
item.ProfileId,
|
||||
item.Prefix,
|
||||
item.FirstName,
|
||||
item.LastName,
|
||||
item.LeaveTypeId,
|
||||
LeaveTypeCode = item.LeaveType?.Code,
|
||||
LeaveType = item.LeaveType?.Name,
|
||||
item.LeaveYear,
|
||||
item.LeaveDays,
|
||||
item.LeaveDaysUsed,
|
||||
item.CreatedAt,
|
||||
item.CreatedFullName,
|
||||
item.LastUpdatedAt,
|
||||
item.LastUpdateFullName
|
||||
});
|
||||
}
|
||||
|
||||
var pageResult = result.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
|
||||
|
||||
return Success(new { data = pageResult, total = result.Count });
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -212,9 +238,9 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
|
||||
var profile = await _userProfileRepository.GetProfileByProfileIdAsync(req.ProfileId, AccessToken);
|
||||
if(profile == null)
|
||||
if (profile == null)
|
||||
{
|
||||
return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound);
|
||||
return Error("ไม่พบข้อมูลข้าราชการหรือลูกจ้าง", StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
leaveBeginning.LeaveTypeId = req.LeaveTypeId;
|
||||
|
|
@ -288,7 +314,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Success();
|
||||
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,43 @@
|
|||
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
##See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
#
|
||||
#FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||
#
|
||||
## ตั้งค่า TimeZone ใน Container
|
||||
#ENV TZ=Asia/Bangkok
|
||||
#RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
#
|
||||
#WORKDIR /app
|
||||
#EXPOSE 80
|
||||
#EXPOSE 443
|
||||
#
|
||||
#FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
#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/BMA.EHR.Leave.csproj", "BMA.EHR.Leave/"]
|
||||
#
|
||||
#RUN dotnet restore "BMA.EHR.Leave/BMA.EHR.Leave.csproj"
|
||||
#COPY . .
|
||||
#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.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.dll"]
|
||||
#
|
||||
|
||||
# ---------------------------
|
||||
# Base image สำหรับ runtime
|
||||
# ---------------------------
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
|
||||
|
||||
# ตั้งค่า TimeZone ใน Container
|
||||
# ตั้งค่า TimeZone
|
||||
ENV TZ=Asia/Bangkok
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
|
|
@ -10,23 +45,40 @@ WORKDIR /app
|
|||
EXPOSE 80
|
||||
EXPOSE 443
|
||||
|
||||
# ---------------------------
|
||||
# Build stage
|
||||
# ---------------------------
|
||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
|
||||
WORKDIR /src
|
||||
|
||||
# 1. Copy เฉพาะ .csproj ไฟล์และ restore เพื่อใช้ cache ได้
|
||||
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/BMA.EHR.Leave.csproj", "BMA.EHR.Leave/"]
|
||||
|
||||
RUN dotnet restore "BMA.EHR.Leave/BMA.EHR.Leave.csproj"
|
||||
|
||||
# 2. Copy source code ทั้งหมดหลัง restore เพื่อไม่ให้ cache พังง่าย
|
||||
COPY . .
|
||||
|
||||
WORKDIR "/src/BMA.EHR.Leave"
|
||||
RUN dotnet build "BMA.EHR.Leave.csproj" -c Release -o /app/build
|
||||
|
||||
# 3. Build แบบ Release
|
||||
RUN dotnet build "BMA.EHR.Leave.csproj" -c Release -warnaslevel:0 -o /app/build
|
||||
|
||||
# ---------------------------
|
||||
# Publish stage
|
||||
# ---------------------------
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "BMA.EHR.Leave.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
RUN dotnet publish "BMA.EHR.Leave.csproj" -c Release -warnaslevel:0 -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# ---------------------------
|
||||
# Final runtime image
|
||||
# ---------------------------
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=publish /app/publish .
|
||||
|
||||
ENTRYPOINT ["dotnet", "BMA.EHR.Leave.dll"]
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
"ConnectionStrings": {
|
||||
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"ExamConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
"LeaveConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=hrms_leave;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
|
||||
|
||||
//"DefaultConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
//"ExamConnection": "server=172.27.17.68;user=user;password=cDldaqkwESWvuZ37Gr0n;port=3306;database=hrms_exam;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;",
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
},
|
||||
"Jwt": {
|
||||
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",
|
||||
"Issuer": "https://id.frappet.synology.me/realms/hrms",
|
||||
"Issuer": "https://id.frappet.synology.me/realms/hrms"
|
||||
//"Key": "xY2VR-EFvvNPsMs39u8ooVBWQL6mPwrNJOh3koJFTgU",
|
||||
//"Issuer": "https://hrms-id.bangkok.go.th/realms/hrms"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue