Added better security for character loading, worked on zone joining and moving logic
This commit is contained in:
@ -16,6 +16,20 @@ class CharacterRepository {
|
||||
}
|
||||
}
|
||||
|
||||
async getByUserAndId(userId: number, characterId: number): Promise<Character | null> {
|
||||
try {
|
||||
return await prisma.character.findFirst({
|
||||
where: {
|
||||
userId,
|
||||
id: characterId,
|
||||
},
|
||||
});
|
||||
} catch (error: any) {
|
||||
// Handle error
|
||||
throw new Error(`Failed to get character by user ID and character ID: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
async getById(id: number): Promise<Character | null> {
|
||||
try {
|
||||
return await prisma.character.findUnique({
|
||||
|
Reference in New Issue
Block a user