Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f6b438d2c7 |
+2
-57
@@ -270,10 +270,6 @@ const medicalAlertPool: MedicalAlert[] = [
|
|||||||
{ id: "", type: "other", description: "Seizure history — avoid flashing lights", severity: "high" },
|
{ id: "", type: "other", description: "Seizure history — avoid flashing lights", severity: "high" },
|
||||||
{ id: "", type: "other", description: "Luxating patella — short walks only", severity: "medium" },
|
{ id: "", type: "other", description: "Luxating patella — short walks only", severity: "medium" },
|
||||||
{ id: "", type: "other", description: "Ear infections — dry thoroughly after bath", severity: "low" },
|
{ id: "", type: "other", description: "Ear infections — dry thoroughly after bath", severity: "low" },
|
||||||
{ id: "", type: "behavioral", description: "Anxiety — calm environment preferred", severity: "low" },
|
|
||||||
{ id: "", type: "behavioral", description: "Fear-based aggression — approach with caution", severity: "high" },
|
|
||||||
{ id: "", type: "skin", description: "Contact dermatitis — avoid harsh chemicals", severity: "medium" },
|
|
||||||
{ id: "", type: "skin", description: "Hot spots — monitor and report any worsening", severity: "high" },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const preferredCutPool: string[] = [
|
const preferredCutPool: string[] = [
|
||||||
@@ -609,45 +605,8 @@ async function seedUatStaffAccounts(db: ReturnType<typeof drizzle>) {
|
|||||||
.from(schema.pets)
|
.from(schema.pets)
|
||||||
.where(eq(schema.pets.id, pet.id))
|
.where(eq(schema.pets.id, pet.id))
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
|
||||||
if (existing) {
|
if (existing) {
|
||||||
// Upsert so extended fields are always populated on re-runs
|
console.log(`✓ UAT Pet '${existing.name}' already exists — skipping`);
|
||||||
await db.insert(schema.pets)
|
|
||||||
.values({
|
|
||||||
id: pet.id,
|
|
||||||
clientId: uatCustomerClientId,
|
|
||||||
name: pet.name,
|
|
||||||
species: pet.species,
|
|
||||||
breed: pet.breed,
|
|
||||||
weightKg: pet.weight,
|
|
||||||
dateOfBirth: new Date(`${pet.dob}T00:00:00Z`),
|
|
||||||
image: pet.image,
|
|
||||||
temperamentScore: randInt(1, 5),
|
|
||||||
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
|
||||||
medicalAlerts: [],
|
|
||||||
preferredCuts: pickN(preferredCutPool, randInt(1, 2)),
|
|
||||||
coatType: pick(coatTypePool),
|
|
||||||
petSizeCategory: pick(petSizeCategoryPool),
|
|
||||||
})
|
|
||||||
.onConflictDoUpdate({
|
|
||||||
target: schema.pets.id,
|
|
||||||
set: {
|
|
||||||
clientId: uatCustomerClientId,
|
|
||||||
name: pet.name,
|
|
||||||
species: pet.species,
|
|
||||||
breed: pet.breed,
|
|
||||||
weightKg: pet.weight,
|
|
||||||
dateOfBirth: new Date(`${pet.dob}T00:00:00Z`),
|
|
||||||
image: pet.image,
|
|
||||||
temperamentScore: randInt(1, 5),
|
|
||||||
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
|
||||||
medicalAlerts: [],
|
|
||||||
preferredCuts: pickN(preferredCutPool, randInt(1, 2)),
|
|
||||||
coatType: pick(coatTypePool),
|
|
||||||
petSizeCategory: pick(petSizeCategoryPool),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
console.log(`✓ Upserted UAT pet '${pet.name}' with extended fields`);
|
|
||||||
} else {
|
} else {
|
||||||
await db.insert(schema.pets).values({
|
await db.insert(schema.pets).values({
|
||||||
id: pet.id,
|
id: pet.id,
|
||||||
@@ -658,14 +617,8 @@ async function seedUatStaffAccounts(db: ReturnType<typeof drizzle>) {
|
|||||||
weightKg: pet.weight,
|
weightKg: pet.weight,
|
||||||
dateOfBirth: new Date(`${pet.dob}T00:00:00Z`),
|
dateOfBirth: new Date(`${pet.dob}T00:00:00Z`),
|
||||||
image: pet.image,
|
image: pet.image,
|
||||||
temperamentScore: randInt(1, 5),
|
|
||||||
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
|
||||||
medicalAlerts: [],
|
|
||||||
preferredCuts: pickN(preferredCutPool, randInt(1, 2)),
|
|
||||||
coatType: pick(coatTypePool),
|
|
||||||
petSizeCategory: pick(petSizeCategoryPool),
|
|
||||||
});
|
});
|
||||||
console.log(`✓ Created UAT pet '${pet.name}' with extended fields`);
|
console.log(`✓ Created UAT pet '${pet.name}'`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1105,14 +1058,6 @@ async function seed() {
|
|||||||
temperamentScore: randInt(1, 5),
|
temperamentScore: randInt(1, 5),
|
||||||
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
temperamentFlags: pickN(temperamentFlagPool, randInt(1, 3)),
|
||||||
medicalAlerts: (() => {
|
medicalAlerts: (() => {
|
||||||
// Deterministic alerts for UAT AC pets
|
|
||||||
if (uc.petName === "TestCooper") {
|
|
||||||
return pickN(medicalAlertPool.filter((a) => a.type === "behavioral"), 1).map((a) => ({ ...a, id: uuid() }));
|
|
||||||
}
|
|
||||||
if (uc.petName === "TestRocky") {
|
|
||||||
return pickN(medicalAlertPool.filter((a) => a.type === "skin"), 1).map((a) => ({ ...a, id: uuid() }));
|
|
||||||
}
|
|
||||||
// Other UAT pets: random
|
|
||||||
if (rand() < 0.3) {
|
if (rand() < 0.3) {
|
||||||
const count = rand() < 0.7 ? 1 : 2;
|
const count = rand() < 0.7 ? 1 : 2;
|
||||||
return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() }));
|
return pickN(medicalAlertPool, count).map((a) => ({ ...a, id: uuid() }));
|
||||||
|
|||||||
Reference in New Issue
Block a user