feat: add order field
This commit is contained in:
parent
aa8dcdaf86
commit
0bd2c1ecf2
11 changed files with 79 additions and 26 deletions
|
|
@ -209,8 +209,7 @@ export class UserController extends Controller {
|
|||
where: { id: userId },
|
||||
});
|
||||
|
||||
if (!record)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "userNotFound");
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "userNotFound");
|
||||
|
||||
return Object.assign(record, {
|
||||
profileImageUrl: await minio.presignedGetObject(
|
||||
|
|
@ -268,6 +267,7 @@ export class UserController extends Controller {
|
|||
firstName: body.firstName,
|
||||
lastName: body.lastName,
|
||||
requiredActions: ["UPDATE_PASSWORD"],
|
||||
enabled: rest.status !== "INACTIVE",
|
||||
});
|
||||
|
||||
if (!userId || typeof userId !== "string") {
|
||||
|
|
@ -288,6 +288,7 @@ export class UserController extends Controller {
|
|||
data: {
|
||||
id: userId,
|
||||
...rest,
|
||||
statusOrder: +(rest.status === "INACTIVE"),
|
||||
username,
|
||||
userRole: role.name,
|
||||
province: { connect: provinceId ? { id: provinceId } : undefined },
|
||||
|
|
@ -386,7 +387,7 @@ export class UserController extends Controller {
|
|||
}
|
||||
|
||||
if (body.username) {
|
||||
await editUser(userId, { username: body.username });
|
||||
await editUser(userId, { username: body.username, enabled: body.status !== "INACTIVE" });
|
||||
}
|
||||
|
||||
const { provinceId, districtId, subDistrictId, ...rest } = body;
|
||||
|
|
@ -415,6 +416,7 @@ export class UserController extends Controller {
|
|||
include: { province: true, district: true, subDistrict: true },
|
||||
data: {
|
||||
...rest,
|
||||
statusOrder: +(rest.status === "INACTIVE"),
|
||||
userRole,
|
||||
code:
|
||||
(lastUserOfType &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue