fix(portal): add missing drizzle-orm operators and fix staffId type
- Import lt, gt, ne from @groombook/db alongside existing eq/and - Add non-null assertion on appt.staffId since appointment always has staffId Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { Hono } from "hono";
|
import { Hono } from "hono";
|
||||||
import { zValidator } from "@hono/zod-validator";
|
import { zValidator } from "@hono/zod-validator";
|
||||||
import { z } from "zod/v3";
|
import { z } from "zod/v3";
|
||||||
import { and, eq, getDb, appointments, impersonationSessions, waitlistEntries } from "@groombook/db";
|
import { and, eq, lt, gt, ne, getDb, appointments, impersonationSessions, waitlistEntries } from "@groombook/db";
|
||||||
import type { AppEnv } from "../middleware/rbac.js";
|
import type { AppEnv } from "../middleware/rbac.js";
|
||||||
|
|
||||||
export const portalRouter = new Hono<AppEnv>();
|
export const portalRouter = new Hono<AppEnv>();
|
||||||
@@ -277,7 +277,7 @@ portalRouter.post(
|
|||||||
.from(appointments)
|
.from(appointments)
|
||||||
.where(
|
.where(
|
||||||
and(
|
and(
|
||||||
eq(appointments.staffId, appt.staffId),
|
eq(appointments.staffId, appt.staffId!),
|
||||||
lt(appointments.startTime, newEnd),
|
lt(appointments.startTime, newEnd),
|
||||||
gt(appointments.endTime, newStart),
|
gt(appointments.endTime, newStart),
|
||||||
ne(appointments.status, "cancelled"),
|
ne(appointments.status, "cancelled"),
|
||||||
|
|||||||
Reference in New Issue
Block a user