diff --git a/src/draw/coordinate.entity.ts b/src/draw/coordinate.entity.ts index ef5447f61cfd1dd07d1f81a8ee1fce8e8256da2a..049f41b8e63af083890411ad16e895c2183384dd 100644 --- a/src/draw/coordinate.entity.ts +++ b/src/draw/coordinate.entity.ts @@ -1,12 +1,6 @@ -import { - Entity, - Column, - PrimaryGeneratedColumn, - ManyToOne, - Timestamp, -} from 'typeorm'; +import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm'; -import { Game_PersonEntity, GameEntity } from '../game/game.entity'; +import { GameEntity } from '../game/game.entity'; import { FactionEntity } from '../faction/faction.entity'; @Entity('MapDrawing') @@ -25,27 +19,14 @@ export class MapDrawingEntity { onDelete: 'CASCADE', }) gameId: GameEntity; -} - -@Entity('Game_Person_MapDrawing') -export class Game_Person_MapDrawingEntity { - @PrimaryGeneratedColumn('uuid') GPmapDrawingId: string; - @Column({ type: 'timestamp' }) GPCTimeStamp: Timestamp; - @ManyToOne( - type => Game_PersonEntity, - game_person => game_person.gamepersonId, - { - onDelete: 'CASCADE', - }, - ) - game_person: Game_PersonEntity; - @ManyToOne( - type => MapDrawingEntity, - map_drawing => map_drawing.mapDrawingId, - { - onDelete: 'CASCADE', - }, - ) - map_drawing: MapDrawingEntity; + async ownershipCheck(factionEntity, role) { + if (role === 'admin') { + return factionEntity == this.faction; + } else { + return this.faction && factionEntity.factionId === this.faction.factionId + ? true + : false; + } + } }