Skip to content
Snippets Groups Projects
Commit 2835e383 authored by L4168's avatar L4168
Browse files

added ownership function

parent 43c291fb
No related branches found
No related tags found
3 merge requests!59Development to master,!44Development to testing,!41Draw update
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;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment