fix: resolve typecheck errors in seed scripts
Add non-null assertions for array indexing in prisma/seed.ts and scripts/seed-districts.ts to satisfy strict TypeScript checks. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -253,8 +253,8 @@ async function seedProperties(users: Awaited<ReturnType<typeof seedUsers>>) {
|
|||||||
const agents = await prisma.agent.findMany();
|
const agents = await prisma.agent.findMany();
|
||||||
|
|
||||||
for (let i = 0; i < sampleProperties.length; i++) {
|
for (let i = 0; i < sampleProperties.length; i++) {
|
||||||
const p = sampleProperties[i];
|
const p = sampleProperties[i]!;
|
||||||
const agent = agents[i % agents.length];
|
const agent = agents[i % agents.length]!
|
||||||
|
|
||||||
const property = await prisma.$executeRaw`
|
const property = await prisma.$executeRaw`
|
||||||
INSERT INTO "Property" (
|
INSERT INTO "Property" (
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ async function seedDistrictProperties() {
|
|||||||
|
|
||||||
for (const { district, wards } of districts) {
|
for (const { district, wards } of districts) {
|
||||||
const ward = wards[0];
|
const ward = wards[0];
|
||||||
const template = PROPERTY_TEMPLATES[created % PROPERTY_TEMPLATES.length];
|
const template = PROPERTY_TEMPLATES[created % PROPERTY_TEMPLATES.length]!;
|
||||||
const loc = coords[district] ?? { lat: 10.0, lng: 106.0 };
|
const loc = coords[district] ?? { lat: 10.0, lng: 106.0 };
|
||||||
// Small random offset so each property has unique coords
|
// Small random offset so each property has unique coords
|
||||||
const jitterLat = (Math.random() - 0.5) * 0.005;
|
const jitterLat = (Math.random() - 0.5) * 0.005;
|
||||||
|
|||||||
Reference in New Issue
Block a user