1
0
forked from noxious/server

Added ORM entities

This commit is contained in:
2024-12-24 22:08:08 +01:00
parent 40c24cee10
commit 8980691409
15 changed files with 403 additions and 1 deletions

27
src/entities/user.ts Normal file
View File

@ -0,0 +1,27 @@
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
import { Character } from './character';
import { PasswordResetToken } from './passwordResetToken';
@Entity()
export class User {
@PrimaryKey()
id!: number;
@Property({ unique: true })
username!: string;
@Property({ unique: true })
email!: string;
@Property()
password!: string;
@Property()
online = false;
@OneToMany(() => Character, character => character.user)
characters = new Collection<Character>(this);
@OneToMany(() => PasswordResetToken, token => token.user)
passwordResetTokens = new Collection<PasswordResetToken>(this);
}