add table duty time
This commit is contained in:
parent
d06e1af217
commit
22d9210416
17 changed files with 2459 additions and 10 deletions
|
|
@ -0,0 +1,122 @@
|
|||
using BMA.EHR.Application.Common.Interfaces;
|
||||
using BMA.EHR.Application.Messaging;
|
||||
using BMA.EHR.Domain.Models.Leave.TimeAttendants;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
||||
{
|
||||
public class ProcessUserTimeStampRepository : GenericLeaveRepository<Guid, ProcessUserTimeStamp>
|
||||
{
|
||||
#region " Fields "
|
||||
|
||||
private readonly ILeaveDbContext _dbContext;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
||||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly EmailSenderService _emailSenderService;
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Constructor and Destuctor "
|
||||
|
||||
public ProcessUserTimeStampRepository(ILeaveDbContext dbContext,
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
OrganizationCommonRepository organizationCommonRepository,
|
||||
UserProfileRepository userProfileRepository,
|
||||
IConfiguration configuration,
|
||||
EmailSenderService emailSenderService) : base(dbContext, httpContextAccessor)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_organizationCommonRepository = organizationCommonRepository;
|
||||
_userProfileRepository = userProfileRepository;
|
||||
_configuration = configuration;
|
||||
_emailSenderService = emailSenderService;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Properties "
|
||||
|
||||
protected Guid UserOrganizationId
|
||||
{
|
||||
get
|
||||
{
|
||||
if (UserId != null || UserId != "")
|
||||
return _userProfileRepository.GetUserOCId(Guid.Parse(UserId!));
|
||||
else
|
||||
return Guid.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<int> CountRecordAsync()
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>().CountAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<ProcessUserTimeStamp?> GetTimestampByDateAsync(Guid keycloakId, DateTime date)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
.Where(u => u.CheckIn.Date == date.Date)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<ProcessUserTimeStamp?> GetLastRecord(Guid keycloakId)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
.OrderByDescending(u => u.CheckIn)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryAsync(Guid keycloakId, int year, int page = 1, int pageSize = 10, string keyword = "")
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
.Where(u => u.CheckIn.Year == year)
|
||||
.OrderBy(u => u.CheckIn)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<ProcessUserTimeStamp>> GetTimeStampHistoryForAdminAsync(DateTime startDate, DateTime endDate, int page = 1, int pageSize = 10, string keyword = "")
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.CheckIn.Date >= startDate.Date && u.CheckIn.Date <= endDate.Date)
|
||||
.OrderBy(u => u.CheckIn)
|
||||
.Skip((page - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ToListAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<ProcessUserTimeStamp?> GetTimeStampById(Guid id)
|
||||
{
|
||||
var data = await _dbContext.Set<ProcessUserTimeStamp>()
|
||||
.Where(u => u.Id == id)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -57,7 +57,14 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
|
||||
#region " Methods "
|
||||
|
||||
public async Task<UserTimeStamp?> GetTimestampByDateAsync(Guid keycloakId,DateTime date)
|
||||
public async Task<int> CountRecordAsync()
|
||||
{
|
||||
var data = await _dbContext.Set<UserTimeStamp>().CountAsync();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<UserTimeStamp?> GetTimestampByDateAsync(Guid keycloakId, DateTime date)
|
||||
{
|
||||
var data = await _dbContext.Set<UserTimeStamp>()
|
||||
.Where(u => u.KeycloakUserId == keycloakId)
|
||||
|
|
@ -90,7 +97,7 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
|
|||
return data;
|
||||
}
|
||||
|
||||
public async Task<List<UserTimeStamp>> GetTimeStampHistoryForAdminAsync(DateTime startDate,DateTime endDate, int page = 1, int pageSize = 10, string keyword = "")
|
||||
public async Task<List<UserTimeStamp>> GetTimeStampHistoryForAdminAsync(DateTime startDate, DateTime endDate, int page = 1, int pageSize = 10, string keyword = "")
|
||||
{
|
||||
var data = await _dbContext.Set<UserTimeStamp>()
|
||||
.Where(u => u.CheckIn.Date >= startDate.Date && u.CheckIn.Date <= endDate.Date)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Leave.TimeAttendants
|
||||
{
|
||||
public class ProcessUserTimeStamp : EntityBase
|
||||
{
|
||||
[Required, Comment("รหัส User ของ Keycloak")]
|
||||
public Guid KeycloakUserId { get; set; } = Guid.Empty;
|
||||
|
||||
[Required, Comment("วัน เวลา เข้างาน")]
|
||||
public DateTime CheckIn { get; set; } = DateTime.MinValue;
|
||||
|
||||
[Comment("วัน เวลา ออกงาน")]
|
||||
public DateTime? CheckOut { get; set; }
|
||||
|
||||
[Required, Comment("นำไปประมวลผลแล้วหรือยัง")]
|
||||
public bool IsProcess { get; set; } = false;
|
||||
|
||||
[Required, Comment("พิกัดละติจูด Check-In")]
|
||||
public double CheckInLat { get; set; } = 0;
|
||||
|
||||
[Required, Comment("พิกัดลองจิจูด Check-In")]
|
||||
public double CheckInLon { get; set; } = 0;
|
||||
|
||||
[Required, Comment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In")]
|
||||
public string CheckInPOI { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In")]
|
||||
public bool IsLocationCheckIn { get; set; } = true;
|
||||
|
||||
[Comment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In")]
|
||||
public string? CheckInLocationName { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("รูปถ่ายสถานที่ Check-In")]
|
||||
public string CheckInImageUrl { get; set; } = string.Empty;
|
||||
|
||||
[Comment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In")]
|
||||
public string? CheckInRemark { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("สถานะ Check-In")]
|
||||
public string? CheckInStatus { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("พิกัดละติจูด Check-Out")]
|
||||
public double CheckOutLat { get; set; } = 0;
|
||||
|
||||
[Required, Comment("พิกัดลองจิจูด Check-Out")]
|
||||
public double CheckOutLon { get; set; } = 0;
|
||||
|
||||
[Required, Comment("ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out")]
|
||||
public string CheckOutPOI { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out")]
|
||||
public bool IsLocationCheckOut { get; set; } = true;
|
||||
|
||||
[Comment("กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out")]
|
||||
public string? CheckOutLocationName { get; set; } = string.Empty;
|
||||
|
||||
[Required, Comment("รูปถ่ายสถานที่ Check-Out")]
|
||||
public string CheckOutImageUrl { get; set; } = string.Empty;
|
||||
|
||||
[Comment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out")]
|
||||
public string? CheckOutRemark { get; set; } = string.Empty;
|
||||
|
||||
[Comment("สถานะ Check-Out")]
|
||||
public string? CheckOutStatus { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
18
BMA.EHR.Domain/Models/Leave/TimeAttendants/UserDutyTime.cs
Normal file
18
BMA.EHR.Domain/Models/Leave/TimeAttendants/UserDutyTime.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using BMA.EHR.Domain.Models.Base;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BMA.EHR.Domain.Models.Leave.TimeAttendants
|
||||
{
|
||||
public class UserDutyTime : EntityBase
|
||||
{
|
||||
[Required, Comment("รหัส User ของ Keycloak")]
|
||||
public Guid KeycloakUserId { get; set; } = Guid.Empty;
|
||||
|
||||
[Required, Comment("รหัสรอบการลงเวลา")]
|
||||
public Guid DutyTimeId { get; set; } = Guid.Empty;
|
||||
|
||||
[Comment("วันที่มีผล")]
|
||||
public DateTime? EffectiveDate { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -59,7 +59,5 @@ namespace BMA.EHR.Domain.Models.Leave.TimeAttendants
|
|||
|
||||
[Comment("ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out")]
|
||||
public string? CheckOutRemark { get; set; } = string.Empty;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
377
BMA.EHR.Infrastructure/Migrations/LeaveDb/20231123024901_add process time stamp.Designer.cs
generated
Normal file
377
BMA.EHR.Infrastructure/Migrations/LeaveDb/20231123024901_add process time stamp.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,377 @@
|
|||
// <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("20231123024901_add process time stamp")]
|
||||
partial class addprocesstimestamp
|
||||
{
|
||||
/// <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.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<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.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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addprocesstimestamp : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ProcessUserTimeStamps",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
KeycloakUserId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัส User ของ Keycloak", collation: "ascii_general_ci"),
|
||||
CheckIn = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วัน เวลา เข้างาน"),
|
||||
CheckOut = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วัน เวลา ออกงาน"),
|
||||
IsProcess = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "นำไปประมวลผลแล้วหรือยัง"),
|
||||
CheckInLat = table.Column<double>(type: "double", nullable: false, comment: "พิกัดละติจูด Check-In"),
|
||||
CheckInLon = table.Column<double>(type: "double", nullable: false, comment: "พิกัดลองจิจูด Check-In"),
|
||||
CheckInPOI = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsLocationCheckIn = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In"),
|
||||
CheckInLocationName = table.Column<string>(type: "longtext", nullable: true, comment: "กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CheckInImageUrl = table.Column<string>(type: "longtext", nullable: false, comment: "รูปถ่ายสถานที่ Check-In")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CheckInRemark = table.Column<string>(type: "longtext", nullable: true, comment: "ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CheckInStatus = table.Column<string>(type: "longtext", nullable: false, comment: "สถานะ Check-In")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CheckOutLat = table.Column<double>(type: "double", nullable: false, comment: "พิกัดละติจูด Check-Out"),
|
||||
CheckOutLon = table.Column<double>(type: "double", nullable: false, comment: "พิกัดลองจิจูด Check-Out"),
|
||||
CheckOutPOI = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
IsLocationCheckOut = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out"),
|
||||
CheckOutLocationName = table.Column<string>(type: "longtext", nullable: true, comment: "กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CheckOutImageUrl = table.Column<string>(type: "longtext", nullable: false, comment: "รูปถ่ายสถานที่ Check-Out")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CheckOutRemark = table.Column<string>(type: "longtext", nullable: true, comment: "ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CheckOutStatus = table.Column<string>(type: "longtext", nullable: true, comment: "สถานะ Check-Out")
|
||||
.Annotation("MySql:CharSet", "utf8mb4")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ProcessUserTimeStamps", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ProcessUserTimeStamps");
|
||||
}
|
||||
}
|
||||
}
|
||||
437
BMA.EHR.Infrastructure/Migrations/LeaveDb/20231123032746_add user duty time.Designer.cs
generated
Normal file
437
BMA.EHR.Infrastructure/Migrations/LeaveDb/20231123032746_add user duty time.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,437 @@
|
|||
// <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("20231123032746_add user duty time")]
|
||||
partial class adduserdutytime
|
||||
{
|
||||
/// <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.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<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<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("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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class adduserdutytime : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "UserDutyTimes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
||||
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
||||
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
||||
.Annotation("MySql:CharSet", "utf8mb4"),
|
||||
KeycloakUserId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัส User ของ Keycloak", collation: "ascii_general_ci"),
|
||||
DutyTimeId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสรอบการลงเวลา", collation: "ascii_general_ci")
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_UserDutyTimes", x => x.Id);
|
||||
})
|
||||
.Annotation("MySql:CharSet", "utf8mb4");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "UserDutyTimes");
|
||||
}
|
||||
}
|
||||
}
|
||||
440
BMA.EHR.Infrastructure/Migrations/LeaveDb/20231123033051_add user duty time - effective date.Designer.cs
generated
Normal file
440
BMA.EHR.Infrastructure/Migrations/LeaveDb/20231123033051_add user duty time - effective date.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,440 @@
|
|||
// <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("20231123033051_add user duty time - effective date")]
|
||||
partial class adduserdutytimeeffectivedate
|
||||
{
|
||||
/// <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.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<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)");
|
||||
|
||||
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("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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class adduserdutytimeeffectivedate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "EffectiveDate",
|
||||
table: "UserDutyTimes",
|
||||
type: "datetime(6)",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EffectiveDate",
|
||||
table: "UserDutyTimes");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,441 @@
|
|||
// <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("20231123033334_add comment user duty time - effective date")]
|
||||
partial class addcommentuserdutytimeeffectivedate
|
||||
{
|
||||
/// <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.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<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<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("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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addcommentuserdutytimeeffectivedate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "EffectiveDate",
|
||||
table: "UserDutyTimes",
|
||||
type: "datetime(6)",
|
||||
nullable: true,
|
||||
comment: "วันที่มีผล",
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime(6)",
|
||||
oldNullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "EffectiveDate",
|
||||
table: "UserDutyTimes",
|
||||
type: "datetime(6)",
|
||||
nullable: true,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "datetime(6)",
|
||||
oldNullable: true,
|
||||
oldComment: "วันที่มีผล");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -104,6 +104,207 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
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<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<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("UserDutyTimes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
|
||||
public DbSet<UserTimeStamp> UserTimeStamps { get; set; }
|
||||
|
||||
public DbSet<ProcessUserTimeStamp> ProcessUserTimeStamps { get; set; }
|
||||
|
||||
public DbSet<UserDutyTime> UserDutyTimes { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
private readonly UserProfileRepository _userProfileRepository;
|
||||
private readonly UserTimeStampRepository _userTimeStampRepository;
|
||||
private readonly MinIOService _minIOService;
|
||||
private readonly ProcessUserTimeStampRepository _processUserTimeStampRepository;
|
||||
|
||||
private readonly string _bucketName = "check-in";
|
||||
|
||||
|
|
@ -46,7 +47,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
IConfiguration configuration,
|
||||
UserProfileRepository userProfileRepository,
|
||||
UserTimeStampRepository userTimeStampRepository,
|
||||
MinIOService minIOService)
|
||||
MinIOService minIOService,
|
||||
ProcessUserTimeStampRepository processUserTimeStampRepository)
|
||||
{
|
||||
_dutyTimeRepository = dutyTimeRepository;
|
||||
_context = context;
|
||||
|
|
@ -56,6 +58,7 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
_userProfileRepository = userProfileRepository;
|
||||
_userTimeStampRepository = userTimeStampRepository;
|
||||
_minIOService = minIOService;
|
||||
_processUserTimeStampRepository = processUserTimeStampRepository;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -375,11 +378,16 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
await _minIOService.UploadFileAsync(fileName, ms);
|
||||
}
|
||||
|
||||
var currentCheckInProcess = await _processUserTimeStampRepository.GetTimestampByDateAsync(Guid.Parse(UserId), currentDate);
|
||||
|
||||
// create check in object
|
||||
if (data.CheckInId == null)
|
||||
{
|
||||
// validate duplicate check in
|
||||
var currentCheckIn = await _userTimeStampRepository.GetTimestampByDateAsync(Guid.Parse(UserId), currentDate);
|
||||
|
||||
|
||||
|
||||
if (currentCheckIn != null)
|
||||
{
|
||||
return Error(new Exception("ไม่สามารถลงเวลาได้ เนืองจากมีการลงเวลาในวันนี้แล้ว!"), (int)StatusCodes.Status400BadRequest);
|
||||
|
|
@ -399,11 +407,29 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
CheckIn = currentDate
|
||||
};
|
||||
|
||||
// process - รอทำใน queue
|
||||
var checkin_process = new ProcessUserTimeStamp
|
||||
{
|
||||
KeycloakUserId = UserId != null ? Guid.Parse(UserId) : Guid.Empty,
|
||||
CheckInLat = data.Lat,
|
||||
CheckInLon = data.Lon,
|
||||
IsLocationCheckIn = data.IsLocation,
|
||||
CheckInLocationName = data.LocationName,
|
||||
CheckInPOI = data.POI,
|
||||
CheckInRemark = data.Remark,
|
||||
CheckInImageUrl = fileName,
|
||||
CheckIn = currentDate
|
||||
};
|
||||
|
||||
await _userTimeStampRepository.AddAsync(checkin);
|
||||
await _processUserTimeStampRepository.AddAsync(checkin_process);
|
||||
}
|
||||
else
|
||||
{
|
||||
var checkout = await _userTimeStampRepository.GetByIdAsync(data.CheckInId.Value);
|
||||
var checkout_process = await _processUserTimeStampRepository.GetByIdAsync(currentCheckInProcess.Id);
|
||||
|
||||
|
||||
if (checkout != null)
|
||||
{
|
||||
checkout.CheckOutLat = data.Lat;
|
||||
|
|
@ -421,6 +447,25 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
{
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
if (checkout_process != null)
|
||||
{
|
||||
checkout_process.CheckOutLat = data.Lat;
|
||||
checkout_process.CheckOutLon = data.Lon;
|
||||
checkout_process.IsLocationCheckOut = data.IsLocation;
|
||||
checkout_process.CheckOutLocationName = data.LocationName;
|
||||
checkout_process.CheckOutPOI = data.POI;
|
||||
checkout_process.CheckOutRemark = data.Remark;
|
||||
checkout_process.CheckOutImageUrl = fileName;
|
||||
checkout_process.CheckOut = currentDate;
|
||||
|
||||
await _processUserTimeStampRepository.UpdateAsync(checkout_process);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return Success(new { date = currentDate });
|
||||
|
|
@ -498,6 +543,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
return Error(new Exception("วันเริ่มต้นต้องมีค่าน้อยกว่าหรือเท่ากับวันสิ้นสุด"), (int)StatusCodes.Status400BadRequest);
|
||||
}
|
||||
|
||||
var count = await _userTimeStampRepository.CountRecordAsync();
|
||||
|
||||
|
||||
var imgUrl = $"{_configuration["MinIO:Endpoint"]}{_configuration["MinIO:BucketName"]}";
|
||||
var data = (await _userTimeStampRepository.GetTimeStampHistoryForAdminAsync(startDate, endDate, page, pageSize, keyword))
|
||||
|
|
@ -522,12 +569,8 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
})
|
||||
.ToList();
|
||||
|
||||
// if (data == null || data.Count == 0)
|
||||
// {
|
||||
// return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
// }
|
||||
|
||||
return Success(new { data = data, total = data.Count });
|
||||
return Success(new { data = data, total = count });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -576,6 +619,77 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// LV1_009 - รายการลงเวลาปฏิบัติงานที่ประมวลผลแล้ว (ADMIN)
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// </returns>
|
||||
/// <response code="200">เมื่อทำรายการสำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("time-record")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetTimeRecordAsync([Required] DateTime startDate, [Required] DateTime endDate, int page = 1, int pageSize = 10,string status = "NORMAL", string keyword = "")
|
||||
{
|
||||
if (startDate.Date > endDate.Date)
|
||||
{
|
||||
return Error(new Exception("วันเริ่มต้นต้องมีค่าน้อยกว่าหรือเท่ากับวันสิ้นสุด"), (int)StatusCodes.Status400BadRequest);
|
||||
}
|
||||
|
||||
var userId = UserId == null ? Guid.Empty : Guid.Parse(UserId);
|
||||
|
||||
// TODO : รอดุึงรอบที่ผูกกับ user
|
||||
var duty = await _dutyTimeRepository.GetDefaultAsync();
|
||||
|
||||
if (duty == null)
|
||||
{
|
||||
return Error(new Exception(GlobalMessages.DataNotFound), (int)StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
var checkin_base = DateTime.Parse($"{DateTime.Now.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}");
|
||||
var checkout_base = DateTime.Parse($"{DateTime.Now.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}");
|
||||
|
||||
var count = await _processUserTimeStampRepository.CountRecordAsync();
|
||||
|
||||
var imgUrl = $"{_configuration["MinIO:Endpoint"]}{_configuration["MinIO:BucketName"]}";
|
||||
var data = (await _processUserTimeStampRepository.GetTimeStampHistoryForAdminAsync(startDate, endDate, page, pageSize, keyword))
|
||||
.Select(d => new CheckInProcessHistoryForAdminDto
|
||||
{
|
||||
Id = d.Id,
|
||||
FullName = _userProfileRepository.GetUserFullName(d.KeycloakUserId),
|
||||
|
||||
CheckInDate = d.CheckIn.Date,
|
||||
CheckInTime = d.CheckIn.ToString("HH:mm:ss"),
|
||||
CheckInLocation = d.CheckInPOI,
|
||||
CheckInLat = d.CheckInLat,
|
||||
CheckInLon = d.CheckInLon,
|
||||
CheckInStatus = DateTime.Parse(d.CheckIn.ToString("yyyy-MM-dd HH:mm")) >
|
||||
DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.StartTimeMorning}") ?
|
||||
"LATE" :
|
||||
"NORMAL",
|
||||
//CheckInImageUrl = $"{imgUrl}/{d.CheckInImageUrl}",
|
||||
|
||||
CheckOutDate = d.CheckOut == null ? null : d.CheckOut.Value.Date,
|
||||
CheckOutTime = d.CheckOut == null ? "" : d.CheckOut.Value.ToString("HH:mm:ss"),
|
||||
CheckOutLocation = d.CheckOut == null ? "" : d.CheckOutPOI,
|
||||
CheckOutLat = d.CheckOut == null ? null : d.CheckOutLat,
|
||||
CheckOutLon = d.CheckOut == null ? null : d.CheckOutLon,
|
||||
CheckOutStatus = d.CheckOut == null ? null : DateTime.Parse(d.CheckOut.Value.ToString("yyyy-MM-dd HH:mm")) <
|
||||
DateTime.Parse($"{d.CheckIn.Date.ToString("yyyy-MM-dd")} {duty.EndTimeAfternoon}") ?
|
||||
"LATE" :
|
||||
"NORMAL",
|
||||
//CheckOutImageUrl = d.CheckOut == null ? "" : $"{imgUrl}/{d.CheckOutImageUrl}",
|
||||
})
|
||||
.Where(x => x.CheckInStatus == status || x.CheckOutStatus == status)
|
||||
.ToList();
|
||||
|
||||
|
||||
return Success(new { data = data, total = count });
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
namespace BMA.EHR.Leave.Service.DTOs.CheckIn
|
||||
{
|
||||
public class CheckInProcessHistoryForAdminDto
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.Empty;
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? CheckInDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
public string? CheckInTime { get; set; } = "00:00";
|
||||
|
||||
public string? CheckInLocation { get; set; } = string.Empty;
|
||||
|
||||
public double? CheckInLat { get; set; } = 0;
|
||||
|
||||
public double? CheckInLon { get; set; } = 0;
|
||||
|
||||
public string? CheckInStatus { get; set; } = string.Empty;
|
||||
|
||||
public DateTime? CheckOutDate { get; set; } = DateTime.MinValue;
|
||||
|
||||
public string? CheckOutTime { get; set; } = "00:00";
|
||||
|
||||
public string? CheckOutLocation { get; set; } = string.Empty;
|
||||
|
||||
public double? CheckOutLat { get; set; } = 0;
|
||||
|
||||
public double? CheckOutLon { get; set; } = 0;
|
||||
|
||||
public string? CheckOutStatus { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue