Added logics for saving zone updates

This commit is contained in:
2024-06-13 23:02:32 +02:00
parent aef82affc5
commit 890a4bdb88
5 changed files with 82 additions and 9 deletions

View File

@ -48,6 +48,25 @@ class ZoneRepository {
throw new Error(`Failed to create zone: ${error.message}`);
}
}
async update(id: number, name: string, width: number, height: number, tiles: any): Promise<Zone> {
try {
return await prisma.zone.update({
where: {
id: id
},
data: {
name: name,
width: width,
height: height,
tiles: tiles
}
});
} catch (error: any) {
// Handle error
throw new Error(`Failed to update zone: ${error.message}`);
}
}
}
export default new ZoneRepository;