english version and minio console access

This commit is contained in:
Georgiy Syralev
2025-12-13 12:53:28 +03:00
parent 753696cc93
commit b799f278a4
47 changed files with 4386 additions and 1264 deletions

View File

@@ -1,5 +1,4 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
import { prisma } from '../src/prisma/client';
async function main() {
await prisma.operatingSystem.deleteMany({ where: { type: 'windows' } });

View File

@@ -0,0 +1,4 @@
-- Insert promo code 'START' for 99 RUB, single-use
INSERT INTO promo_code (code, amount, used, created_at, updated_at)
VALUES ('START', 99, false, NOW(), NOW())
ON DUPLICATE KEY UPDATE code = code;

View File

@@ -18,9 +18,9 @@ model User {
email String @unique
password String
createdAt DateTime @default(now())
plans Plan[] @relation("UserPlans")
// plans Plan[] @relation("UserPlans")
operator Int @default(0)
isAdmin Boolean @default(false) // Админские права
isAdmin Boolean @default(false)
tickets Ticket[] @relation("UserTickets")
responses Response[] @relation("OperatorResponses")
checks Check[] @relation("UserChecks")
@@ -56,26 +56,13 @@ model Check {
@@map("check")
}
model Plan {
id Int @id @default(autoincrement())
name String @unique
price Float
description String?
isCustom Boolean @default(false)
createdAt DateTime @default(now())
userId Int
owner User @relation("UserPlans", fields: [userId], references: [id])
services Service[] @relation("PlanServices")
@@map("plan")
}
model Service {
id Int @id @default(autoincrement())
name String @unique
price Float
planId Int?
plan Plan? @relation("PlanServices", fields: [planId], references: [id])
// planId Int?
// plan Plan? @relation("PlanServices", fields: [planId], references: [id])
@@map("service")
}
@@ -473,6 +460,9 @@ model StorageCheckoutSession {
planName String
planDescription String?
price Float
promoCodeId Int?
promoCode PromoCode? @relation(fields: [promoCodeId], references: [id])
promoDiscount Float? @default(0)
quotaGb Int
bandwidthGb Int
requestLimit String
@@ -517,4 +507,19 @@ model StorageClass {
buckets StorageBucket[] @relation("BucketClass")
@@map("storage_class")
}
model PromoCode {
id Int @id @default(autoincrement())
code String @unique
amount Float // discount amount in RUB
used Boolean @default(false)
usedBy Int?
usedAt DateTime?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User? @relation(fields: [usedBy], references: [id])
@@map("promo_code")
}

View File

@@ -1,27 +0,0 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
const tariffs = [
{ name: 'Минимальный', price: 150, description: '1 ядро, 1ГБ RAM, 20ГБ SSD' },
{ name: 'Базовый', price: 300, description: '2 ядра, 2ГБ RAM, 40ГБ SSD' },
{ name: 'Старт', price: 500, description: '2 ядра, 4ГБ RAM, 60ГБ SSD' },
{ name: 'Оптимальный', price: 700, description: '4 ядра, 4ГБ RAM, 80ГБ SSD' },
{ name: 'Профи', price: 1000, description: '4 ядра, 8ГБ RAM, 120ГБ SSD' },
{ name: 'Бизнес', price: 1500, description: '8 ядер, 16ГБ RAM, 200ГБ SSD' },
{ name: 'Корпоративный', price: 2000, description: '12 ядер, 24ГБ RAM, 300ГБ SSD' },
{ name: 'Премиум', price: 2500, description: '16 ядер, 32ГБ RAM, 400ГБ SSD' },
{ name: 'Энтерпрайз', price: 2800, description: '24 ядра, 48ГБ RAM, 500ГБ SSD' },
{ name: 'Максимум', price: 3000, description: '32 ядра, 64ГБ RAM, 1ТБ SSD' },
];
for (const t of tariffs) {
await prisma.tariff.upsert({
where: { name: t.name },
update: t,
create: t,
});
}
console.log('Тарифы успешно добавлены!');
}
main().finally(() => prisma.$disconnect());

View File

@@ -1,24 +0,0 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
const oses = [
{ name: 'Ubuntu 22.04', type: 'linux', template: 'local:vztmpl/ubuntu-22.04-standard_22.04-1_amd64.tar.zst' },
{ name: 'Debian 12', type: 'linux', template: 'local:vztmpl/debian-12-standard_12.7-1_amd64.tar.zst' },
{ name: 'CentOS 9', type: 'linux', template: 'local:vztmpl/centos-9-stream-default_20240828_amd64.tar.xz' },
{ name: 'AlmaLinux 9', type: 'linux', template: 'local:vztmpl/almalinux-9-default_20240911_amd64.tar.xz' },
{ name: 'Rocky Linux 9', type: 'linux', template: 'local:vztmpl/rockylinux-9-default_20240912_amd64.tar.xz' },
{ name: 'Arch Linux', type: 'linux', template: 'local:vztmpl/archlinux-base_20240911-1_amd64.tar.zst' },
{ name: 'Fedora 41', type: 'linux', template: 'local:vztmpl/fedora-41-default_20241118_amd64.tar.xz' },
];
for (const os of oses) {
await prisma.operatingSystem.upsert({
where: { name: os.name },
update: os,
create: os,
});
}
console.log('ОС успешно добавлены!');
}
main().finally(() => prisma.$disconnect());