Renamed hair > characterHair
This commit is contained in:
parent
1017013032
commit
1839bd9a22
15
prisma/migrations/20241123222118_lol3/migration.sql
Normal file
15
prisma/migrations/20241123222118_lol3/migration.sql
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `hairId` on the `Character` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE `Character` DROP FOREIGN KEY `Character_hairId_fkey`;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE `Character` DROP COLUMN `hairId`,
|
||||
ADD COLUMN `characterHairId` INTEGER NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Character` ADD CONSTRAINT `Character_characterHairId_fkey` FOREIGN KEY (`characterHairId`) REFERENCES `CharacterHair`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
@ -68,12 +68,12 @@ model Character {
|
||||
positionX Int @default(0)
|
||||
positionY Int @default(0)
|
||||
rotation Int @default(0)
|
||||
zoneId Int @default(1)
|
||||
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
||||
characterTypeId Int?
|
||||
characterType CharacterType? @relation(fields: [characterTypeId], references: [id], onDelete: Cascade)
|
||||
hairId Int?
|
||||
hair CharacterHair? @relation(fields: [hairId], references: [id], onDelete: Cascade)
|
||||
characterHairId Int?
|
||||
characterHair CharacterHair? @relation(fields: [characterHairId], references: [id], onDelete: Cascade)
|
||||
zoneId Int @default(1)
|
||||
zone Zone @relation(fields: [zoneId], references: [id], onDelete: Cascade)
|
||||
chats Chat[]
|
||||
items CharacterItem[]
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ class CharacterRepository {
|
||||
sprite: true
|
||||
}
|
||||
},
|
||||
hair: {
|
||||
characterHair: {
|
||||
include: {
|
||||
sprite: true
|
||||
}
|
||||
@ -43,7 +43,7 @@ class CharacterRepository {
|
||||
sprite: true
|
||||
}
|
||||
},
|
||||
hair: {
|
||||
characterHair: {
|
||||
include: {
|
||||
sprite: true
|
||||
}
|
||||
@ -70,7 +70,7 @@ class CharacterRepository {
|
||||
sprite: true
|
||||
}
|
||||
},
|
||||
hair: {
|
||||
characterHair: {
|
||||
include: {
|
||||
sprite: true
|
||||
}
|
||||
@ -97,7 +97,7 @@ class CharacterRepository {
|
||||
sprite: true
|
||||
}
|
||||
},
|
||||
hair: {
|
||||
characterHair: {
|
||||
include: {
|
||||
sprite: true
|
||||
}
|
||||
|
@ -23,11 +23,11 @@ export class CharacterService {
|
||||
})
|
||||
}
|
||||
|
||||
async updateHair(characterId: number, hairId: number | null) {
|
||||
async updateHair(characterId: number, characterHairId: number | null) {
|
||||
await prisma.character.update({
|
||||
where: { id: characterId },
|
||||
data: {
|
||||
hairId
|
||||
characterHairId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import { CharacterService } from '../../services/characterService'
|
||||
|
||||
interface CharacterConnectPayload {
|
||||
characterId: number
|
||||
hairId?: number
|
||||
characterHairId?: number
|
||||
}
|
||||
|
||||
export default class CharacterConnectEvent {
|
||||
@ -20,7 +20,7 @@ export default class CharacterConnectEvent {
|
||||
this.socket.on('character:connect', this.handleCharacterConnect.bind(this))
|
||||
}
|
||||
|
||||
private async handleCharacterConnect({ characterId, hairId }: CharacterConnectPayload): Promise<void> {
|
||||
private async handleCharacterConnect({ characterId, characterHairId }: CharacterConnectPayload): Promise<void> {
|
||||
if (!this.socket.userId) {
|
||||
this.emitError('User not authenticated')
|
||||
return
|
||||
@ -34,7 +34,7 @@ export default class CharacterConnectEvent {
|
||||
|
||||
// Update hair
|
||||
const characterService = new CharacterService()
|
||||
await characterService.updateHair(characterId, hairId ?? null)
|
||||
await characterService.updateHair(characterId, characterHairId ?? null)
|
||||
|
||||
const character = await this.connectCharacter(characterId)
|
||||
if (!character) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user