Add editable project floors and rooms
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { asc, eq } from "drizzle-orm";
|
||||
import { and, asc, eq } from "drizzle-orm";
|
||||
import type { AppDatabase } from "../database-context.js";
|
||||
import { rooms } from "../schema/rooms.js";
|
||||
|
||||
@@ -13,4 +13,12 @@ export class RoomRepository {
|
||||
.where(eq(rooms.projectId, projectId))
|
||||
.orderBy(asc(rooms.roomNumber), asc(rooms.roomName));
|
||||
}
|
||||
|
||||
async findById(projectId: string, roomId: string) {
|
||||
return this.database
|
||||
.select()
|
||||
.from(rooms)
|
||||
.where(and(eq(rooms.projectId, projectId), eq(rooms.id, roomId)))
|
||||
.get() ?? null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user