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