แก้ API อุทธรณ์/ร้องทุกข์ (USER/ADMIN)
This commit is contained in:
parent
a0008b6254
commit
426d064476
1 changed files with 76 additions and 1 deletions
|
|
@ -144,7 +144,7 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// รายละเอียดยื่นอุทธรณ์/ร้องทุกข์ (USER/ADMIN)
|
/// รายละเอียดยื่นอุทธรณ์/ร้องทุกข์ (USER)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <response code="200"></response>
|
/// <response code="200"></response>
|
||||||
|
|
@ -153,6 +153,81 @@ namespace BMA.EHR.DisciplineComplaint_Appeal.Service.Controllers
|
||||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
[HttpGet("{id:guid}")]
|
[HttpGet("{id:guid}")]
|
||||||
public async Task<ActionResult<ResponseObject>> GetByDiscipline(Guid id)
|
public async Task<ActionResult<ResponseObject>> GetByDiscipline(Guid id)
|
||||||
|
{
|
||||||
|
var _data = await _context.DisciplineComplaint_Appeals
|
||||||
|
.Include(x => x.DisciplineComplaint_Appeal_Docs)
|
||||||
|
.Include(x => x.DisciplineComplaint_Appeal_Historys)
|
||||||
|
.Select(x => new
|
||||||
|
{
|
||||||
|
Id = x.Id,
|
||||||
|
Title = x.Title,
|
||||||
|
Description = x.Description,
|
||||||
|
Status = x.Status,
|
||||||
|
Type = x.Type,
|
||||||
|
Year = x.Year,
|
||||||
|
CaseType = x.CaseType,
|
||||||
|
CaseNumber = x.CaseNumber,
|
||||||
|
Fullname = x.Fullname,
|
||||||
|
CitizenId = x.CitizenId,
|
||||||
|
ProfileId = x.ProfileId,
|
||||||
|
Oc = x.Oc,
|
||||||
|
Position = x.Position,
|
||||||
|
LastUpdatedAt = x.LastUpdatedAt,
|
||||||
|
HistoryStatus = x.DisciplineComplaint_Appeal_Historys.Select(p => new
|
||||||
|
{
|
||||||
|
Status = p.Status,
|
||||||
|
CreatedAt = p.CreatedAt,
|
||||||
|
CreatedFullName = p.CreatedFullName,
|
||||||
|
}),
|
||||||
|
DisciplineComplaint_Appeal_Docs = x.DisciplineComplaint_Appeal_Docs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
|
||||||
|
})
|
||||||
|
.Where(x => x.Id == id)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
if (_data == null)
|
||||||
|
return Error(new Exception(GlobalMessages.DataNotFound), StatusCodes.Status404NotFound);
|
||||||
|
var disciplineComplaint_Appeal_Docs = new List<dynamic>();
|
||||||
|
foreach (var doc in _data.DisciplineComplaint_Appeal_Docs)
|
||||||
|
{
|
||||||
|
var _doc = new
|
||||||
|
{
|
||||||
|
doc.Id,
|
||||||
|
doc.FileName,
|
||||||
|
PathName = await _documentService.ImagesPath(doc.Id)
|
||||||
|
};
|
||||||
|
disciplineComplaint_Appeal_Docs.Add(_doc);
|
||||||
|
}
|
||||||
|
var data = new
|
||||||
|
{
|
||||||
|
_data.Id,
|
||||||
|
_data.Title,
|
||||||
|
_data.Description,
|
||||||
|
_data.Status,
|
||||||
|
_data.Type,
|
||||||
|
_data.Year,
|
||||||
|
_data.CaseType,
|
||||||
|
_data.CaseNumber,
|
||||||
|
_data.Fullname,
|
||||||
|
_data.CitizenId,
|
||||||
|
_data.ProfileId,
|
||||||
|
_data.Oc,
|
||||||
|
_data.Position,
|
||||||
|
_data.LastUpdatedAt,
|
||||||
|
_data.HistoryStatus,
|
||||||
|
disciplineComplaint_Appeal_Docs,
|
||||||
|
};
|
||||||
|
return Success(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// รายละเอียดยื่นอุทธรณ์/ร้องทุกข์ (ADMIN)
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200"></response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("admin/{id:guid}")]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetByDisciplineByAdmin(Guid id)
|
||||||
{
|
{
|
||||||
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_DISCIPLINE_APPEAL");
|
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_DISCIPLINE_APPEAL");
|
||||||
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue