Add Dna Id to table
This commit is contained in:
parent
3e8e461ebe
commit
27acadbb07
7 changed files with 1862 additions and 1 deletions
|
|
@ -40,6 +40,15 @@ namespace BMA.EHR.Domain.Models.Leave.TimeAttendants
|
|||
|
||||
public double? Longitude { get; set; } = 0.0;
|
||||
|
||||
public Guid? RootDnaId { get; set; }
|
||||
|
||||
public Guid? Child1DnaId { get; set; }
|
||||
|
||||
public Guid? Child2DnaId { get; set; }
|
||||
|
||||
public Guid? Child3DnaId { get; set; }
|
||||
|
||||
public Guid? Child4DnaId { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,16 @@ namespace BMA.EHR.Domain.Models.Leave.TimeAttendants
|
|||
public bool IsProcess { get; set; } = false;
|
||||
|
||||
[Comment("หมายเหตุ")]
|
||||
public string? Remark { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public Guid? RootDnaId { get; set; }
|
||||
|
||||
public Guid? Child1DnaId { get; set; }
|
||||
|
||||
public Guid? Child2DnaId { get; set; }
|
||||
|
||||
public Guid? Child3DnaId { get; set; }
|
||||
|
||||
public Guid? Child4DnaId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,5 +92,15 @@ namespace BMA.EHR.Domain.Models.Leave.TimeAttendants
|
|||
|
||||
public Guid? ProfileId { get; set; }
|
||||
public string? ProfileType { get; set; }
|
||||
|
||||
public Guid? RootDnaId { get; set; }
|
||||
|
||||
public Guid? Child1DnaId { get; set; }
|
||||
|
||||
public Guid? Child2DnaId { get; set; }
|
||||
|
||||
public Guid? Child3DnaId { get; set; }
|
||||
|
||||
public Guid? Child4DnaId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1578
BMA.EHR.Infrastructure/Migrations/LeaveDb/20250620072432_Add Dna Id to Leave Table.Designer.cs
generated
Normal file
1578
BMA.EHR.Infrastructure/Migrations/LeaveDb/20250620072432_Add Dna Id to Leave Table.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,184 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddDnaIdtoLeaveTable : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child1DnaId",
|
||||
table: "UserTimeStamps",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child2DnaId",
|
||||
table: "UserTimeStamps",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child3DnaId",
|
||||
table: "UserTimeStamps",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child4DnaId",
|
||||
table: "UserTimeStamps",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RootDnaId",
|
||||
table: "UserTimeStamps",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child1DnaId",
|
||||
table: "UserDutyTimes",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child2DnaId",
|
||||
table: "UserDutyTimes",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child3DnaId",
|
||||
table: "UserDutyTimes",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child4DnaId",
|
||||
table: "UserDutyTimes",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RootDnaId",
|
||||
table: "UserDutyTimes",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child1DnaId",
|
||||
table: "AdditionalCheckRequests",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child2DnaId",
|
||||
table: "AdditionalCheckRequests",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child3DnaId",
|
||||
table: "AdditionalCheckRequests",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "Child4DnaId",
|
||||
table: "AdditionalCheckRequests",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "RootDnaId",
|
||||
table: "AdditionalCheckRequests",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child1DnaId",
|
||||
table: "UserTimeStamps");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child2DnaId",
|
||||
table: "UserTimeStamps");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child3DnaId",
|
||||
table: "UserTimeStamps");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child4DnaId",
|
||||
table: "UserTimeStamps");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RootDnaId",
|
||||
table: "UserTimeStamps");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child1DnaId",
|
||||
table: "UserDutyTimes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child2DnaId",
|
||||
table: "UserDutyTimes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child3DnaId",
|
||||
table: "UserDutyTimes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child4DnaId",
|
||||
table: "UserDutyTimes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RootDnaId",
|
||||
table: "UserDutyTimes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child1DnaId",
|
||||
table: "AdditionalCheckRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child2DnaId",
|
||||
table: "AdditionalCheckRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child3DnaId",
|
||||
table: "AdditionalCheckRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Child4DnaId",
|
||||
table: "AdditionalCheckRequests");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RootDnaId",
|
||||
table: "AdditionalCheckRequests");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -754,6 +754,18 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
.HasColumnType("tinyint(1)")
|
||||
.HasComment("*ขอลงเวลาช่วงบ่าย");
|
||||
|
||||
b.Property<Guid?>("Child1DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child2DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child3DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child4DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("longtext")
|
||||
.HasComment("หมายเหตุในการการอนุมัติ/ไม่อนุมัติ");
|
||||
|
|
@ -823,6 +835,9 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
b.Property<string>("Prefix")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid?>("RootDnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext")
|
||||
|
|
@ -1199,6 +1214,18 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
.HasComment("PrimaryKey")
|
||||
.HasAnnotation("Relational:JsonPropertyName", "id");
|
||||
|
||||
b.Property<Guid?>("Child1DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child2DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child3DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child4DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(100)
|
||||
|
|
@ -1257,6 +1284,9 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
.HasColumnType("longtext")
|
||||
.HasComment("หมายเหตุ");
|
||||
|
||||
b.Property<Guid?>("RootDnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DutyTimeId");
|
||||
|
|
@ -1336,24 +1366,36 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
b.Property<string>("Child1")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid?>("Child1DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child1Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Child2")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid?>("Child2DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child2Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Child3")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid?>("Child3DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child3Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Child4")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid?>("Child4DnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("Child4Id")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
|
|
@ -1435,6 +1477,9 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
b.Property<string>("Root")
|
||||
.HasColumnType("longtext");
|
||||
|
||||
b.Property<Guid?>("RootDnaId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("RootId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
|
|
|
|||
|
|
@ -850,6 +850,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
ProfileId = profile.Id,
|
||||
ProfileType = profile.ProfileType,
|
||||
|
||||
RootDnaId = profile.RootDnaId,
|
||||
Child1DnaId = profile.Child1DnaId,
|
||||
Child2DnaId = profile.Child2DnaId,
|
||||
Child3DnaId = profile.Child3DnaId,
|
||||
Child4DnaId = profile.Child4DnaId,
|
||||
};
|
||||
|
||||
var startTime = "";
|
||||
|
|
@ -1691,6 +1697,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
|
||||
var old = await _userDutyTimeRepository.GetExist(req.ProfileId, req.EffectiveDate);
|
||||
|
||||
var profile = await _userProfileRepository.GetProfileByProfileIdAsync(req.ProfileId, AccessToken);
|
||||
if (profile == null)
|
||||
{
|
||||
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
|
||||
}
|
||||
|
||||
if (old != null)
|
||||
{
|
||||
return Error(new Exception("ไม่สามารถทำรายการได้ เนื่องจากมีการกำหนดรอบการทำงานในวันที่นี้ไว้แล้ว"), StatusCodes.Status400BadRequest);
|
||||
|
|
@ -1702,6 +1714,12 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
DutyTimeId = req.RoundId,
|
||||
EffectiveDate = req.EffectiveDate,
|
||||
Remark = req.Remark,
|
||||
|
||||
RootDnaId = profile.RootDnaId,
|
||||
Child1DnaId = profile.Child1DnaId,
|
||||
Child2DnaId = profile.Child2DnaId,
|
||||
Child3DnaId = profile.Child3DnaId,
|
||||
Child4DnaId = profile.Child4DnaId,
|
||||
};
|
||||
|
||||
await _userDutyTimeRepository.AddAsync(data);
|
||||
|
|
@ -1871,6 +1889,13 @@ namespace BMA.EHR.Leave.Service.Controllers
|
|||
POI = req.POI,
|
||||
Latitude = req.Latitude,
|
||||
Longitude = req.Longitude,
|
||||
|
||||
// add all Dna Id
|
||||
RootDnaId = profile.RootDnaId ?? Guid.Empty,
|
||||
Child1DnaId = profile.Child1DnaId ?? Guid.Empty,
|
||||
Child2DnaId = profile.Child2DnaId ?? Guid.Empty,
|
||||
Child3DnaId = profile.Child3DnaId ?? Guid.Empty,
|
||||
Child4DnaId = profile.Child4DnaId ?? Guid.Empty,
|
||||
};
|
||||
await _additionalCheckRequestRepository.AddAsync(request);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue