feat: add world travel database schema
This commit is contained in:
63
apps/api/src/world/entities/location-definition.entity.ts
Normal file
63
apps/api/src/world/entities/location-definition.entity.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
Index,
|
||||
OneToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { Character } from '../../characters/entities/character.entity';
|
||||
import { LocationConnection } from './location-connection.entity';
|
||||
|
||||
@Entity({ name: 'location_definitions' })
|
||||
@Index('IDX_location_definitions_key', ['key'], { unique: true })
|
||||
export class LocationDefinition {
|
||||
@PrimaryGeneratedColumn('uuid', { name: 'id' })
|
||||
id!: string;
|
||||
|
||||
@Column({ name: 'key', type: 'varchar', length: 100 })
|
||||
key!: string;
|
||||
|
||||
@Column({ name: 'name', type: 'varchar', length: 150 })
|
||||
name!: string;
|
||||
|
||||
@Column({ name: 'description', type: 'text' })
|
||||
description!: string;
|
||||
|
||||
@Column({ name: 'region_key', type: 'varchar', length: 100 })
|
||||
regionKey!: string;
|
||||
|
||||
@Column({ name: 'min_recommended_level', type: 'integer' })
|
||||
minRecommendedLevel!: number;
|
||||
|
||||
@Column({ name: 'max_recommended_level', type: 'integer' })
|
||||
maxRecommendedLevel!: number;
|
||||
|
||||
@Column({ name: 'danger_level', type: 'integer' })
|
||||
dangerLevel!: number;
|
||||
|
||||
@Column({ name: 'is_safe', type: 'boolean' })
|
||||
isSafe!: boolean;
|
||||
|
||||
@Column({ name: 'hunting_enabled', type: 'boolean' })
|
||||
huntingEnabled!: boolean;
|
||||
|
||||
@Column({ name: 'artwork_path', type: 'varchar', length: 255 })
|
||||
artworkPath!: string;
|
||||
|
||||
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
|
||||
createdAt!: Date;
|
||||
|
||||
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
|
||||
updatedAt!: Date;
|
||||
|
||||
@OneToMany(() => Character, (character) => character.currentLocation)
|
||||
characters!: Character[];
|
||||
|
||||
@OneToMany(() => LocationConnection, (connection) => connection.fromLocation)
|
||||
outgoingConnections!: LocationConnection[];
|
||||
|
||||
@OneToMany(() => LocationConnection, (connection) => connection.toLocation)
|
||||
incomingConnections!: LocationConnection[];
|
||||
}
|
||||
Reference in New Issue
Block a user