editable property added to deck short dto
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
||||
import { OrganizationAggregate } from '../Organization/OrganizationAggregate';
|
||||
import { UserAggregate } from '../User/UserAggregate';
|
||||
import { logError } from '../../Application/Services/Logger';
|
||||
|
||||
export enum Type {
|
||||
LUCK = 0,
|
||||
@@ -86,4 +87,11 @@ export class DeckAggregate {
|
||||
@ManyToOne(() => UserAggregate, { eager: false })
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
user!: UserAggregate | null;
|
||||
|
||||
isEditable() {
|
||||
// A deck is editable if the user is the creator
|
||||
return (userId: string) => {
|
||||
return this.user?.id.toString() === userId;
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user