Merge branch 'develop' of github.com:Frappet/BMA-EHR-BackEnd into develop

This commit is contained in:
Kittapath 2023-12-06 23:43:43 +07:00
commit 0b4ea7c9ce
20 changed files with 4752 additions and 26 deletions

View file

@ -5,6 +5,7 @@ using BMA.EHR.Domain.Models.Leave.Commons;
using BMA.EHR.Domain.Models.Leave.Requests;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.Extensions.Configuration;
namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
@ -58,6 +59,21 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
#region " Methods "
#region " Overrides "
public override async Task<LeaveRequest?> GetByIdAsync(Guid id)
{
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
.Include(x => x.LeaveDocument)
.Include(x => x.LeaveDraftDocument)
.Include(x => x.Type)
.FirstOrDefaultAsync(x => x.Id == id);
return data;
}
#endregion
public async Task<List<LeaveRequest>> GetLeaveRequestByYearAsync(int year)
{
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
@ -68,7 +84,6 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
return data;
}
public async Task<List<LeaveRequest>> GetLeaveRequestByUserIdAsync(Guid keycloakUserId, int year, Guid type, string status)
{
var rawData = _dbContext.Set<LeaveRequest>().AsQueryable()
@ -87,6 +102,24 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
return await rawData.ToListAsync();
}
public async Task<List<LeaveRequest>> GetLeaveRequestForAdminAsync(int year, Guid type, string status)
{
var rawData = _dbContext.Set<LeaveRequest>().AsQueryable()
.Include(x => x.Type);
if (year != 0)
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.LeaveStartDate.Year == year);
if (type != Guid.Empty)
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.Type.Id == type);
if (status.Trim().ToUpper() != "ALL")
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.LeaveStatus == status);
return await rawData.ToListAsync();
}
public async Task<int> GetRestDayTotalByYearForUserAsync(Guid keycloakUserId, int year)
{
var leaveType = await _dbContext.Set<LeaveType>().AsQueryable().FirstOrDefaultAsync(l => l.Code.Trim().ToUpper() == "LV-005");
@ -131,6 +164,36 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
return data;
}
public async Task<LeaveRequest?> GetLastLeaveRequestByTypeForUserAsync(Guid keycloakUserId, Guid leaveTypeId)
{
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
.Include(x => x.Type)
.Where(x => x.KeycloakUserId == keycloakUserId)
.Where(x => x.Type.Id == leaveTypeId)
.OrderByDescending(x => x.LeaveStartDate.Date)
.FirstOrDefaultAsync();
return data;
}
public async Task<List<LeaveRequest>> GetCancelLeaveRequestForAdminAsync(int year, Guid type, string status)
{
var rawData = _dbContext.Set<LeaveRequest>().AsQueryable()
.Include(x => x.Type)
.Where(x => x.LeaveStatus == "DELETE");
if (year != 0)
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.LeaveStartDate.Year == year);
if (type != Guid.Empty)
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.Type.Id == type);
if (status.Trim().ToUpper() != "ALL")
rawData = (IIncludableQueryable<LeaveRequest, LeaveType>)rawData.Where(x => x.LeaveCancelStatus == status);
return await rawData.ToListAsync();
}
#endregion
}
}

View file

@ -29,9 +29,9 @@ namespace BMA.EHR.Domain.Models.Leave.Requests
[Required, Comment("รายละเอียดการลา")]
public string LeaveDetail { get; set; } = string.Empty;
public Document LeaveDocument { get; set; }
public Document? LeaveDocument { get; set; }
public Document LeaveDraftDocument { get; set; }
public Document? LeaveDraftDocument { get; set; }
public string LeaveSalaryText { get; set; } = string.Empty;
@ -101,9 +101,14 @@ namespace BMA.EHR.Domain.Models.Leave.Requests
public string CoupleDaySumTotalHistory { get; set; } = string.Empty;
[Required, Comment("สถานะของคำร้อง")]
public string LeaveStatus { get; set; } = string.Empty;
public string LeaveComment { get; set; } = string.Empty;
[Comment("ความเห็นของผู้บังคับบัญชา")]
public string? LeaveComment { get; set; } = string.Empty;
[Comment("ความเห็นของผู้อำนวยการสำนัก")]
public string? LeaveDirectorComment { get; set; } = string.Empty;
public int LeaveTotal { get; set; } = 0;
@ -116,5 +121,14 @@ namespace BMA.EHR.Domain.Models.Leave.Requests
public DateTime? LeaveGovernmentDate { get; set; }
public int? LeaveSalary { get; set; }
[Comment("สถานะของคำขอยกเลิก")]
public string? LeaveCancelStatus { get; set; } = string.Empty;
[Comment("เหตุผลในการขอยกเลิก")]
public string? LeaveCancelComment { get; set; } = string.Empty;
[Comment("เอกสารแนบในการขอยกเลิกการลา")]
public Document? LeaveCancelDocument { get; set; }
}
}

View file

@ -0,0 +1,937 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
[DbContext(typeof(LeaveDbContext))]
[Migration("20231204041453_Add DirectorComment and IsComplete to LeaveRequest")]
partial class AddDirectorCommentandIsCompletetoLeaveRequest
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime(6)");
b.Property<string>("Detail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<int>("FileSize")
.HasColumnType("int");
b.Property<string>("FileType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<Guid>("ObjectRefId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.ToTable("Document");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รหัสประเภทการลา");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<int>("Limit")
.HasColumnType("int")
.HasComment("จำนวนวันลาสูงสุดประจำปี");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อประเภทการลา");
b.HasKey("Id");
b.ToTable("LeaveTypes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("AbsentDayAt")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayGetIn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayLocation")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("AbsentDayRegistorDate")
.HasColumnType("datetime(6)");
b.Property<string>("AbsentDaySummon")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayCountryHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayEndDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDayLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayLevelCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayPosition")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayStartDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDaySumTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("HajjDayStatus")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsComplete")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการทำงานของคำขอว่าสิ้นสุดการทำงานหรือไม่");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("LeaveAddress")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานที่ติดต่อขณะลา");
b.Property<DateTime?>("LeaveBirthDate")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้บังคับบัญชา");
b.Property<string>("LeaveDetail")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รายละเอียดการลา");
b.Property<string>("LeaveDirectorComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้อำนวยการสำนัก");
b.Property<Guid>("LeaveDocumentId")
.HasColumnType("char(36)");
b.Property<Guid>("LeaveDraftDocumentId")
.HasColumnType("char(36)");
b.Property<DateTime>("LeaveEndDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีสิ้นสุดลา");
b.Property<DateTime?>("LeaveGovernmentDate")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("LeaveLast")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveNumber")
.IsRequired()
.HasColumnType("longtext")
.HasComment("หมายเลขที่ติดต่อขณะลา");
b.Property<int?>("LeaveSalary")
.HasColumnType("int");
b.Property<string>("LeaveSalaryText")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("LeaveStartDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีเริ่มต้นลา");
b.Property<string>("LeaveStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะของคำร้อง");
b.Property<int>("LeaveTotal")
.HasColumnType("int");
b.Property<string>("LeaveWrote")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เขียนที่");
b.Property<string>("OrdainDayBuddhistLentAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayBuddhistLentName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("OrdainDayOrdination")
.HasColumnType("datetime(6)");
b.Property<bool>("OrdainDayStatus")
.HasColumnType("tinyint(1)");
b.Property<int>("RestDayCurrentTotal")
.HasColumnType("int");
b.Property<int>("RestDayOldTotal")
.HasColumnType("int");
b.Property<string>("StudyDayCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayDegreeLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayScholarship")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDaySubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingSubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayUniversityName")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TypeId")
.HasColumnType("char(36)");
b.Property<string>("WifeDayDateBorn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("WifeDayName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("LeaveDocumentId");
b.HasIndex("LeaveDraftDocumentId");
b.HasIndex("TypeId");
b.ToTable("LeaveRequests");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.AdditionalCheckRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckDate")
.HasColumnType("datetime(6)")
.HasComment("*วันที่ลงเวลา");
b.Property<bool>("CheckInEdit")
.HasColumnType("tinyint(1)")
.HasComment("*ขอลงเวลาช่วงเช้า");
b.Property<bool>("CheckOutEdit")
.HasColumnType("tinyint(1)")
.HasComment("*ขอลงเวลาช่วงบ่าย");
b.Property<string>("Comment")
.HasColumnType("longtext")
.HasComment("หมายเหตุในการการอนุมัติ/ไม่อนุมัติ");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("*หมายเหตุขอลงเวลาพิเศษ");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak ที่ร้องขอ");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะการอนุมัติ");
b.HasKey("Id");
b.ToTable("AdditionalCheckRequests");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("คำอธิบาย");
b.Property<string>("EndTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงบ่าย");
b.Property<string>("EndTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงเช้า");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการเปิดใช้งาน (เปิด/ปิด)");
b.Property<bool>("IsDefault")
.HasColumnType("tinyint(1)")
.HasComment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("StartTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงบ่าย");
b.Property<string>("StartTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงเช้า");
b.HasKey("Id");
b.ToTable("DutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<string>("CheckInStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะ Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<string>("CheckOutStatus")
.HasColumnType("longtext")
.HasComment("สถานะ Check-Out");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("EditReason")
.HasColumnType("longtext")
.HasComment("เหตุผลการอนุมัติ/ไม่อนุมัติขอลงเวลาพิเศษ");
b.Property<string>("EditStatus")
.HasColumnType("longtext")
.HasComment("สถานะการของลงเวลาพิเศษ");
b.Property<bool>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.HasKey("Id");
b.ToTable("ProcessUserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DutyTimeId")
.HasColumnType("char(36)")
.HasComment("รหัสรอบการลงเวลา");
b.Property<DateTime?>("EffectiveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่มีผล");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("ทำการประมวลผลแล้วหรือยัง");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("ProfileId")
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("หมายเหตุ");
b.HasKey("Id");
b.HasIndex("DutyTimeId");
b.ToTable("UserDutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.HasKey("Id");
b.ToTable("UserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDocument")
.WithMany()
.HasForeignKey("LeaveDocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDraftDocument")
.WithMany()
.HasForeignKey("LeaveDraftDocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LeaveDocument");
b.Navigation("LeaveDraftDocument");
b.Navigation("Type");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", "DutyTime")
.WithMany()
.HasForeignKey("DutyTimeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DutyTime");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,94 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class AddDirectorCommentandIsCompletetoLeaveRequest : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "LeaveStatus",
table: "LeaveRequests",
type: "longtext",
nullable: false,
comment: "สถานะของคำร้อง",
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "LeaveComment",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "ความเห็นของผู้บังคับบัญชา",
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<bool>(
name: "IsComplete",
table: "LeaveRequests",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการทำงานของคำขอว่าสิ้นสุดการทำงานหรือไม่");
migrationBuilder.AddColumn<string>(
name: "LeaveDirectorComment",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "ความเห็นของผู้อำนวยการสำนัก")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsComplete",
table: "LeaveRequests");
migrationBuilder.DropColumn(
name: "LeaveDirectorComment",
table: "LeaveRequests");
migrationBuilder.AlterColumn<string>(
name: "LeaveStatus",
table: "LeaveRequests",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldComment: "สถานะของคำร้อง")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.UpdateData(
table: "LeaveRequests",
keyColumn: "LeaveComment",
keyValue: null,
column: "LeaveComment",
value: "");
migrationBuilder.AlterColumn<string>(
name: "LeaveComment",
table: "LeaveRequests",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true,
oldComment: "ความเห็นของผู้บังคับบัญชา")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

View file

@ -0,0 +1,948 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
[DbContext(typeof(LeaveDbContext))]
[Migration("20231204043507_Add LeaveCancelDoc and Reason to LeaveRequest")]
partial class AddLeaveCancelDocandReasontoLeaveRequest
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime(6)");
b.Property<string>("Detail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<int>("FileSize")
.HasColumnType("int");
b.Property<string>("FileType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<Guid>("ObjectRefId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.ToTable("Document");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รหัสประเภทการลา");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<int>("Limit")
.HasColumnType("int")
.HasComment("จำนวนวันลาสูงสุดประจำปี");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อประเภทการลา");
b.HasKey("Id");
b.ToTable("LeaveTypes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("AbsentDayAt")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayGetIn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayLocation")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("AbsentDayRegistorDate")
.HasColumnType("datetime(6)");
b.Property<string>("AbsentDaySummon")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayCountryHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayEndDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDayLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayLevelCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayPosition")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayStartDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDaySumTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("HajjDayStatus")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsComplete")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการทำงานของคำขอว่าสิ้นสุดการทำงานหรือไม่");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("LeaveAddress")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานที่ติดต่อขณะลา");
b.Property<DateTime?>("LeaveBirthDate")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveCancelComment")
.HasColumnType("longtext")
.HasComment("เหตุผลในการขอยกเลิก");
b.Property<Guid?>("LeaveCancelDocumentId")
.HasColumnType("char(36)");
b.Property<string>("LeaveComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้บังคับบัญชา");
b.Property<string>("LeaveDetail")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รายละเอียดการลา");
b.Property<string>("LeaveDirectorComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้อำนวยการสำนัก");
b.Property<Guid?>("LeaveDocumentId")
.HasColumnType("char(36)");
b.Property<Guid?>("LeaveDraftDocumentId")
.HasColumnType("char(36)");
b.Property<DateTime>("LeaveEndDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีสิ้นสุดลา");
b.Property<DateTime?>("LeaveGovernmentDate")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("LeaveLast")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveNumber")
.IsRequired()
.HasColumnType("longtext")
.HasComment("หมายเลขที่ติดต่อขณะลา");
b.Property<int?>("LeaveSalary")
.HasColumnType("int");
b.Property<string>("LeaveSalaryText")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("LeaveStartDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีเริ่มต้นลา");
b.Property<string>("LeaveStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะของคำร้อง");
b.Property<int>("LeaveTotal")
.HasColumnType("int");
b.Property<string>("LeaveWrote")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เขียนที่");
b.Property<string>("OrdainDayBuddhistLentAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayBuddhistLentName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("OrdainDayOrdination")
.HasColumnType("datetime(6)");
b.Property<bool>("OrdainDayStatus")
.HasColumnType("tinyint(1)");
b.Property<int>("RestDayCurrentTotal")
.HasColumnType("int");
b.Property<int>("RestDayOldTotal")
.HasColumnType("int");
b.Property<string>("StudyDayCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayDegreeLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayScholarship")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDaySubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingSubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayUniversityName")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TypeId")
.HasColumnType("char(36)");
b.Property<string>("WifeDayDateBorn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("WifeDayName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("LeaveCancelDocumentId");
b.HasIndex("LeaveDocumentId");
b.HasIndex("LeaveDraftDocumentId");
b.HasIndex("TypeId");
b.ToTable("LeaveRequests");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.AdditionalCheckRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckDate")
.HasColumnType("datetime(6)")
.HasComment("*วันที่ลงเวลา");
b.Property<bool>("CheckInEdit")
.HasColumnType("tinyint(1)")
.HasComment("*ขอลงเวลาช่วงเช้า");
b.Property<bool>("CheckOutEdit")
.HasColumnType("tinyint(1)")
.HasComment("*ขอลงเวลาช่วงบ่าย");
b.Property<string>("Comment")
.HasColumnType("longtext")
.HasComment("หมายเหตุในการการอนุมัติ/ไม่อนุมัติ");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("*หมายเหตุขอลงเวลาพิเศษ");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak ที่ร้องขอ");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะการอนุมัติ");
b.HasKey("Id");
b.ToTable("AdditionalCheckRequests");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("คำอธิบาย");
b.Property<string>("EndTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงบ่าย");
b.Property<string>("EndTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงเช้า");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการเปิดใช้งาน (เปิด/ปิด)");
b.Property<bool>("IsDefault")
.HasColumnType("tinyint(1)")
.HasComment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("StartTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงบ่าย");
b.Property<string>("StartTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงเช้า");
b.HasKey("Id");
b.ToTable("DutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<string>("CheckInStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะ Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<string>("CheckOutStatus")
.HasColumnType("longtext")
.HasComment("สถานะ Check-Out");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("EditReason")
.HasColumnType("longtext")
.HasComment("เหตุผลการอนุมัติ/ไม่อนุมัติขอลงเวลาพิเศษ");
b.Property<string>("EditStatus")
.HasColumnType("longtext")
.HasComment("สถานะการของลงเวลาพิเศษ");
b.Property<bool>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.HasKey("Id");
b.ToTable("ProcessUserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DutyTimeId")
.HasColumnType("char(36)")
.HasComment("รหัสรอบการลงเวลา");
b.Property<DateTime?>("EffectiveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่มีผล");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("ทำการประมวลผลแล้วหรือยัง");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("ProfileId")
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("หมายเหตุ");
b.HasKey("Id");
b.HasIndex("DutyTimeId");
b.ToTable("UserDutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.HasKey("Id");
b.ToTable("UserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveCancelDocument")
.WithMany()
.HasForeignKey("LeaveCancelDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDocument")
.WithMany()
.HasForeignKey("LeaveDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDraftDocument")
.WithMany()
.HasForeignKey("LeaveDraftDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LeaveCancelDocument");
b.Navigation("LeaveDocument");
b.Navigation("LeaveDraftDocument");
b.Navigation("Type");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", "DutyTime")
.WithMany()
.HasForeignKey("DutyTimeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DutyTime");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,152 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class AddLeaveCancelDocandReasontoLeaveRequest : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
//migrationBuilder.DropForeignKey(
// name: "FK_LeaveRequests_Document_LeaveDocumentId",
// table: "LeaveRequests");
//migrationBuilder.DropForeignKey(
// name: "FK_LeaveRequests_Document_LeaveDraftDocumentId",
// table: "LeaveRequests");
migrationBuilder.AlterColumn<Guid>(
name: "LeaveDraftDocumentId",
table: "LeaveRequests",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "LeaveDocumentId",
table: "LeaveRequests",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "LeaveCancelComment",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "เหตุผลในการขอยกเลิก")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<Guid>(
name: "LeaveCancelDocumentId",
table: "LeaveRequests",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_LeaveRequests_LeaveCancelDocumentId",
table: "LeaveRequests",
column: "LeaveCancelDocumentId");
migrationBuilder.AddForeignKey(
name: "FK_LeaveRequests_Document_LeaveCancelDocumentId",
table: "LeaveRequests",
column: "LeaveCancelDocumentId",
principalTable: "Document",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_LeaveRequests_Document_LeaveDocumentId",
table: "LeaveRequests",
column: "LeaveDocumentId",
principalTable: "Document",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_LeaveRequests_Document_LeaveDraftDocumentId",
table: "LeaveRequests",
column: "LeaveDraftDocumentId",
principalTable: "Document",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_LeaveRequests_Document_LeaveCancelDocumentId",
table: "LeaveRequests");
//migrationBuilder.DropForeignKey(
// name: "FK_LeaveRequests_Document_LeaveDocumentId",
// table: "LeaveRequests");
//migrationBuilder.DropForeignKey(
// name: "FK_LeaveRequests_Document_LeaveDraftDocumentId",
// table: "LeaveRequests");
migrationBuilder.DropIndex(
name: "IX_LeaveRequests_LeaveCancelDocumentId",
table: "LeaveRequests");
migrationBuilder.DropColumn(
name: "LeaveCancelComment",
table: "LeaveRequests");
migrationBuilder.DropColumn(
name: "LeaveCancelDocumentId",
table: "LeaveRequests");
migrationBuilder.AlterColumn<Guid>(
name: "LeaveDraftDocumentId",
table: "LeaveRequests",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "LeaveDocumentId",
table: "LeaveRequests",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_LeaveRequests_Document_LeaveDocumentId",
table: "LeaveRequests",
column: "LeaveDocumentId",
principalTable: "Document",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_LeaveRequests_Document_LeaveDraftDocumentId",
table: "LeaveRequests",
column: "LeaveDraftDocumentId",
principalTable: "Document",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View file

@ -0,0 +1,948 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
[DbContext(typeof(LeaveDbContext))]
[Migration("20231204045512_change LeaveCancelStatus to LeaveRequest")]
partial class changeLeaveCancelStatustoLeaveRequest
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime(6)");
b.Property<string>("Detail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<int>("FileSize")
.HasColumnType("int");
b.Property<string>("FileType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<Guid>("ObjectRefId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.ToTable("Document");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รหัสประเภทการลา");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<int>("Limit")
.HasColumnType("int")
.HasComment("จำนวนวันลาสูงสุดประจำปี");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อประเภทการลา");
b.HasKey("Id");
b.ToTable("LeaveTypes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("AbsentDayAt")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayGetIn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayLocation")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("AbsentDayRegistorDate")
.HasColumnType("datetime(6)");
b.Property<string>("AbsentDaySummon")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayCountryHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayEndDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDayLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayLevelCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayPosition")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayStartDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDaySumTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("HajjDayStatus")
.HasColumnType("tinyint(1)");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("LeaveAddress")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานที่ติดต่อขณะลา");
b.Property<DateTime?>("LeaveBirthDate")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveCancelComment")
.HasColumnType("longtext")
.HasComment("เหตุผลในการขอยกเลิก");
b.Property<Guid?>("LeaveCancelDocumentId")
.HasColumnType("char(36)");
b.Property<string>("LeaveCancelStatus")
.HasColumnType("longtext")
.HasComment("สถานะของคำขอยกเลิก");
b.Property<string>("LeaveComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้บังคับบัญชา");
b.Property<string>("LeaveDetail")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รายละเอียดการลา");
b.Property<string>("LeaveDirectorComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้อำนวยการสำนัก");
b.Property<Guid?>("LeaveDocumentId")
.HasColumnType("char(36)");
b.Property<Guid?>("LeaveDraftDocumentId")
.HasColumnType("char(36)");
b.Property<DateTime>("LeaveEndDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีสิ้นสุดลา");
b.Property<DateTime?>("LeaveGovernmentDate")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("LeaveLast")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveNumber")
.IsRequired()
.HasColumnType("longtext")
.HasComment("หมายเลขที่ติดต่อขณะลา");
b.Property<int?>("LeaveSalary")
.HasColumnType("int");
b.Property<string>("LeaveSalaryText")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("LeaveStartDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีเริ่มต้นลา");
b.Property<string>("LeaveStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะของคำร้อง");
b.Property<int>("LeaveTotal")
.HasColumnType("int");
b.Property<string>("LeaveWrote")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เขียนที่");
b.Property<string>("OrdainDayBuddhistLentAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayBuddhistLentName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("OrdainDayOrdination")
.HasColumnType("datetime(6)");
b.Property<bool>("OrdainDayStatus")
.HasColumnType("tinyint(1)");
b.Property<int>("RestDayCurrentTotal")
.HasColumnType("int");
b.Property<int>("RestDayOldTotal")
.HasColumnType("int");
b.Property<string>("StudyDayCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayDegreeLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayScholarship")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDaySubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingSubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayUniversityName")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TypeId")
.HasColumnType("char(36)");
b.Property<string>("WifeDayDateBorn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("WifeDayName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("LeaveCancelDocumentId");
b.HasIndex("LeaveDocumentId");
b.HasIndex("LeaveDraftDocumentId");
b.HasIndex("TypeId");
b.ToTable("LeaveRequests");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.AdditionalCheckRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckDate")
.HasColumnType("datetime(6)")
.HasComment("*วันที่ลงเวลา");
b.Property<bool>("CheckInEdit")
.HasColumnType("tinyint(1)")
.HasComment("*ขอลงเวลาช่วงเช้า");
b.Property<bool>("CheckOutEdit")
.HasColumnType("tinyint(1)")
.HasComment("*ขอลงเวลาช่วงบ่าย");
b.Property<string>("Comment")
.HasColumnType("longtext")
.HasComment("หมายเหตุในการการอนุมัติ/ไม่อนุมัติ");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("*หมายเหตุขอลงเวลาพิเศษ");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak ที่ร้องขอ");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะการอนุมัติ");
b.HasKey("Id");
b.ToTable("AdditionalCheckRequests");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("คำอธิบาย");
b.Property<string>("EndTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงบ่าย");
b.Property<string>("EndTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงเช้า");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการเปิดใช้งาน (เปิด/ปิด)");
b.Property<bool>("IsDefault")
.HasColumnType("tinyint(1)")
.HasComment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("StartTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงบ่าย");
b.Property<string>("StartTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงเช้า");
b.HasKey("Id");
b.ToTable("DutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<string>("CheckInStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะ Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<string>("CheckOutStatus")
.HasColumnType("longtext")
.HasComment("สถานะ Check-Out");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("EditReason")
.HasColumnType("longtext")
.HasComment("เหตุผลการอนุมัติ/ไม่อนุมัติขอลงเวลาพิเศษ");
b.Property<string>("EditStatus")
.HasColumnType("longtext")
.HasComment("สถานะการของลงเวลาพิเศษ");
b.Property<bool>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.HasKey("Id");
b.ToTable("ProcessUserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DutyTimeId")
.HasColumnType("char(36)")
.HasComment("รหัสรอบการลงเวลา");
b.Property<DateTime?>("EffectiveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่มีผล");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("ทำการประมวลผลแล้วหรือยัง");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("ProfileId")
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("หมายเหตุ");
b.HasKey("Id");
b.HasIndex("DutyTimeId");
b.ToTable("UserDutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.HasKey("Id");
b.ToTable("UserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveCancelDocument")
.WithMany()
.HasForeignKey("LeaveCancelDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDocument")
.WithMany()
.HasForeignKey("LeaveDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDraftDocument")
.WithMany()
.HasForeignKey("LeaveDraftDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LeaveCancelDocument");
b.Navigation("LeaveDocument");
b.Navigation("LeaveDraftDocument");
b.Navigation("Type");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", "DutyTime")
.WithMany()
.HasForeignKey("DutyTimeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DutyTime");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class changeLeaveCancelStatustoLeaveRequest : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsComplete",
table: "LeaveRequests");
migrationBuilder.AddColumn<string>(
name: "LeaveCancelStatus",
table: "LeaveRequests",
type: "longtext",
nullable: true,
comment: "สถานะของคำขอยกเลิก")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LeaveCancelStatus",
table: "LeaveRequests");
migrationBuilder.AddColumn<bool>(
name: "IsComplete",
table: "LeaveRequests",
type: "tinyint(1)",
nullable: false,
defaultValue: false,
comment: "สถานะการทำงานของคำขอว่าสิ้นสุดการทำงานหรือไม่");
}
}
}

View file

@ -0,0 +1,948 @@
// <auto-generated />
using System;
using BMA.EHR.Infrastructure.Persistence;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
[DbContext(typeof(LeaveDbContext))]
[Migration("20231206053436_change Field to LeaveRequest")]
partial class changeFieldtoLeaveRequest
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("BMA.EHR.Domain.Models.Documents.Document", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<DateTime>("CreatedDate")
.HasColumnType("datetime(6)");
b.Property<string>("Detail")
.IsRequired()
.HasColumnType("text");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("varchar(255)");
b.Property<int>("FileSize")
.HasColumnType("int");
b.Property<string>("FileType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<Guid>("ObjectRefId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.ToTable("Document");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รหัสประเภทการลา");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<int>("Limit")
.HasColumnType("int")
.HasComment("จำนวนวันลาสูงสุดประจำปี");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อประเภทการลา");
b.HasKey("Id");
b.ToTable("LeaveTypes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("AbsentDayAt")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayGetIn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("AbsentDayLocation")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("AbsentDayRegistorDate")
.HasColumnType("datetime(6)");
b.Property<string>("AbsentDaySummon")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayCountryHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayEndDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDayLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayLevelCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayPosition")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CoupleDayStartDateHistory")
.HasColumnType("datetime(6)");
b.Property<string>("CoupleDaySumTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("CoupleDayTotalHistory")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("HajjDayStatus")
.HasColumnType("tinyint(1)");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("LeaveAddress")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานที่ติดต่อขณะลา");
b.Property<DateTime?>("LeaveBirthDate")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveCancelComment")
.HasColumnType("longtext")
.HasComment("เหตุผลในการขอยกเลิก");
b.Property<Guid?>("LeaveCancelDocumentId")
.HasColumnType("char(36)");
b.Property<string>("LeaveCancelStatus")
.HasColumnType("longtext")
.HasComment("สถานะของคำขอยกเลิก");
b.Property<string>("LeaveComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้บังคับบัญชา");
b.Property<string>("LeaveDetail")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รายละเอียดการลา");
b.Property<string>("LeaveDirectorComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้อำนวยการสำนัก");
b.Property<Guid?>("LeaveDocumentId")
.HasColumnType("char(36)");
b.Property<Guid?>("LeaveDraftDocumentId")
.HasColumnType("char(36)");
b.Property<DateTime>("LeaveEndDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีสิ้นสุดลา");
b.Property<DateTime?>("LeaveGovernmentDate")
.HasColumnType("datetime(6)");
b.Property<DateTime?>("LeaveLast")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveNumber")
.IsRequired()
.HasColumnType("longtext")
.HasComment("หมายเลขที่ติดต่อขณะลา");
b.Property<int?>("LeaveSalary")
.HasColumnType("int");
b.Property<string>("LeaveSalaryText")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("LeaveStartDate")
.HasColumnType("datetime(6)")
.HasComment("วัน เดือน ปีเริ่มต้นลา");
b.Property<string>("LeaveStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะของคำร้อง");
b.Property<int>("LeaveTotal")
.HasColumnType("int");
b.Property<string>("LeaveWrote")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เขียนที่");
b.Property<string>("OrdainDayBuddhistLentAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayBuddhistLentName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("OrdainDayLocationNumber")
.IsRequired()
.HasColumnType("longtext");
b.Property<DateTime>("OrdainDayOrdination")
.HasColumnType("datetime(6)");
b.Property<bool>("OrdainDayStatus")
.HasColumnType("tinyint(1)");
b.Property<int>("RestDayCurrentTotal")
.HasColumnType("int");
b.Property<int>("RestDayOldTotal")
.HasColumnType("int");
b.Property<string>("StudyDayCountry")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayDegreeLevel")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayScholarship")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDaySubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayTrainingSubject")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("StudyDayUniversityName")
.IsRequired()
.HasColumnType("longtext");
b.Property<Guid>("TypeId")
.HasColumnType("char(36)");
b.Property<string>("WifeDayDateBorn")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("WifeDayName")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("LeaveCancelDocumentId");
b.HasIndex("LeaveDocumentId");
b.HasIndex("LeaveDraftDocumentId");
b.HasIndex("TypeId");
b.ToTable("LeaveRequests");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.AdditionalCheckRequest", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckDate")
.HasColumnType("datetime(6)")
.HasComment("*วันที่ลงเวลา");
b.Property<bool>("CheckInEdit")
.HasColumnType("tinyint(1)")
.HasComment("*ขอลงเวลาช่วงเช้า");
b.Property<bool>("CheckOutEdit")
.HasColumnType("tinyint(1)")
.HasComment("*ขอลงเวลาช่วงบ่าย");
b.Property<string>("Comment")
.HasColumnType("longtext")
.HasComment("หมายเหตุในการการอนุมัติ/ไม่อนุมัติ");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("*หมายเหตุขอลงเวลาพิเศษ");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak ที่ร้องขอ");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Status")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะการอนุมัติ");
b.HasKey("Id");
b.ToTable("AdditionalCheckRequests");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("longtext")
.HasComment("คำอธิบาย");
b.Property<string>("EndTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงบ่าย");
b.Property<string>("EndTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาออกงานช่วงเช้า");
b.Property<bool>("IsActive")
.HasColumnType("tinyint(1)")
.HasComment("สถานะการเปิดใช้งาน (เปิด/ปิด)");
b.Property<bool>("IsDefault")
.HasColumnType("tinyint(1)")
.HasComment("สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("StartTimeAfternoon")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงบ่าย");
b.Property<string>("StartTimeMorning")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เวลาเข้างานช่วงเช้า");
b.HasKey("Id");
b.ToTable("DutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<string>("CheckInStatus")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานะ Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<string>("CheckOutStatus")
.HasColumnType("longtext")
.HasComment("สถานะ Check-Out");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("EditReason")
.HasColumnType("longtext")
.HasComment("เหตุผลการอนุมัติ/ไม่อนุมัติขอลงเวลาพิเศษ");
b.Property<string>("EditStatus")
.HasColumnType("longtext")
.HasComment("สถานะการของลงเวลาพิเศษ");
b.Property<bool>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.HasKey("Id");
b.ToTable("ProcessUserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<Guid>("DutyTimeId")
.HasColumnType("char(36)")
.HasComment("รหัสรอบการลงเวลา");
b.Property<DateTime?>("EffectiveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่มีผล");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("ทำการประมวลผลแล้วหรือยัง");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("ProfileId")
.HasColumnType("char(36)")
.HasComment("รหัส Profile ในระบบทะเบียนประวัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("หมายเหตุ");
b.HasKey("Id");
b.HasIndex("DutyTimeId");
b.ToTable("UserDutyTimes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CheckIn")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา เข้างาน");
b.Property<string>("CheckInImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-In");
b.Property<double>("CheckInLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-In");
b.Property<string>("CheckInLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In");
b.Property<double>("CheckInLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-In");
b.Property<string>("CheckInPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In");
b.Property<string>("CheckInRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In");
b.Property<DateTime?>("CheckOut")
.HasColumnType("datetime(6)")
.HasComment("วัน เวลา ออกงาน");
b.Property<string>("CheckOutImageUrl")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รูปถ่ายสถานที่ Check-Out");
b.Property<double>("CheckOutLat")
.HasColumnType("double")
.HasComment("พิกัดละติจูด Check-Out");
b.Property<string>("CheckOutLocationName")
.HasColumnType("longtext")
.HasComment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out");
b.Property<double>("CheckOutLon")
.HasColumnType("double")
.HasComment("พิกัดลองจิจูด Check-Out");
b.Property<string>("CheckOutPOI")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out");
b.Property<string>("CheckOutRemark")
.HasColumnType("longtext")
.HasComment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<bool>("IsLocationCheckIn")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In");
b.Property<bool>("IsLocationCheckOut")
.HasColumnType("tinyint(1)")
.HasComment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out");
b.Property<bool>("IsProcess")
.HasColumnType("tinyint(1)")
.HasComment("นำไปประมวลผลแล้วหรือยัง");
b.Property<Guid>("KeycloakUserId")
.HasColumnType("char(36)")
.HasComment("รหัส User ของ Keycloak");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.HasKey("Id");
b.ToTable("UserTimeStamps");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveCancelDocument")
.WithMany()
.HasForeignKey("LeaveCancelDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDocument")
.WithMany()
.HasForeignKey("LeaveDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDraftDocument")
.WithMany()
.HasForeignKey("LeaveDraftDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", "Type")
.WithMany()
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LeaveCancelDocument");
b.Navigation("LeaveDocument");
b.Navigation("LeaveDraftDocument");
b.Navigation("Type");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", "DutyTime")
.WithMany()
.HasForeignKey("DutyTimeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DutyTime");
});
#pragma warning restore 612, 618
}
}
}

View file

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class changeFieldtoLeaveRequest : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View file

@ -233,19 +233,34 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
b.Property<DateTime?>("LeaveBirthDate")
.HasColumnType("datetime(6)");
b.Property<string>("LeaveCancelComment")
.HasColumnType("longtext")
.HasComment("เหตุผลในการขอยกเลิก");
b.Property<Guid?>("LeaveCancelDocumentId")
.HasColumnType("char(36)");
b.Property<string>("LeaveCancelStatus")
.HasColumnType("longtext")
.HasComment("สถานะของคำขอยกเลิก");
b.Property<string>("LeaveComment")
.IsRequired()
.HasColumnType("longtext");
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้บังคับบัญชา");
b.Property<string>("LeaveDetail")
.IsRequired()
.HasColumnType("longtext")
.HasComment("รายละเอียดการลา");
b.Property<Guid>("LeaveDocumentId")
b.Property<string>("LeaveDirectorComment")
.HasColumnType("longtext")
.HasComment("ความเห็นของผู้อำนวยการสำนัก");
b.Property<Guid?>("LeaveDocumentId")
.HasColumnType("char(36)");
b.Property<Guid>("LeaveDraftDocumentId")
b.Property<Guid?>("LeaveDraftDocumentId")
.HasColumnType("char(36)");
b.Property<DateTime>("LeaveEndDate")
@ -276,7 +291,8 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
b.Property<string>("LeaveStatus")
.IsRequired()
.HasColumnType("longtext");
.HasColumnType("longtext")
.HasComment("สถานะของคำร้อง");
b.Property<int>("LeaveTotal")
.HasColumnType("int");
@ -359,6 +375,8 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
b.HasKey("Id");
b.HasIndex("LeaveCancelDocumentId");
b.HasIndex("LeaveDocumentId");
b.HasIndex("LeaveDraftDocumentId");
@ -884,17 +902,17 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveCancelDocument")
.WithMany()
.HasForeignKey("LeaveCancelDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDocument")
.WithMany()
.HasForeignKey("LeaveDocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("LeaveDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Documents.Document", "LeaveDraftDocument")
.WithMany()
.HasForeignKey("LeaveDraftDocumentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("LeaveDraftDocumentId");
b.HasOne("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", "Type")
.WithMany()
@ -902,6 +920,8 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LeaveCancelDocument");
b.Navigation("LeaveDocument");
b.Navigation("LeaveDraftDocument");

View file

@ -197,7 +197,7 @@ namespace BMA.EHR.Leave.Service.Controllers
var inserted = new DutyTime
{
Id = Guid.NewGuid(),
Description = data.Description,
Description = data.Description ?? "",
StartTimeMorning = data.StartTimeMorning,
EndTimeMorning = data.EndTimeMorning,
StartTimeAfternoon = data.StartTimeAfternoon,
@ -346,16 +346,34 @@ namespace BMA.EHR.Leave.Service.Controllers
}
else
{
ret = new CheckInResultDto
if (data.CheckOut != null)
{
StartTimeMorning = duty == null ? "00:00" : duty.StartTimeMorning,
EndTimeMorning = duty == null ? "00:00" : duty.EndTimeMorning,
StartTimeAfternoon = duty == null ? "00:00" : duty.StartTimeAfternoon,
EndTimeAfternoon = duty == null ? "00:00" : duty.EndTimeAfternoon,
Description = duty == null ? "-" : duty.Description,
CheckInTime = data.CheckIn,
CheckInId = data.CheckOut == null ? data.Id : null,
};
ret = new CheckInResultDto
{
StartTimeMorning = duty == null ? "00:00" : duty.StartTimeMorning,
EndTimeMorning = duty == null ? "00:00" : duty.EndTimeMorning,
StartTimeAfternoon = duty == null ? "00:00" : duty.StartTimeAfternoon,
EndTimeAfternoon = duty == null ? "00:00" : duty.EndTimeAfternoon,
Description = duty == null ? "-" : duty.Description,
CheckInTime = null,
CheckInId = null,
};
}
else
{
ret = new CheckInResultDto
{
StartTimeMorning = duty == null ? "00:00" : duty.StartTimeMorning,
EndTimeMorning = duty == null ? "00:00" : duty.EndTimeMorning,
StartTimeAfternoon = duty == null ? "00:00" : duty.StartTimeAfternoon,
EndTimeAfternoon = duty == null ? "00:00" : duty.EndTimeAfternoon,
Description = duty == null ? "-" : duty.Description,
CheckInTime = data.CheckIn,
CheckInId = data.Id,
};
}
}
return Success(ret);

View file

@ -9,6 +9,8 @@ using BMA.EHR.Infrastructure.Persistence;
using BMA.EHR.Leave.Service.DTOs.LeaveRequest;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Routing;
using Sentry;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
@ -125,7 +127,8 @@ namespace BMA.EHR.Leave.Service.Controllers
LeaveNumber = req.LeaveNumber ?? "",
LeaveTotal = req.LeaveStartDate.DiffDay(req.LeaveEndDate),
LeaveSalaryText = req.LeaveSalaryText ?? "",
LeaveStatus = "NEW"
LeaveStatus = "NEW",
KeycloakUserId = userId,
};
// get leave last
@ -436,6 +439,287 @@ namespace BMA.EHR.Leave.Service.Controllers
}
/// <summary>
/// LV2_004 - รายละเอียดการลา (USER)
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("user/{id:guid}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetLeaveRequestByIdAsync(Guid id)
{
var rawData = await _leaveRequestRepository.GetByIdAsync(id);
var thisYear = DateTime.Now.Year;
if (rawData == null)
{
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
}
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(rawData.KeycloakUserId);
if (profile == null)
{
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
}
var lastSalary = profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
var lastSalaryAmount = lastSalary == null ? 0 : lastSalary.Amount ?? 0;
var lastLeaveRequest = await _leaveRequestRepository.GetLastLeaveRequestByTypeForUserAsync(rawData.KeycloakUserId, rawData.Type.Id);
var result = new GetLeaveRequestByIdDto
{
Id = rawData.Id,
LeaveTypeName = rawData.Type.Name,
LeaveTypeId = rawData.Type.Id,
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
DateSendLeave = rawData.CreatedAt,
Status = rawData.LeaveStatus,
LeaveStartDate = rawData.LeaveStartDate,
LeaveEndDate = rawData.LeaveEndDate,
LeaveWrote = rawData.LeaveWrote,
LeaveAddress = rawData.LeaveAddress,
LeaveNumber = rawData.LeaveNumber,
LeaveDetail = rawData.LeaveDetail,
LeaveDocument = await _minIOService.ImagesPath(rawData.LeaveDocument.Id),
LeaveDraftDocument = await _minIOService.ImagesPath(rawData.LeaveDraftDocument.Id),
LeaveLastStart = lastLeaveRequest == null ? null : lastLeaveRequest.LeaveStartDate,
LeaveLastEnd = lastLeaveRequest == null ? null : lastLeaveRequest.LeaveEndDate,
LeaveTotal = rawData.LeaveStartDate.DiffDay(rawData.LeaveEndDate),
LeaveBirthDate = profile.BirthDate,
LeaveGovernmentDate = profile.DateAppoint == null ? null : profile.DateAppoint.Value,
LeaveSalary = lastSalary == null ? 0 : lastSalaryAmount,
LeaveSalaryText = lastSalary == null ? "" : ((int)lastSalaryAmount).ToThaiBahtText(false),
WifeDayName = rawData.WifeDayName,
WifeDayDateBorn = rawData.WifeDayDateBorn,
RestDayOldTotal = rawData.RestDayOldTotal,
RestDayCurrentTotal = rawData.RestDayCurrentTotal,
OrdainDayStatus = rawData.OrdainDayStatus,
OrdainDayLocationName = rawData.OrdainDayLocationName,
OrdainDayLocationAddress = rawData.OrdainDayLocationAddress,
OrdainDayLocationNumber = rawData.OrdainDayLocationNumber,
OrdainDayOrdination = rawData.OrdainDayOrdination,
OrdainDayBuddhistLentName = rawData.OrdainDayBuddhistLentName,
OrdainDayBuddhistLentAddress = rawData.OrdainDayBuddhistLentAddress,
HajjDayStatus = rawData.HajjDayStatus,
AbsentDaySummon = rawData.AbsentDaySummon,
AbsentDayLocation = rawData.AbsentDayLocation,
AbsentDayRegistorDate = rawData.AbsentDayRegistorDate,
AbsentDayGetIn = rawData.AbsentDayGetIn,
AbsentDayAt = rawData.AbsentDayAt,
StudyDaySubject = rawData.StudyDaySubject,
StudyDayDegreeLevel = rawData.StudyDayDegreeLevel,
StudyDayUniversityName = rawData.StudyDayUniversityName,
StudyDayTrainingSubject = rawData.StudyDayTrainingSubject,
StudyDayTrainingName = rawData.StudyDayTrainingName,
StudyDayCountry = rawData.StudyDayCountry,
StudyDayScholarship = rawData.StudyDayScholarship,
CoupleDayName = rawData.CoupleDayName,
CoupleDayPosition = rawData.CoupleDayPosition,
CoupleDayLevel = rawData.CoupleDayLevel,
CoupleDayLevelCountry = rawData.CoupleDayLevelCountry,
CoupleDayCountryHistory = rawData.CoupleDayCountryHistory,
CoupleDayTotalHistory = rawData.CoupleDayTotalHistory,
CoupleDayStartDateHistory = rawData.CoupleDayStartDateHistory,
CoupleDayEndDateHistory = rawData.CoupleDayEndDateHistory,
CoupleDaySumTotalHistory = rawData.CoupleDaySumTotalHistory,
};
return Success(result);
}
/// <summary>
/// LV2_010 - รายการลา (ADMIN)
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("admin")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetLeaveRequestForAdminAsync([FromBody] GetLeaveRequestForAdminDto req)
{
var rawData = await _leaveRequestRepository.GetLeaveRequestForAdminAsync(req.Year, req.Type, req.Status);
var result = new List<GetLeaveRequestForAdminResultDto>();
foreach (var item in rawData)
{
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(item.KeycloakUserId);
var res = new GetLeaveRequestForAdminResultDto
{
Id = item.Id,
LeaveTypeId = item.Type.Id,
LeaveTypeName = item.Type.Name,
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
DateSendLeave = item.CreatedAt.Date,
Status = item.LeaveStatus
};
result.Add(res);
}
if (req.Keyword != "")
result = result.Where(x => x.FullName.Contains(req.Keyword)).ToList();
var pageResult = result.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
return Success(new { data = pageResult, total = result.Count });
}
/// <summary>
/// LV2_008 - ขอยกเลิกการลา (USER)
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("user/delete/{id:guid}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> CancelLeaveRequestAsync([FromForm] CancelLeaveRequestDto req, Guid id)
{
var data = await _leaveRequestRepository.GetByIdAsync(id);
if (data == null)
{
//return Success(new List<object>());
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
}
// change status to delete
data.LeaveStatus = "DELETE";
// add cancel status to new
data.LeaveCancelStatus = "NEW";
data.LeaveCancelComment = req.Reason ?? "";
// upload leave cancel document
if (req.Doc != null)
{
var doc = await _minIOService.UploadFileAsync(req.Doc);
if (doc != null)
{
data.LeaveCancelDocument = doc;
}
}
// save to database
await _leaveRequestRepository.UpdateAsync(data);
return Success();
}
/// <summary>
/// LV2_015 - รายการขอยกเลิกการลา (ADMIN)
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("admin/delete")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCancelLeaveRequestForAdminAsync([FromBody] GetLeaveRequestForAdminDto req)
{
var rawData = await _leaveRequestRepository.GetCancelLeaveRequestForAdminAsync(req.Year, req.Type, req.Status);
var result = new List<GetLeaveCancelRequestResultDto>();
foreach (var item in rawData)
{
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(item.KeycloakUserId);
var res = new GetLeaveCancelRequestResultDto
{
Id = item.Id,
LeaveTypeId = item.Type.Id,
LeaveTypeName = item.Type.Name,
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
DateSendLeave = item.CreatedAt.Date,
Status = item.LeaveCancelStatus
};
result.Add(res);
}
if (req.Keyword != "")
result = result.Where(x => x.FullName.Contains(req.Keyword)).ToList();
var pageResult = result.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList();
return Success(new { data = pageResult, total = result.Count });
}
/// <summary>
/// LV2_006 - รายละเอียดการยกเลิกการลา (USER/ADMIN)
/// </summary>
/// <returns>
/// </returns>
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("user/delete/{id:guid}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCancelLeaveRequestByIdAsync(Guid id)
{
var rawData = await _leaveRequestRepository.GetByIdAsync(id);
var thisYear = DateTime.Now.Year;
if (rawData == null)
{
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
}
var profile = await _userProfileRepository.GetProfileByKeycloakIdAsync(rawData.KeycloakUserId);
if (profile == null)
{
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
}
var result = new GetCancelLeaveRequestByIdDto
{
Id = rawData.Id,
LeaveTypeName = rawData.Type.Name,
FullName = $"{profile.Prefix.Name}{profile.FirstName} {profile.LastName}",
Status = rawData.LeaveCancelStatus,
LeaveStartDate = rawData.LeaveStartDate,
LeaveEndDate = rawData.LeaveEndDate,
LeaveWrote = rawData.LeaveWrote,
LeaveAddress = rawData.LeaveAddress,
LeaveNumber = rawData.LeaveNumber,
LeaveDetail = rawData.LeaveDetail,
LeaveDocDelete = await _minIOService.ImagesPath(rawData.LeaveCancelDocument.Id),
LeaveReasonDelete = rawData.LeaveCancelComment ?? "",
LeaveTotal = rawData.LeaveTotal,
};
return Success(result);
}
#endregion
}

View file

@ -0,0 +1,9 @@
namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
{
public class CancelLeaveRequestDto
{
public string? Reason { get; set; }
public IFormFile? Doc { get; set; }
}
}

View file

@ -0,0 +1,31 @@
namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
{
public class GetCancelLeaveRequestByIdDto
{
public Guid Id { get; set; } = Guid.Empty;
public string LeaveTypeName { get; set; } = string.Empty;
public string FullName { get; set; } = string.Empty;
public string Status { get; set; } = string.Empty;
public string LeaveDocDelete { get; set; } = string.Empty;
public string LeaveReasonDelete { get; set; } = string.Empty;
public string LeaveWrote { get; set; } = string.Empty;
public string LeaveAddress { get; set; } = string.Empty;
public string LeaveNumber { get; set; } = string.Empty;
public string LeaveDetail { get; set; } = string.Empty;
public double LeaveTotal { get; set; } = 0;
public DateTime LeaveStartDate { get; set; } = DateTime.MinValue;
public DateTime LeaveEndDate { get; set;} = DateTime.MinValue;
}
}

View file

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
{
public class GetLeaveCancelRequestDto
{
[Required]
public Guid Type { get; set; } = Guid.Empty;
[Required]
public string Status { get; set; } = string.Empty;
[Required]
public int Page { get; set; } = 1;
[Required]
public int PageSize { get; set; } = 10;
public string Keyword { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,17 @@
namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
{
public class GetLeaveCancelRequestResultDto
{
public Guid Id { get; set; }
public string LeaveTypeName { get; set; }
public Guid LeaveTypeId { get; set; }
public string FullName { get; set; }
public DateTime DateSendLeave { get; set; }
public string Status { get; set; }
}
}

View file

@ -0,0 +1,116 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
{
public class GetLeaveRequestByIdDto
{
public Guid Id { get; set; } = Guid.Empty;
public string LeaveTypeName { get; set; } = string.Empty;
public Guid LeaveTypeId { get; set; } = Guid.Empty;
public string FullName { get; set; } = string.Empty;
public DateTime DateSendLeave { get; set; } = DateTime.MinValue;
public string Status { get; set; } = string.Empty;
public DateTime LeaveStartDate { get; set; } = DateTime.Now;
public DateTime LeaveEndDate { get; set; } = DateTime.Now;
public string LeaveWrote { get; set; } = string.Empty;
public string LeaveAddress { get; set; } = string.Empty;
public string LeaveNumber { get; set; } = string.Empty;
public string LeaveDetail { get; set; } = string.Empty;
public string LeaveDocument { get; set; }
public string LeaveDraftDocument { get; set; }
public DateTime? LeaveLastStart { get; set; } = DateTime.MinValue;
public DateTime? LeaveLastEnd { get; set; } = DateTime.MinValue;
public float LeaveTotal { get; set; } = 0;
public DateTime? LeaveBirthDate { get; set; } = DateTime.MinValue;
public DateTime? LeaveGovernmentDate { get; set; } = DateTime.MinValue;
public double LeaveSalary { get; set; } = 0;
public string LeaveSalaryText { get; set; } = string.Empty;
public string WifeDayName { get; set; } = string.Empty;
public string WifeDayDateBorn { get; set; } = string.Empty;
public int RestDayOldTotal { get; set; } = 0;
public int RestDayCurrentTotal { get; set; } = 0;
public bool OrdainDayStatus { get; set; } = false;
public string OrdainDayLocationName { get; set; } = string.Empty;
public string OrdainDayLocationAddress { get; set; } = string.Empty;
public string OrdainDayLocationNumber { get; set; } = string.Empty;
public DateTime OrdainDayOrdination { get; set; } = DateTime.Now;
public string OrdainDayBuddhistLentName { get; set; } = string.Empty;
public string OrdainDayBuddhistLentAddress { get; set; } = string.Empty;
public bool HajjDayStatus { get; set; } = false;
public string AbsentDaySummon { get; set; } = string.Empty;
public string AbsentDayLocation { get; set; } = string.Empty;
public DateTime AbsentDayRegistorDate { get; set; } = DateTime.Now;
public string AbsentDayGetIn { get; set; } = string.Empty;
public string AbsentDayAt { get; set; } = string.Empty;
public string StudyDaySubject { get; set; } = string.Empty;
public string StudyDayDegreeLevel { get; set; } = string.Empty;
public string StudyDayUniversityName { get; set; } = string.Empty;
public string StudyDayTrainingSubject { get; set; } = string.Empty;
public string StudyDayTrainingName { get; set; } = string.Empty;
public string StudyDayCountry { get; set; } = string.Empty;
public string StudyDayScholarship { get; set; } = string.Empty;
public string CoupleDayName { get; set; } = string.Empty;
public string CoupleDayPosition { get; set; } = string.Empty;
public string CoupleDayLevel { get; set; } = string.Empty;
public string CoupleDayLevelCountry { get; set; } = string.Empty;
public string CoupleDayCountryHistory { get; set; } = string.Empty;
public string CoupleDayTotalHistory { get; set; } = string.Empty;
public DateTime CoupleDayStartDateHistory { get; set; } = DateTime.Now;
public DateTime CoupleDayEndDateHistory { get; set; } = DateTime.Now;
public string CoupleDaySumTotalHistory { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,25 @@
using Org.BouncyCastle.Asn1.X509;
using System.ComponentModel.DataAnnotations;
namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
{
public class GetLeaveRequestForAdminDto
{
[Required]
public int Year { get; set; } = 0;
[Required]
public Guid Type { get; set; } = Guid.Empty;
[Required]
public string Status { get; set; } = string.Empty;
[Required]
public int Page { get; set; } = 1;
[Required]
public int PageSize { get; set; } = 10;
public string Keyword { get; set; } = string.Empty;
}
}

View file

@ -0,0 +1,17 @@
namespace BMA.EHR.Leave.Service.DTOs.LeaveRequest
{
public class GetLeaveRequestForAdminResultDto
{
public Guid Id { get; set; } = Guid.Empty;
public string LeaveTypeName { get; set; } = string.Empty;
public Guid LeaveTypeId { get; set; } = Guid.Empty;
public string FullName { get; set; } = string.Empty;
public DateTime DateSendLeave { get; set; } = DateTime.MinValue;
public string Status { get; set; } = string.Empty;
}
}