6 changed files with 233 additions and 26 deletions
-
3package.json
-
29prisma/schema.prisma
-
71prisma/seed.ts
-
19src/routes/auth.ts
-
133src/routes/mobile.ts
-
4src/utils/helper.ts
@ -0,0 +1,71 @@ |
|||
import { PrismaClient } from "@prisma/client"; |
|||
const prisma = new PrismaClient(); |
|||
|
|||
async function main() { |
|||
const d1 = await prisma.measurement.upsert({ |
|||
where: { id: 1 }, |
|||
update: {}, |
|||
create: { |
|||
name: "测量数据1", |
|||
railId: 1, |
|||
bureau: "北京铁路局", |
|||
line: "京沪线", |
|||
section: "路段一", |
|||
direction: "上行", |
|||
leftPoints: '[{"x":43,"y":22}]', |
|||
rightPoints: '[{"x":43,"y":22}]', |
|||
}, |
|||
}); |
|||
const d2 = await prisma.measurement.upsert({ |
|||
where: { id: 2 }, |
|||
update: {}, |
|||
create: { |
|||
name: "测量数据2", |
|||
railId: 2, |
|||
bureau: "上海铁路局", |
|||
line: "京沪线", |
|||
section: "路段二", |
|||
direction: "下行", |
|||
leftPoints: '[{"x":43,"y":22}]', |
|||
rightPoints: '[{"x":43,"y":22}]', |
|||
}, |
|||
}); |
|||
const d3 = await prisma.measurement.upsert({ |
|||
where: { id: 3 }, |
|||
update: {}, |
|||
create: { |
|||
name: "测量数据3", |
|||
railId: 2, |
|||
bureau: "上海铁路局", |
|||
line: "京九线", |
|||
section: "路段三", |
|||
direction: "下行", |
|||
leftPoints: '[{"x":43,"y":22}]', |
|||
rightPoints: '[{"x":43,"y":22}]', |
|||
}, |
|||
}); |
|||
const d4 = await prisma.measurement.upsert({ |
|||
where: { id: 4 }, |
|||
update: {}, |
|||
create: { |
|||
name: "测量数据4", |
|||
railId: 3, |
|||
bureau: "南京铁路局", |
|||
line: "京九线", |
|||
section: "路段四", |
|||
direction: "上行", |
|||
leftPoints: '[{"x":43,"y":22}]', |
|||
rightPoints: '[{"x":43,"y":22}]', |
|||
}, |
|||
}); |
|||
console.log({ d1, d2, d3, d4 }); |
|||
} |
|||
|
|||
main() |
|||
.catch(e => { |
|||
console.error(e); |
|||
process.exit(1); |
|||
}) |
|||
.finally(async () => { |
|||
await prisma.$disconnect(); |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue