feat: secure admin user management

This commit is contained in:
Bastian Wagner
2026-07-31 23:37:54 +02:00
parent 4105460400
commit e6acfdcac7
22 changed files with 1598 additions and 148 deletions

View File

@@ -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[];