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,47 @@
import {
Column,
CreateDateColumn,
Entity,
JoinColumn,
ManyToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { LocationDefinition } from '../../world/entities/location-definition.entity';
@Entity({ name: 'characters' })
export class Character {
@PrimaryGeneratedColumn('uuid', { name: 'id' })
id!: string;
@Column({ name: 'name', type: 'varchar', length: 150 })
name!: string;
@Column({ name: 'level', type: 'integer' })
level!: number;
@Column({ name: 'experience', type: 'integer' })
experience!: number;
@Column({ name: 'base_hp', type: 'integer' })
baseHp!: number;
@Column({ name: 'base_attack', type: 'integer' })
baseAttack!: number;
@Column({ name: 'current_hp', type: 'integer' })
currentHp!: number;
@Column({ name: 'current_location_id', type: 'uuid' })
currentLocationId!: string;
@CreateDateColumn({ name: 'created_at', type: 'timestamptz' })
createdAt!: Date;
@UpdateDateColumn({ name: 'updated_at', type: 'timestamptz' })
updatedAt!: Date;
@ManyToOne(() => LocationDefinition, (location) => location.characters)
@JoinColumn({ name: 'current_location_id' })
currentLocation!: LocationDefinition;
}