Improved folder and file structure, separated prisma schema into multiple ones, removed obsolete functions, worked on dynamic character sprite logics, general enhancements
This commit is contained in:
@ -45,25 +45,6 @@ class CharacterRepository {
|
||||
}
|
||||
}
|
||||
|
||||
async create(userId: number, name: string, role: 'player'): Promise<Character | null> {
|
||||
try {
|
||||
return await prisma.character.create({
|
||||
data: {
|
||||
userId,
|
||||
name,
|
||||
role,
|
||||
position_x: 0, // @TODO Set default registration values in the database
|
||||
position_y: 0, // @TODO Set default registration values in the database
|
||||
rotation: 0, // @TODO Set default registration values in the database
|
||||
zoneId: 1 // @TODO Set default registration values in the database
|
||||
}
|
||||
})
|
||||
} catch (error: any) {
|
||||
// Handle error
|
||||
throw new Error(`Failed to create character: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
async updatePosition(id: number, position_x: number, position_y: number): Promise<Character | null> {
|
||||
try {
|
||||
return await prisma.character.update({
|
||||
@ -81,19 +62,6 @@ class CharacterRepository {
|
||||
}
|
||||
}
|
||||
|
||||
async delete(id: number): Promise<Character | null> {
|
||||
try {
|
||||
return await prisma.character.delete({
|
||||
where: {
|
||||
id
|
||||
}
|
||||
})
|
||||
} catch (error: any) {
|
||||
// Handle error
|
||||
throw new Error(`Failed to delete character: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
async deleteByUserIdAndId(userId: number, characterId: number): Promise<Character | null> {
|
||||
try {
|
||||
return await prisma.character.delete({
|
||||
|
Reference in New Issue
Block a user