api history/user

This commit is contained in:
AdisakKanthawilang 2024-05-24 13:13:52 +07:00
parent 63d357ea30
commit 7b480b1247
2 changed files with 65 additions and 15 deletions

View file

@ -570,6 +570,31 @@ export class ProfileController extends Controller {
return new HttpSuccess(profile); return new HttpSuccess(profile);
} }
/**
* API
*
* @summary
*
* @param {string} id Id
*/
@Get("history/user")
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
const historyProfile = await this.profileHistoryRepo.find({
relations: {
posLevel: true,
posType: true,
},
where: { keycloak: request.user.sub },
order: {
createdAt:"ASC",
}
});
if (!historyProfile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
return new HttpSuccess(historyProfile);
}
/** /**
* API * API
* *

View file

@ -392,6 +392,31 @@ export class ProfileEmployeeController extends Controller {
return new HttpSuccess(profile); return new HttpSuccess(profile);
} }
/**
* API
*
* @summary
*
* @param {string} id Id
*/
@Get("history/user")
async getHistoryProfileByUser(@Request() request: RequestWithUser) {
const historyProfile = await this.profileHistoryRepo.find({
relations: {
posLevel: true,
posType: true,
},
where: { keycloak: request.user.sub },
order: {
createdAt: "ASC",
},
});
if (!historyProfile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
return new HttpSuccess(historyProfile);
}
/** /**
* API * API
* *