updated appoint by permission

This commit is contained in:
Warunee Tamkoo 2024-11-05 10:31:52 +07:00
parent ad5c953aa8
commit ff2edc685c
3 changed files with 43 additions and 3 deletions

View file

@ -12,6 +12,7 @@ import {
Post,
Path,
Delete,
Query,
} from "tsoa";
import { setLogDataDiff } from "../interfaces/utils";
@ -42,11 +43,40 @@ export class AppointController extends Controller {
*
*/
@Get("")
async GetList(@Request() request: RequestWithUser) {
async GetList(
@Query() keyword: string = "",
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Request() request: RequestWithUser,
) {
await new permission().PermissionList(request, "SYS_PROBATION");
const _data = await new permission().PermissionOrgList(request, "SYS_PROBATION");
const conditions: any = {};
if (_data.root != undefined && _data.root != null && _data.root[0] != null) {
conditions.root = _data.root;
}
if (_data.child1 != undefined && _data.child1 != null && _data.child1[0] != null) {
conditions.child1 = _data.child1;
}
if (_data.child2 != undefined && _data.child2 != null && _data.child2[0] != null) {
conditions.child2 = _data.child2;
}
if (_data.child3 != undefined && _data.child3 != null && _data.child3[0] != null) {
conditions.child3 = _data.child3;
}
if (_data.child4 != undefined && _data.child4 != null && _data.child4[0] != null) {
conditions.child4 = _data.child4;
}
const appoint = await this.appointRepository.find({
where: { createdUserId: request.user.sub },
relations: ["personal"],
where: { personal: conditions },
});
return new HttpSuccess(appoint);