Renamed folder utilities > application, added baseEntity class, updated baseRepo class, removed prisma helper

This commit is contained in:
2024-12-25 16:50:01 +01:00
parent f5a7a348e0
commit f4746722af
120 changed files with 423 additions and 378 deletions

View File

@ -1,4 +1,5 @@
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { User } from './user'
import { Zone } from './zone'
import { CharacterType } from './characterType'
@ -8,7 +9,7 @@ import { CharacterEquipment } from './characterEquipment'
import { Chat } from './chat'
@Entity()
export class Character {
export class Character extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,10 +1,11 @@
import { Entity, Enum, ManyToOne, PrimaryKey } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Character } from './character'
import { CharacterItem } from './characterItem'
import { CharacterEquipmentSlotType } from '#utilities/enums'
import { CharacterEquipmentSlotType } from '#application/enums'
@Entity()
export class CharacterEquipment {
export class CharacterEquipment extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,10 +1,11 @@
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Character } from './character'
import { Sprite } from './sprite'
import { CharacterGender } from '#utilities/enums'
import { CharacterGender } from '#application/enums'
@Entity()
export class CharacterHair {
export class CharacterHair extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,10 +1,11 @@
import { Collection, Entity, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Character } from './character'
import { Item } from './item'
import { CharacterEquipment } from './characterEquipment'
@Entity()
export class CharacterItem {
export class CharacterItem extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,10 +1,11 @@
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Character } from './character'
import { Sprite } from './sprite'
import { CharacterGender, CharacterRace } from '#utilities/enums'
import { CharacterGender, CharacterRace } from '#application/enums'
@Entity()
export class CharacterType {
export class CharacterType extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,9 +1,10 @@
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Character } from './character'
import { Zone } from './zone'
@Entity()
export class Chat {
export class Chat extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,10 +1,11 @@
import { Collection, Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Sprite } from './sprite'
import { CharacterItem } from './characterItem'
import { ItemType, ItemRarity } from '#utilities/enums'
import { ItemType, ItemRarity } from '#application/enums'
@Entity()
export class Item {
export class Item extends BaseEntity {
@PrimaryKey()
id!: string

View File

@ -1,9 +1,10 @@
import { randomUUID } from 'node:crypto'
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { ZoneObject } from './zoneObject'
@Entity()
export class MapObject {
export class MapObject extends BaseEntity {
@PrimaryKey()
id = randomUUID()

View File

@ -1,8 +1,9 @@
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { User } from './user'
@Entity()
export class PasswordResetToken {
export class PasswordResetToken extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,12 +1,13 @@
import { randomUUID } from 'node:crypto'
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { SpriteAction } from './spriteAction'
import { CharacterType } from './characterType'
import { CharacterHair } from './characterHair'
import { Item } from './item'
@Entity()
export class Sprite {
export class Sprite extends BaseEntity {
@PrimaryKey()
id = randomUUID()

View File

@ -1,9 +1,10 @@
import { randomUUID } from 'node:crypto'
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Sprite } from './sprite'
@Entity()
export class SpriteAction {
export class SpriteAction extends BaseEntity {
@PrimaryKey()
id = randomUUID()

View File

@ -1,8 +1,9 @@
import { randomUUID } from 'node:crypto'
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
@Entity()
export class Tile {
export class Tile extends BaseEntity {
@PrimaryKey()
id = randomUUID()

View File

@ -1,9 +1,10 @@
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Character } from './character'
import { PasswordResetToken } from './passwordResetToken'
@Entity()
export class User {
export class User extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,7 +1,8 @@
import { Entity, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
@Entity()
export class World {
export class World extends BaseEntity {
@PrimaryKey()
date = new Date()

View File

@ -1,4 +1,5 @@
import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { ZoneEffect } from './zoneEffect'
import { ZoneEventTile } from './zoneEventTile'
import { ZoneEventTileTeleport } from './zoneEventTileTeleport'
@ -7,7 +8,7 @@ import { Character } from './character'
import { Chat } from './chat'
@Entity()
export class Zone {
export class Zone extends BaseEntity {
@PrimaryKey()
id!: number

View File

@ -1,8 +1,9 @@
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Zone } from './zone'
@Entity()
export class ZoneEffect {
export class ZoneEffect extends BaseEntity {
@PrimaryKey()
id!: string

View File

@ -1,10 +1,11 @@
import { Entity, Enum, ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Zone } from './zone'
import { ZoneEventTileType } from '#utilities/enums'
import { ZoneEventTileType } from '#application/enums'
import { ZoneEventTileTeleport } from './zoneEventTileTeleport'
@Entity()
export class ZoneEventTile {
export class ZoneEventTile extends BaseEntity {
@PrimaryKey()
id!: string

View File

@ -1,10 +1,11 @@
import { randomUUID } from 'node:crypto'
import { Entity, ManyToOne, OneToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Zone } from './zone'
import { ZoneEventTile } from './ZoneEventTile'
import { ZoneEventTile } from './zoneEventTile'
@Entity()
export class ZoneEventTileTeleport {
export class ZoneEventTileTeleport extends BaseEntity {
@PrimaryKey()
id = randomUUID()

View File

@ -1,10 +1,11 @@
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core'
import { BaseEntity } from '#application/bases/baseEntity'
import { Zone } from './zone'
import { MapObject } from '#entities/mapObject'
//@TODO : Rename mapObject
@Entity()
export class ZoneObject {
export class ZoneObject extends BaseEntity {
@PrimaryKey()
id!: string