Migrate + ปรับการแสดงผลจัดการรอบสอบแข่งขัน #11
All checks were successful
Build & Deploy on Dev / build (push) Successful in 48s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 48s
This commit is contained in:
parent
5752f35712
commit
853b5c59f6
7 changed files with 1671 additions and 2 deletions
|
|
@ -96,6 +96,9 @@ namespace BMA.EHR.Recruit.Controllers
|
|||
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
|
||||
|
||||
private string? RootDnaId => _httpContextAccessor?.HttpContext?.User?.FindFirst("orgRootDnaId")?.Value;
|
||||
|
||||
private string? token => _httpContextAccessor.HttpContext.Request.Headers["Authorization"];
|
||||
|
||||
#endregion
|
||||
|
|
@ -477,16 +480,20 @@ namespace BMA.EHR.Recruit.Controllers
|
|||
PaymentEndDate = req.PaymentEndDate,
|
||||
Note = req.Note,
|
||||
AnnouncementDate = req.AnnouncementDate,
|
||||
OrganizationId = req.rootDnaId,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedUserId = UserId ?? "",
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
};
|
||||
|
||||
var apiUrl = $"{_configuration["API"]}/org/find/head/officer";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||
var _res = await client.SendAsync(_req);
|
||||
var _result = await _res.Content.ReadAsStringAsync();
|
||||
|
|
@ -554,6 +561,9 @@ namespace BMA.EHR.Recruit.Controllers
|
|||
data.ExamDate = req.ExamDate;
|
||||
data.Note = req.Note;
|
||||
data.AnnouncementDate = req.AnnouncementDate;
|
||||
data.LastUpdatedAt = DateTime.Now;
|
||||
data.LastUpdateUserId = UserId ?? "";
|
||||
data.LastUpdateFullName = FullName ?? "System Administrator";
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
|
|
@ -644,7 +654,14 @@ namespace BMA.EHR.Recruit.Controllers
|
|||
{
|
||||
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
|
||||
}
|
||||
string role = jsonData["result"]?.ToString() ?? string.Empty;
|
||||
string rootDnaId = string.Empty;
|
||||
if (role != "OWNER")
|
||||
{
|
||||
rootDnaId = RootDnaId?.ToString() ?? "";
|
||||
}
|
||||
var data = await _context.RecruitImports.AsQueryable()
|
||||
.Where(x => string.IsNullOrEmpty(rootDnaId) || x.OrganizationId == Guid.Parse(rootDnaId))
|
||||
.Include(x => x.ImportFile)
|
||||
.Include(x => x.Recruits)
|
||||
.Include(x => x.ScoreImport)
|
||||
|
|
|
|||
1609
Migrations/20260610063317_update_RecruitImport_add_OrganizationId.Designer.cs
generated
Normal file
1609
Migrations/20260610063317_update_RecruitImport_add_OrganizationId.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Recruit.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class update_RecruitImport_add_OrganizationId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "OrganizationId",
|
||||
table: "RecruitImports",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
comment: "DnaId หน่วยงาน",
|
||||
collation: "ascii_general_ci");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OrganizationId",
|
||||
table: "RecruitImports");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -704,6 +704,10 @@ namespace BMA.EHR.Recruit.Migrations
|
|||
.HasColumnOrder(3)
|
||||
.HasComment("ครั้งที่");
|
||||
|
||||
b.Property<Guid?>("OrganizationId")
|
||||
.HasColumnType("char(36)")
|
||||
.HasComment("DnaId หน่วยงาน");
|
||||
|
||||
b.Property<DateTime?>("PaymentEndDate")
|
||||
.HasColumnType("datetime(6)")
|
||||
.HasColumnOrder(9)
|
||||
|
|
|
|||
|
|
@ -57,6 +57,9 @@ namespace BMA.EHR.Recruit.Models.Recruits
|
|||
public string? AuthName { get; set; }
|
||||
public string? AuthPosition { get; set; }
|
||||
|
||||
[Comment("DnaId หน่วยงาน")]
|
||||
public Guid? OrganizationId { get; set; }
|
||||
|
||||
public List<RecruitImportHistory> ImportHostories { get; set; } = new List<RecruitImportHistory>();
|
||||
|
||||
[Comment("รูป")]
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace BMA.EHR.Recruit.Services
|
|||
using (var client = new HttpClient())
|
||||
{
|
||||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", AccessToken.Replace("Bearer ", ""));
|
||||
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||
client.DefaultRequestHeaders.Add("api-key", _configuration["API_KEY"]);
|
||||
var req = await client.GetAsync(apiPath);
|
||||
var res = await req.Content.ReadAsStringAsync();
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -82,5 +82,10 @@ namespace BMA.EHR.Recruit.Requests.Recruits
|
|||
/// วันที่ประกาศผลสอบ
|
||||
/// </summary>
|
||||
public DateTime? AnnouncementDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// รหัส DNA หน่วยงาน
|
||||
/// </summary>
|
||||
public Guid? rootDnaId { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue