feat: secure admin user management
This commit is contained in:
@@ -3,9 +3,11 @@ import {
|
||||
BeforeInsert,
|
||||
Column,
|
||||
Entity,
|
||||
Index,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
RelationId,
|
||||
} from 'typeorm';
|
||||
import { EntityHelper } from 'src/utils/entity-helper';
|
||||
import { TeamRole } from 'src/team-roles/entities/team-roles.entity';
|
||||
@@ -29,6 +31,7 @@ export class Player extends EntityHelper {
|
||||
})
|
||||
teamRole?: TeamRole | null;
|
||||
|
||||
@Index('IDX_player_team_id')
|
||||
@ManyToOne(() => Team, {
|
||||
eager: true,
|
||||
})
|
||||
@@ -37,11 +40,15 @@ export class Player extends EntityHelper {
|
||||
@Column({ type: 'decimal', precision: 10, scale: 2, default: 0 })
|
||||
balance: number;
|
||||
|
||||
@Index('IDX_player_user_id')
|
||||
@ManyToOne(() => User, (user) => user.players, {
|
||||
eager: true,
|
||||
})
|
||||
user?: User | null;
|
||||
|
||||
@RelationId((player: Player) => player.user)
|
||||
userId?: number | null;
|
||||
|
||||
@OneToMany(() => Transaction, (transaction) => transaction.player)
|
||||
transactions: Transaction[];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user