Initial commit: LACA parking management system

This commit is contained in:
2025-08-13 10:05:36 +07:00
commit 8b07467b61
275 changed files with 66828 additions and 0 deletions

39
backend/prisma/tenant.ts Normal file
View File

@@ -0,0 +1,39 @@
import { PrismaClient } from '@prisma/client';
import { hashSync } from 'bcrypt';
import { data as tenants } from './dump/tenant.json';
import { data as slots } from './dump/slot.json';
async function main(prisma: PrismaClient) {
console.log(`seed tenant data: ${tenants}`);
await prisma.tenant.create({
data: {
email: tenants[0].email,
phone: tenants[0].phone,
username: tenants[0].username,
password: hashSync(tenants[0].password, 10),
first_name: tenants[0].first_name,
last_name: tenants[0].last_name,
Slots: {
create: slots.map((e) => ({
lat: e.lat,
lng: e.lng,
address: e.address,
city: e.city,
district: e.district,
ward: e.ward,
directions: e.directions,
name: e.name,
total: 5,
empty: 0,
})),
},
},
include: {
Slots: true,
},
});
}
export default main;