no message

This commit is contained in:
kittapath 2024-11-06 10:20:17 +07:00
parent b98b02ac98
commit e7728d71bd
8 changed files with 242 additions and 298 deletions

View file

@ -70,40 +70,25 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
// public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TRANSFER_RECEIVE");
var getPermission = await _permission.GetPermissionOrgAPIAsync("LIST", "SYS_TRANSFER_RECEIVE", UserId);
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
// var rootId = "";
// var child1Id = "";
// var child2Id = "";
// var child3Id = "";
// var child4Id = "";
// var apiUrl = $"{_configuration["API"]}/org/profile/keycloak/position";
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var _res = await client.SendAsync(_req);
// var _result = await _res.Content.ReadAsStringAsync();
// var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
// if (org == null || org.result == null)
// return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
// rootId = org.result.rootId == null ? "" : org.result.rootId;
// child1Id = org.result.child1Id == null ? "" : org.result.child1Id;
// child2Id = org.result.child2Id == null ? "" : org.result.child2Id;
// child3Id = org.result.child3Id == null ? "" : org.result.child3Id;
// child4Id = org.result.child4Id == null ? "" : org.result.child4Id;
// string?[] rootId = jsonData?.result?.rootId ?? null;
// string?[] child1Id = jsonData?.result?.child1Id ?? null;
// string?[] child2Id = jsonData?.result?.child2Id ?? null;
// string?[] child3Id = jsonData?.result?.child3Id ?? null;
// string?[] child4Id = jsonData?.result?.child4Id ?? null;
var placementReceives = await _context.PlacementReceives.AsQueryable()
// .Where(x => rootId == null ? true : rootId.Contains(x.rootOldId))
// .Where(x => child1Id == null ? true : child1Id.Contains(x.child1OldId))
// .Where(x => child2Id == null ? true : child2Id.Contains(x.child2OldId))
// .Where(x => child3Id == null ? true : child3Id.Contains(x.child3OldId))
// .Where(x => child4Id == null ? true : child4Id.Contains(x.child4OldId))
.OrderByDescending(x => x.CreatedAt)
// .Where(x => PlacementAdmin == true ? true : (rootId == "" ? true : (child1Id == "" ? x.rootId == rootId : (child2Id == "" ? x.child1Id == child1Id : (child3Id == "" ? x.child2Id == child2Id : (child4Id == "" ? x.child3Id == child3Id : x.child4Id == child4Id))))))
.Select(p => new
{
p.Id,