forked from noxious/server
Added ORM entities
This commit is contained in:
33
src/entities/sprite.ts
Normal file
33
src/entities/sprite.ts
Normal file
@ -0,0 +1,33 @@
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { SpriteAction } from './spriteAction';
|
||||
import { CharacterType } from './characterType';
|
||||
import { CharacterHair } from './characterHair';
|
||||
import { Item } from './item';
|
||||
|
||||
@Entity()
|
||||
export class Sprite {
|
||||
@PrimaryKey()
|
||||
id = randomUUID();
|
||||
|
||||
@Property()
|
||||
name!: string;
|
||||
|
||||
@Property()
|
||||
createdAt = new Date();
|
||||
|
||||
@Property()
|
||||
updatedAt = new Date();
|
||||
|
||||
@OneToMany(() => SpriteAction, action => action.sprite)
|
||||
spriteActions = new Collection<SpriteAction>(this);
|
||||
|
||||
@OneToMany(() => CharacterType, type => type.sprite)
|
||||
characterTypes = new Collection<CharacterType>(this);
|
||||
|
||||
@OneToMany(() => CharacterHair, hair => hair.sprite)
|
||||
characterHairs = new Collection<CharacterHair>(this);
|
||||
|
||||
@OneToMany(() => Item, item => item.sprite)
|
||||
items = new Collection<Item>(this);
|
||||
}
|
Reference in New Issue
Block a user