Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 03f1dd3bfa | |||
| a14bb5e17d |
@@ -0,0 +1,14 @@
|
||||
-- Migration: 0035_add_short_to_coat_type_enum.sql
|
||||
-- GRO-1953: Adds missing "short" value to the coat_type enum so that seed data
|
||||
-- (which uses coatTypePool including "short") can be inserted without error.
|
||||
--
|
||||
-- The seed file defines coatTypePool as:
|
||||
-- ["short", "medium", "long", "double", "wire", "silky", "curly", "hairless"]
|
||||
-- but migration 0031 created the enum without "short", causing:
|
||||
-- PostgresError: invalid input value for enum coat_type: "short"
|
||||
|
||||
BEGIN;
|
||||
|
||||
ALTER TYPE "coat_type" ADD VALUE IF NOT EXISTS 'short';
|
||||
|
||||
COMMIT;
|
||||
@@ -246,6 +246,13 @@
|
||||
"when": 1751140800000,
|
||||
"tag": "0034_extend_pet_profile_columns",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 35,
|
||||
"version": "7",
|
||||
"when": 1751140800000,
|
||||
"tag": "0035_add_short_to_coat_type_enum",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
+6
-5
@@ -12,6 +12,7 @@ import {
|
||||
appointments,
|
||||
staff,
|
||||
services,
|
||||
sql,
|
||||
} from "@groombook/db";
|
||||
import type { AppEnv } from "../middleware/rbac.js";
|
||||
import {
|
||||
@@ -153,11 +154,11 @@ petsRouter.get("/:id/profile-summary", async (c) => {
|
||||
.limit(10);
|
||||
|
||||
// Visit count (completed appointments)
|
||||
const [{ count }] = await db
|
||||
.select({ count: appointments.id })
|
||||
const [countRow] = await db
|
||||
.select({ count: sql<number>`count(*)::int` })
|
||||
.from(appointments)
|
||||
.where(and(eq(appointments.petId, petId), eq(appointments.status, "completed")))
|
||||
.limit(1);
|
||||
.where(and(eq(appointments.petId, petId), eq(appointments.status, "completed")));
|
||||
const visitCount = countRow?.count ?? 0;
|
||||
|
||||
// Upcoming appointment (next scheduled or confirmed)
|
||||
const [upcoming] = await db
|
||||
@@ -195,7 +196,7 @@ petsRouter.get("/:id/profile-summary", async (c) => {
|
||||
serviceName: h.serviceName,
|
||||
staffName: h.staffName,
|
||||
})),
|
||||
visitCount: Number(count ?? 0),
|
||||
visitCount,
|
||||
upcomingAppointment: upcoming
|
||||
? {
|
||||
id: upcoming.id,
|
||||
|
||||
Reference in New Issue
Block a user