add parth admin ability

This commit is contained in:
AdisakKanthawilang 2024-09-09 15:43:51 +07:00
parent aa129dce2f
commit 7fc4d4c4f0
3 changed files with 32 additions and 5 deletions

View file

@ -66,7 +66,6 @@ export class ProfileAbilityController extends Controller {
@Path() abilityId: string,
@Request() req: RequestWithUser,
) {
const _record = await this.profileAbilityRepo.findOne({
where: { id: abilityId },
});

View file

@ -64,8 +64,8 @@ export class ProfileAbilityEmployeeController extends Controller {
return new HttpSuccess(getProfileAbilityId);
}
@Get("history/{abilityId}")
public async getProfileAbilityHistory(
@Get("admin/history/{abilityId}")
public async getProfileAdminAbilityHistory(
@Path() abilityId: string,
@Request() req: RequestWithUser,
) {
@ -87,6 +87,20 @@ export class ProfileAbilityEmployeeController extends Controller {
return new HttpSuccess(record);
}
@Get("history/{abilityId}")
public async getProfileAbilityHistory(
@Path() abilityId: string,
) {
const record = await this.profileAbilityHistoryRepo.find({
where: { profileAbilityId: abilityId },
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Post()
public async newProfileAbility(
@Request() req: RequestWithUser,

View file

@ -64,8 +64,8 @@ export class ProfileAbilityEmployeeTempController extends Controller {
return new HttpSuccess(getProfileAbilityId);
}
@Get("history/{abilityId}")
public async getProfileAbilityHistory(
@Get("admin/history/{abilityId}")
public async getProfileAdminAbilityHistory(
@Path() abilityId: string,
@Request() req: RequestWithUser,
) {
@ -83,6 +83,20 @@ export class ProfileAbilityEmployeeTempController extends Controller {
return new HttpSuccess(record);
}
@Get("history/{abilityId}")
public async getProfileAbilityHistory(
@Path() abilityId: string,
) {
const record = await this.profileAbilityHistoryRepo.find({
where: { profileAbilityId: abilityId },
order: { createdAt: "DESC" },
});
if (!record) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
}
return new HttpSuccess(record);
}
@Post()
public async newProfileAbility(
@Request() req: RequestWithUser,