import { DataTypes } from "sequelize"; import { ApplicationConfigurationInputSchema } from "../../domain/application-configuration-values"; import { CertificateConfigurationInputSchema } from "../../domain/certificate-configuration-values"; import { FolderMappingInputSchema } from "../../domain/folder-mapping-values"; import { PrinterConfigurationInputSchema } from "../../domain/printer-configuration-values"; import { TeleworkAuthorizationInputSchema } from "../../domain/telework-authorization-values"; import { WorkProfileInputSchema } from "../../domain/work-profile-values"; import type { SnapshotDefinition } from "./scalar-snapshot-normalization"; export const profileSnapshot = { schema: WorkProfileInputSchema, columns: { name: { type: DataTypes.STRING(100), allowNull: false }, personId: { type: DataTypes.UUID, allowNull: false, references: { model: "company_contacts", key: "id" }, onDelete: "RESTRICT", }, assetId: { type: DataTypes.UUID, allowNull: false, references: { model: "assets", key: "id" }, onDelete: "RESTRICT", }, accountId: { type: DataTypes.UUID, allowNull: true, references: { model: "access_items", key: "id" }, onDelete: "RESTRICT", }, active: { type: DataTypes.BOOLEAN, allowNull: false }, notes: { type: DataTypes.TEXT, allowNull: true }, }, booleans: ["active"], } satisfies SnapshotDefinition>; export const teleworkSnapshot = { schema: TeleworkAuthorizationInputSchema, columns: { personId: { type: DataTypes.UUID, allowNull: false, references: { model: "company_contacts", key: "id" }, onDelete: "RESTRICT", }, active: { type: DataTypes.BOOLEAN, allowNull: false }, startsOn: { type: DataTypes.STRING(10), allowNull: true }, expiresOn: { type: DataTypes.STRING(10), allowNull: true }, notes: { type: DataTypes.TEXT, allowNull: true }, }, booleans: ["active"], } satisfies SnapshotDefinition>; export const applicationSnapshot = { schema: ApplicationConfigurationInputSchema, columns: { profileId: { type: DataTypes.UUID, allowNull: false, references: { model: "work_profiles", key: "id" }, onDelete: "RESTRICT", }, resourceId: { type: DataTypes.UUID, allowNull: false, references: { model: "resources", key: "id" }, onDelete: "RESTRICT", }, delivery: { type: DataTypes.STRING(16), allowNull: false }, version: { type: DataTypes.STRING(100), allowNull: true }, state: { type: DataTypes.STRING(20), allowNull: false }, notes: { type: DataTypes.TEXT, allowNull: true }, }, booleans: [], } satisfies SnapshotDefinition>; export const certificateSnapshot = { schema: CertificateConfigurationInputSchema, columns: { profileId: { type: DataTypes.UUID, allowNull: false, references: { model: "work_profiles", key: "id" }, onDelete: "RESTRICT", }, resourceId: { type: DataTypes.UUID, allowNull: false, references: { model: "resources", key: "id" }, onDelete: "RESTRICT", }, location: { type: DataTypes.STRING(255), allowNull: true }, state: { type: DataTypes.STRING(20), allowNull: false }, notes: { type: DataTypes.TEXT, allowNull: true }, }, booleans: [], } satisfies SnapshotDefinition>; export const printerSnapshot = { schema: PrinterConfigurationInputSchema, columns: { profileId: { type: DataTypes.UUID, allowNull: false, references: { model: "work_profiles", key: "id" }, onDelete: "RESTRICT", }, printerId: { type: DataTypes.UUID, allowNull: false, references: { model: "assets", key: "id" }, onDelete: "RESTRICT", }, connection: { type: DataTypes.STRING(16), allowNull: false }, isDefault: { type: DataTypes.BOOLEAN, allowNull: false }, state: { type: DataTypes.STRING(20), allowNull: false }, notes: { type: DataTypes.TEXT, allowNull: true }, }, booleans: ["isDefault"], } satisfies SnapshotDefinition>; export const folderSnapshot = { schema: FolderMappingInputSchema, columns: { profileId: { type: DataTypes.UUID, allowNull: false, references: { model: "work_profiles", key: "id" }, onDelete: "RESTRICT", }, needId: { type: DataTypes.UUID, allowNull: false, references: { model: "access_items", key: "id" }, onDelete: "RESTRICT", }, path: { type: DataTypes.STRING(255), allowNull: false }, driveLetter: { type: DataTypes.STRING(2), allowNull: true }, state: { type: DataTypes.STRING(20), allowNull: false }, notes: { type: DataTypes.TEXT, allowNull: true }, }, booleans: [], } satisfies SnapshotDefinition>; import { mailSnapshot, mailboxSnapshot, mailboxUseSnapshot, remoteSnapshot, } from "./mail-remote-snapshots"; export const configurationSnapshots = new Map>([ ["remote_connection_revisions", remoteSnapshot], ["mailbox_use_revisions", mailboxUseSnapshot], ["mailbox_revisions", mailboxSnapshot], ["mail_configuration_revisions", mailSnapshot], ["mail_configurations", mailSnapshot], ["mailboxes", mailboxSnapshot], ["mailbox_uses", mailboxUseSnapshot], ["remote_connections", remoteSnapshot], ["work_profiles", profileSnapshot], ["work_profile_revisions", profileSnapshot], ["telework_authorizations", teleworkSnapshot], ["telework_authorization_revisions", teleworkSnapshot], ["application_configurations", applicationSnapshot], ["application_configuration_revisions", applicationSnapshot], ["certificate_configurations", certificateSnapshot], ["certificate_configuration_revisions", certificateSnapshot], ["printer_configurations", printerSnapshot], ["printer_configuration_revisions", printerSnapshot], ["folder_mappings", folderSnapshot], ["folder_mapping_revisions", folderSnapshot], ]);