forked from noxious/server
Added logics for a* pathfinding , rotation calculation and anti cheat, npm update.
This commit is contained in:
@ -20,7 +20,7 @@ class ZoneRepository {
|
||||
}
|
||||
}
|
||||
|
||||
async getById(id: number): Promise<Zone | null> {
|
||||
async getById(id: number) {
|
||||
try {
|
||||
return await prisma.zone.findUnique({
|
||||
where: {
|
||||
@ -44,6 +44,32 @@ class ZoneRepository {
|
||||
throw new Error(`Failed to get zone by id: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
async getEventTiles(id: number) {
|
||||
try {
|
||||
return await prisma.zoneEventTile.findMany({
|
||||
where: {
|
||||
zoneId: id
|
||||
}
|
||||
})
|
||||
} catch (error: any) {
|
||||
// Handle error
|
||||
throw new Error(`Failed to get zone event tiles: ${error.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
async getObjects(id: number) {
|
||||
try {
|
||||
return await prisma.zoneObject.findMany({
|
||||
where: {
|
||||
zoneId: id
|
||||
}
|
||||
})
|
||||
} catch (error: any) {
|
||||
// Handle error
|
||||
throw new Error(`Failed to get zone objects: ${error.message}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default new ZoneRepository()
|
||||
|
Reference in New Issue
Block a user