แก้ค้นหาประวัติ by token

This commit is contained in:
Kittapath 2024-05-23 17:20:15 +07:00
parent ff0be7af48
commit 24c5cbef55
7 changed files with 8 additions and 8 deletions

View file

@ -41,7 +41,7 @@ export class ProfileAddressController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const getProfileAddress = await this.profileRepo.findOne({
where: { id: request.user.sub },
where: { id: profile.id },
select: [
"id",
"registrationAddress",

View file

@ -33,7 +33,7 @@ export class ProfileCertificateController extends Controller {
private certificateRepo = AppDataSource.getRepository(ProfileCertificate);
private certificateHistoryRepo = AppDataSource.getRepository(ProfileCertificateHistory);
@Get("{profileId}")
@Get("user")
public async getCertificateUser(@Request() request: { user: Record<string, any> }) {
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
if (!profile) {

View file

@ -45,11 +45,11 @@ export class ProfileFamilyHistoryController extends Controller {
const family = await this.familyHistoryRepo.find({
take: 1,
order: { lastUpdatedAt: "DESC" },
where: { id: profile.id },
where: { profileId: profile.id },
});
const children = await this.childrenRepo.find({
order: { createdAt: "ASC" },
where: { id: profile.id },
where: { profileId: profile.id },
});
return new HttpSuccess(
family.length > 0

View file

@ -50,7 +50,7 @@ export class ProfileFamilyMotherController extends Controller {
"motherLive",
"profileId",
],
where: { id: profile.id },
where: { profileId: profile.id },
order: { lastUpdatedAt: "DESC" },
});

View file

@ -47,7 +47,7 @@ export class ProfileInsigniaController extends Controller {
insigniaType: true,
},
},
where: { id: profile.id },
where: { profileId: profile.id },
});
return new HttpSuccess(record);
}

View file

@ -44,7 +44,7 @@ export class ProfileLeaveController extends Controller {
}
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { id: profile.id },
where: { profileId: profile.id },
});
return new HttpSuccess(record);
}

View file

@ -36,7 +36,7 @@ export class ProfileNopaidController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const lists = await this.nopaidRepository.find({
where: { id: profile.id },
where: { profileId: profile.id },
});
return new HttpSuccess(lists);
}