feat: add world travel database schema
This commit is contained in:
47
apps/api/src/characters/entities/character.entity.ts
Normal file
47
apps/api/src/characters/entities/character.entity.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user