Сделана логика создания вм на сервере, управления есть. Начаты уведомления
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE `server` ADD COLUMN `cpuUsage` DOUBLE NULL DEFAULT 0,
|
||||
ADD COLUMN `diskUsage` DOUBLE NULL DEFAULT 0,
|
||||
ADD COLUMN `ipAddress` VARCHAR(191) NULL,
|
||||
ADD COLUMN `lastPing` DATETIME(3) NULL,
|
||||
ADD COLUMN `macAddress` VARCHAR(191) NULL,
|
||||
ADD COLUMN `memoryUsage` DOUBLE NULL DEFAULT 0,
|
||||
ADD COLUMN `networkIn` DOUBLE NULL DEFAULT 0,
|
||||
ADD COLUMN `networkOut` DOUBLE NULL DEFAULT 0,
|
||||
ADD COLUMN `rootPassword` VARCHAR(191) NULL,
|
||||
ADD COLUMN `sshPublicKey` VARCHAR(191) NULL,
|
||||
MODIFY `status` VARCHAR(191) NOT NULL DEFAULT 'creating';
|
||||
@@ -0,0 +1,13 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `Notification` (
|
||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`userId` INTEGER NOT NULL,
|
||||
`title` VARCHAR(191) NOT NULL,
|
||||
`message` VARCHAR(191) NOT NULL,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `Notification` ADD CONSTRAINT `Notification_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -33,15 +33,33 @@ model Server {
|
||||
userId Int
|
||||
tariffId Int
|
||||
osId Int
|
||||
status String @default("stopped")
|
||||
status String @default("creating") // creating, running, stopped, suspended, error
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
tariff Tariff @relation(fields: [tariffId], references: [id])
|
||||
os OperatingSystem @relation(fields: [osId], references: [id])
|
||||
|
||||
// Proxmox данные
|
||||
node String?
|
||||
diskTemplate String?
|
||||
proxmoxId Int?
|
||||
proxmoxId Int?
|
||||
|
||||
// Сетевые настройки
|
||||
ipAddress String? // Локальный IP адрес
|
||||
macAddress String? // MAC адрес
|
||||
|
||||
// Доступы
|
||||
rootPassword String? // Зашифрованный root пароль
|
||||
sshPublicKey String? // SSH публичный ключ (опционально)
|
||||
|
||||
// Мониторинг
|
||||
lastPing DateTime?
|
||||
cpuUsage Float? @default(0)
|
||||
memoryUsage Float? @default(0)
|
||||
diskUsage Float? @default(0)
|
||||
networkIn Float? @default(0)
|
||||
networkOut Float? @default(0)
|
||||
}
|
||||
|
||||
model User {
|
||||
@@ -57,6 +75,7 @@ model User {
|
||||
checks Check[] @relation("UserChecks")
|
||||
balance Float @default(0)
|
||||
servers Server[]
|
||||
notifications Notification[]
|
||||
}
|
||||
|
||||
model Check {
|
||||
@@ -109,4 +128,12 @@ model Response {
|
||||
createdAt DateTime @default(now())
|
||||
ticket Ticket @relation("TicketResponses", fields: [ticketId], references: [id])
|
||||
operator User @relation("OperatorResponses", fields: [operatorId], references: [id])
|
||||
}
|
||||
model Notification {
|
||||
id Int @id @default(autoincrement())
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
userId Int
|
||||
title String
|
||||
message String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
Reference in New Issue
Block a user