Синхронизация bindings в vps_domains с привязкой по IP, API приёма с Bearer-токеном, настройки и App Switcher из SQLite, UI доменов на VPS и уведомление CFDM при vps_down. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const appSwitcherIconSchema = z.enum(['server', 'cloud', 'globe', 'dashboard', 'chart'])
|
||||
|
||||
export const appSwitcherEntrySchema = z.object({
|
||||
id: z.string(),
|
||||
name: z.string(),
|
||||
subtitle: z.string().optional(),
|
||||
url: z.string().url('Невалидный URL'),
|
||||
icon: appSwitcherIconSchema.default('server'),
|
||||
shortcut: z.string().optional(),
|
||||
})
|
||||
|
||||
export const appSwitcherConfigSchema = z.object({
|
||||
menuLabel: z.string().default('Приложения'),
|
||||
apps: z.array(appSwitcherEntrySchema).min(1),
|
||||
})
|
||||
|
||||
export type AppSwitcherEntry = z.infer<typeof appSwitcherEntrySchema>
|
||||
export type AppSwitcherConfig = z.infer<typeof appSwitcherConfigSchema>
|
||||
@@ -0,0 +1,34 @@
|
||||
import { z } from 'zod'
|
||||
|
||||
export const cfdmBindingSyncItemSchema = z.object({
|
||||
bindingId: z.number().int().positive(),
|
||||
serviceId: z.number().int().positive(),
|
||||
serviceName: z.string().min(1),
|
||||
serviceSlug: z.string().min(1),
|
||||
fqdn: z.string().min(1),
|
||||
zoneName: z.string().min(1),
|
||||
hostname: z.string(),
|
||||
ips: z.array(z.string()),
|
||||
deleted: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export const cfdmSyncBindingsBodySchema = z.object({
|
||||
bindings: z.array(cfdmBindingSyncItemSchema).min(1),
|
||||
})
|
||||
|
||||
export type CfdmBindingSyncItem = z.infer<typeof cfdmBindingSyncItemSchema>
|
||||
export type CfdmSyncBindingsBody = z.infer<typeof cfdmSyncBindingsBodySchema>
|
||||
|
||||
export const vpsTrackerEventSchema = z.object({
|
||||
event: z.enum(['vps_down', 'vps_up']),
|
||||
vps: z.array(
|
||||
z.object({
|
||||
id: z.string().min(1),
|
||||
ip: z.string().optional(),
|
||||
label: z.string().optional(),
|
||||
}),
|
||||
),
|
||||
timestamp: z.string().datetime().optional(),
|
||||
})
|
||||
|
||||
export type VpsTrackerEvent = z.infer<typeof vpsTrackerEventSchema>
|
||||
@@ -1,5 +1,6 @@
|
||||
import { z } from 'zod'
|
||||
import { customFieldsSchema } from './custom-fields.js'
|
||||
import { appSwitcherConfigSchema } from './app-switcher.js'
|
||||
|
||||
export const settingsSchema = z.object({
|
||||
id: z.string().optional(),
|
||||
@@ -23,6 +24,9 @@ export const settingsSchema = z.object({
|
||||
webhookUrl: z.string().url('Невалидный URL').or(z.literal('')).optional(),
|
||||
webhookEnabled: z.boolean().optional(),
|
||||
customFields: customFieldsSchema.optional(),
|
||||
appSwitcher: appSwitcherConfigSchema.optional(),
|
||||
integrationToken: z.string().optional(),
|
||||
integrationEnabled: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export type Settings = z.infer<typeof settingsSchema>
|
||||
|
||||
Reference in New Issue
Block a user