แก้ค้นหาประวัติ by token
This commit is contained in:
parent
ff0be7af48
commit
24c5cbef55
7 changed files with 8 additions and 8 deletions
|
|
@ -41,7 +41,7 @@ export class ProfileAddressController extends Controller {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
const getProfileAddress = await this.profileRepo.findOne({
|
const getProfileAddress = await this.profileRepo.findOne({
|
||||||
where: { id: request.user.sub },
|
where: { id: profile.id },
|
||||||
select: [
|
select: [
|
||||||
"id",
|
"id",
|
||||||
"registrationAddress",
|
"registrationAddress",
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export class ProfileCertificateController extends Controller {
|
||||||
private certificateRepo = AppDataSource.getRepository(ProfileCertificate);
|
private certificateRepo = AppDataSource.getRepository(ProfileCertificate);
|
||||||
private certificateHistoryRepo = AppDataSource.getRepository(ProfileCertificateHistory);
|
private certificateHistoryRepo = AppDataSource.getRepository(ProfileCertificateHistory);
|
||||||
|
|
||||||
@Get("{profileId}")
|
@Get("user")
|
||||||
public async getCertificateUser(@Request() request: { user: Record<string, any> }) {
|
public async getCertificateUser(@Request() request: { user: Record<string, any> }) {
|
||||||
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
|
|
|
||||||
|
|
@ -45,11 +45,11 @@ export class ProfileFamilyHistoryController extends Controller {
|
||||||
const family = await this.familyHistoryRepo.find({
|
const family = await this.familyHistoryRepo.find({
|
||||||
take: 1,
|
take: 1,
|
||||||
order: { lastUpdatedAt: "DESC" },
|
order: { lastUpdatedAt: "DESC" },
|
||||||
where: { id: profile.id },
|
where: { profileId: profile.id },
|
||||||
});
|
});
|
||||||
const children = await this.childrenRepo.find({
|
const children = await this.childrenRepo.find({
|
||||||
order: { createdAt: "ASC" },
|
order: { createdAt: "ASC" },
|
||||||
where: { id: profile.id },
|
where: { profileId: profile.id },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(
|
return new HttpSuccess(
|
||||||
family.length > 0
|
family.length > 0
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ export class ProfileFamilyMotherController extends Controller {
|
||||||
"motherLive",
|
"motherLive",
|
||||||
"profileId",
|
"profileId",
|
||||||
],
|
],
|
||||||
where: { id: profile.id },
|
where: { profileId: profile.id },
|
||||||
order: { lastUpdatedAt: "DESC" },
|
order: { lastUpdatedAt: "DESC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export class ProfileInsigniaController extends Controller {
|
||||||
insigniaType: true,
|
insigniaType: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
where: { id: profile.id },
|
where: { profileId: profile.id },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(record);
|
return new HttpSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export class ProfileLeaveController extends Controller {
|
||||||
}
|
}
|
||||||
const record = await this.leaveRepo.find({
|
const record = await this.leaveRepo.find({
|
||||||
relations: { leaveType: true },
|
relations: { leaveType: true },
|
||||||
where: { id: profile.id },
|
where: { profileId: profile.id },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(record);
|
return new HttpSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ export class ProfileNopaidController extends Controller {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
const lists = await this.nopaidRepository.find({
|
const lists = await this.nopaidRepository.find({
|
||||||
where: { id: profile.id },
|
where: { profileId: profile.id },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(lists);
|
return new HttpSuccess(lists);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue