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 { import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm';
Entity,
Column,
PrimaryGeneratedColumn,
ManyToOne,
Timestamp,
} from 'typeorm';
import { Game_PersonEntity, GameEntity } from '../game/game.entity'; import { GameEntity } from '../game/game.entity';
import { FactionEntity } from '../faction/faction.entity'; import { FactionEntity } from '../faction/faction.entity';
@Entity('MapDrawing') @Entity('MapDrawing')
...@@ -25,27 +19,14 @@ export class MapDrawingEntity { ...@@ -25,27 +19,14 @@ export class MapDrawingEntity {
onDelete: 'CASCADE', onDelete: 'CASCADE',
}) })
gameId: GameEntity; gameId: GameEntity;
}
@Entity('Game_Person_MapDrawing')
export class Game_Person_MapDrawingEntity {
@PrimaryGeneratedColumn('uuid') GPmapDrawingId: string;
@Column({ type: 'timestamp' }) GPCTimeStamp: Timestamp;
@ManyToOne( async ownershipCheck(factionEntity, role) {
type => Game_PersonEntity, if (role === 'admin') {
game_person => game_person.gamepersonId, return factionEntity == this.faction;
{ } else {
onDelete: 'CASCADE', return this.faction && factionEntity.factionId === this.faction.factionId
}, ? true
) : false;
game_person: Game_PersonEntity; }
@ManyToOne( }
type => MapDrawingEntity,
map_drawing => map_drawing.mapDrawingId,
{
onDelete: 'CASCADE',
},
)
map_drawing: MapDrawingEntity;
} }
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