game workflow corrected
This commit is contained in:
@@ -88,10 +88,16 @@ export class DeckAggregate {
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
user!: UserAggregate | null;
|
||||
|
||||
isEditable() {
|
||||
isEditable(userId:string): boolean{
|
||||
// A deck is editable if the user is the creator
|
||||
return (userId: string) => {
|
||||
return this.user?.id.toString() === userId;
|
||||
};
|
||||
if (!this.user) {
|
||||
logError(`DeckAggregate.isEditable: User is null for deck id ${this.id}`);
|
||||
return false;
|
||||
}
|
||||
//if admin, always editable
|
||||
if (this.user?.isAdmin) {
|
||||
return true;
|
||||
}
|
||||
return this.user?.id.toString() === userId;;
|
||||
}
|
||||
}
|
||||
@@ -55,4 +55,8 @@ export class UserAggregate {
|
||||
|
||||
@Column({ type: 'timestamp', nullable: true })
|
||||
Orglogindate!: Date | null;
|
||||
|
||||
get isAdmin(): boolean {
|
||||
return this.state === UserState.ADMIN;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user