ifms-printer-manager/prisma/seed.ts

126 lines
2.4 KiB
TypeScript
Raw Normal View History

2023-06-15 12:04:59 +00:00
import { PrismaClient } from '@prisma/client'
export const prisma = new PrismaClient()
async function main() {
2023-06-21 17:48:40 +00:00
console.log('Seeding printers...')
console.log('Seeding subnets...')
await prisma.network.createMany({
data: [
{
shortName: 'RT1',
name: 'Reitoria',
cidr: '10.0.0.0/21'
},
{
shortName: 'RT2',
name: 'Reitoria 2',
cidr: '10.1.0.0/21'
},
{
shortName: 'AQ',
name: 'Aquidauana',
cidr: '10.2.0.0/21'
},
{
shortName: 'CG',
name: 'Campo Grande',
cidr: '10.3.0.0/21'
},
{
shortName: 'CB',
name: 'Corumbá',
cidr: '10.4.0.0/21'
},
{
shortName: 'CX',
name: 'Coxim',
cidr: '10.5.0.0/21'
},
{
shortName: 'NA',
name: 'Nova Andradina',
cidr: '10.6.0.0/21'
},
{
shortName: 'PP',
name: 'Ponta Porã',
cidr: '10.7.0.0/21'
},
{
shortName: 'TL',
name: 'Três Lagoas',
cidr: '10.8.0.0/21'
},
{
shortName: 'JD',
name: 'Jardim',
cidr: '10.9.0.0/21'
},
{
shortName: 'NV',
name: 'Naviraí',
cidr: '10.10.0.0/21'
},
{
shortName: 'DR',
name: 'Dourados',
cidr: '10.11.0.0/21'
}
],
skipDuplicates: true
})
2023-06-15 12:04:59 +00:00
await prisma.printer.createMany({
data: [
2023-06-15 19:55:09 +00:00
{
2023-06-20 13:13:28 +00:00
friendlyName: 'P04',
2023-06-15 19:55:09 +00:00
ip: '10.7.0.134',
2023-06-20 13:35:32 +00:00
model: 'ECOSYS M3655idn',
2023-06-21 17:48:40 +00:00
serialNumber: 'R4P1478461',
networkId: 8
2023-06-15 19:55:09 +00:00
},
{
2023-06-20 13:13:28 +00:00
friendlyName: 'P05',
2023-06-15 19:55:09 +00:00
ip: '10.7.0.135',
2023-06-20 13:35:32 +00:00
model: 'ECOSYS M2040dn',
2023-06-21 17:48:40 +00:00
serialNumber: 'VR91483974',
networkId: 8
2023-06-15 19:55:09 +00:00
},
{
2023-06-20 13:13:28 +00:00
friendlyName: 'P06',
2023-06-15 19:55:09 +00:00
ip: '10.7.0.136',
2023-06-20 13:35:32 +00:00
model: 'ECOSYS M2040dn',
2023-06-21 17:48:40 +00:00
serialNumber: 'VR91586433',
networkId: 8
2023-06-15 19:55:09 +00:00
},
{
2023-06-20 13:13:28 +00:00
friendlyName: 'P07',
2023-06-15 19:55:09 +00:00
ip: '10.7.0.137',
2023-06-20 13:35:32 +00:00
model: 'ECOSYS M2040dn',
2023-06-21 17:48:40 +00:00
serialNumber: 'VR91586432',
networkId: 8
2023-06-15 19:55:09 +00:00
},
{
2023-06-20 13:13:28 +00:00
friendlyName: 'P08',
2023-06-15 19:55:09 +00:00
ip: '10.7.0.138',
2023-06-20 13:35:32 +00:00
model: 'ECOSYS P6235cdn',
2023-06-21 17:48:40 +00:00
serialNumber: 'RCG0304510',
networkId: 8
2023-06-15 19:55:09 +00:00
}
2023-06-15 12:04:59 +00:00
]
})
}
main()
.then(() => {
prisma.$disconnect()
})
.catch(error => {
console.error(error)
prisma.$disconnect()
process.exit(1)
})