ปรับ relation

This commit is contained in:
Bright 2024-06-14 13:27:02 +07:00
parent bfe7daa63d
commit 7fca1e320b
4 changed files with 25 additions and 6 deletions

View file

@ -178,6 +178,25 @@ export class ChangePositionController extends Controller {
return new HttpSuccess({ data: changePosition, total });
}
/**
* API
*
* @summary (ADMIN)
*
*/
@Get("pending")
async getProfilePending() {
const profiles = await this.changePositionRepository.find({
relations: ["profileChangePosition"],
where: {
profileChangePosition: {
status: "PENDING"
}
}
});
return new HttpSuccess(profiles);
}
/**
* API
*

View file

@ -25,11 +25,11 @@ export class AuthRole extends EntityBase {
@OneToMany(() => AuthRoleAttr, (authRoleAttr) => authRoleAttr.authRoleAttrForRole)
authRoles: AuthRoleAttr[];
@OneToOne(() => PosMaster, (posMaster) => posMaster.authRole)
posMaster: PosMaster;
@OneToMany(() => PosMaster, (posMaster) => posMaster.authRole)
posMaster: PosMaster[];
@OneToOne(() => EmployeePosMaster, (posMasters) => posMasters.authRole)
posMasters: EmployeePosMaster;
@OneToMany(() => EmployeePosMaster, (posMasters) => posMasters.authRole)
posMasterEmp: EmployeePosMaster[];
}
export class CreateAuthRole {

View file

@ -180,7 +180,7 @@ export class EmployeePosMaster extends EntityBase {
})
authRoleId: string;
@OneToOne(() => AuthRole, (authRole) => authRole.posMasters)
@ManyToOne(() => AuthRole, (authRole) => authRole.posMasterEmp)
@JoinColumn({ name: "authRoleId" })
authRole: AuthRole;

View file

@ -179,7 +179,7 @@ export class PosMaster extends EntityBase {
})
authRoleId: string;
@OneToOne(() => AuthRole, (authRole) => authRole.posMaster)
@ManyToOne(() => AuthRole, (authRole) => authRole.posMaster)
@JoinColumn({ name: "authRoleId" })
authRole: AuthRole;