feat: add world travel database schema

This commit is contained in:
Bastian Wagner
2026-08-18 18:27:21 +02:00
parent 1210ba2d15
commit 492765d8ca
7 changed files with 399 additions and 0 deletions

View 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[];
}