add permission brother

This commit is contained in:
kittapath 2025-12-12 01:37:44 +07:00
parent 2cb7a9ab07
commit c6fabbcf16
2 changed files with 64 additions and 49 deletions

View file

@ -1551,7 +1551,7 @@ export class DevelopmentController extends Controller {
if (!development) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงการ/หลักสูตรการฝึกอบรมนี้");
}
Object.assign(development, { ...requestBody});
Object.assign(development, { ...requestBody });
development.lastUpdateUserId = request.user.sub;
development.lastUpdateFullName = request.user.name;
development.lastUpdatedAt = new Date();
@ -2085,7 +2085,7 @@ export class DevelopmentController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `development.child1DnaId IN (:...child1)`
: `development.child1DnaId is null`
: `development.child1DnaId is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _data.child1,
@ -2130,19 +2130,15 @@ export class DevelopmentController extends Controller {
"development.child2",
"development.child3",
"development.child4",
])
]);
if (sortBy) {
query = query.orderBy(
`development.${sortBy}`,
descending ? "DESC" : "ASC"
);
}else{
query = query.orderBy("development.year", "DESC")
.addOrderBy("development.createdAt", "DESC")
}
if (sortBy) {
query = query.orderBy(`development.${sortBy}`, descending ? "DESC" : "ASC");
} else {
query = query.orderBy("development.year", "DESC").addOrderBy("development.createdAt", "DESC");
}
const [development, total] = await query
const [development, total] = await query
.skip((page - 1) * pageSize)
.take(pageSize)
.getManyAndCount();
@ -2632,12 +2628,13 @@ export class DevelopmentController extends Controller {
});
const developmentAddresss = await this.developmentAddresssRepository.find({
where: { developmentId: id}
})
where: { developmentId: id },
});
const places = developmentAddresss
.map(addr =>
`- ${addr.address}, ${addr.addressType === "IN_COUNTRY" ? addr.provinceName : addr.country} (${addr.addressType === "IN_COUNTRY" ? "ภายในประเทศ" : "ภายนอกประเทศ"})`
.map(
(addr) =>
`- ${addr.address}, ${addr.addressType === "IN_COUNTRY" ? addr.provinceName : addr.country} (${addr.addressType === "IN_COUNTRY" ? "ภายในประเทศ" : "ภายนอกประเทศ"})`,
)
.filter(Boolean)
.join("\n");
@ -2768,7 +2765,7 @@ export class DevelopmentController extends Controller {
techniqueActuals.length > 0 && dev20Lists.some((item) => techniqueActuals.includes(item));
isDevelopment10 =
techniqueActuals.length > 0 && dev10Lists.some((item) => techniqueActuals.includes(item));
if (x.type == "OFFICER") {
await new CallAPI()
.PostData(request, "/org/profile/development", {