first commit

This commit is contained in:
Mathieu BOURBON
2026-04-18 16:24:44 +02:00
commit fbb6138c28
72 changed files with 3509 additions and 0 deletions

62
prisma/seed.ts Normal file
View File

@@ -0,0 +1,62 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
// Réseau d'exemple
const network = await prisma.network.upsert({
where: { cidr: '192.168.1.0/24' },
update: {},
create: {
name: 'Homelab LAN',
cidr: '192.168.1.0/24',
description: 'Réseau principal du homelab',
gateway: '192.168.1.1',
dnsServers: '1.1.1.1,9.9.9.9',
color: '#3b82f6',
},
});
// Applications usuelles en homelab
const apps = [
{ name: 'Jellyfin', category: 'media', description: 'Serveur multimédia' },
{ name: 'Home Assistant', category: 'automation', description: 'Domotique' },
{ name: 'Nextcloud', category: 'storage', description: 'Cloud personnel' },
{ name: 'Pi-hole', category: 'network', description: 'Bloqueur DNS' },
{ name: 'Portainer', category: 'management', description: 'Gestion Docker' },
{ name: 'Grafana', category: 'monitoring', description: 'Dashboards' },
];
for (const app of apps) {
await prisma.application.upsert({
where: { name: app.name },
update: {},
create: app,
});
}
// Hôte d'exemple
await prisma.host.upsert({
where: { ipAddress: '192.168.1.1' },
update: {},
create: {
ipAddress: '192.168.1.1',
hostname: 'router',
description: 'Passerelle / routeur du homelab',
status: 'UP',
source: 'MANUAL',
networkId: network.id,
},
});
console.log('✅ Seed terminé');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});