feat: migrate from static config to database and add authentication
- Replaced static hosts.json and staticConfig.ts with SQLite database (Prisma) - Implemented JWT authentication and Login UI - Added dynamic API routes for hosts, topology, and settings - Updated UI components to fetch and manage state dynamically - Added Settings interface for managing hosts and topology nodes
This commit is contained in:
75
prisma/schema.prisma
Normal file
75
prisma/schema.prisma
Normal file
@@ -0,0 +1,75 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id @default(uuid())
|
||||
username String @unique
|
||||
password String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model HostConfig {
|
||||
id String @id @default(uuid())
|
||||
name String @unique
|
||||
ip String
|
||||
sshUser String @default("bear")
|
||||
sshKeyPath String?
|
||||
sshPort Int @default(22)
|
||||
hostType String @default("docker-host")
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model NetworkNode {
|
||||
id String @id
|
||||
type String
|
||||
name String
|
||||
ip String?
|
||||
status String @default("unknown")
|
||||
importance Int @default(3)
|
||||
description String?
|
||||
metadata Json?
|
||||
category String? // for services
|
||||
parentId String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
parent NetworkNode? @relation("NodeHierarchy", fields: [parentId], references: [id])
|
||||
children NetworkNode[] @relation("NodeHierarchy")
|
||||
|
||||
sourceEdges NetworkEdge[] @relation("EdgeSource")
|
||||
targetEdges NetworkEdge[] @relation("EdgeTarget")
|
||||
}
|
||||
|
||||
model NetworkEdge {
|
||||
id String @id @default(uuid())
|
||||
sourceId String
|
||||
targetId String
|
||||
type String?
|
||||
label String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
source NetworkNode @relation("EdgeSource", fields: [sourceId], references: [id])
|
||||
target NetworkNode @relation("EdgeTarget", fields: [targetId], references: [id])
|
||||
|
||||
@@unique([sourceId, targetId])
|
||||
}
|
||||
|
||||
model Settings {
|
||||
id String @id @default("singleton")
|
||||
key String @unique
|
||||
value String
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
Reference in New Issue
Block a user