T04: DMS plugin backend — folders + files + preview + OnlyOffice + shares + search + bulk — 106 tests, 97.90% coverage

This commit is contained in:
leocrm-bot
2026-06-29 20:48:58 +02:00
parent a2452cc04b
commit fdb41dade1
14 changed files with 3764 additions and 66 deletions
@@ -0,0 +1,30 @@
-- DMS plugin initial migration: creates folders and files tables
CREATE TABLE IF NOT EXISTS folders (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
parent_id UUID REFERENCES folders(id) ON DELETE CASCADE,
tenant_id UUID NOT NULL,
created_by UUID NOT NULL,
deleted_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS ix_folders_parent ON folders(parent_id);
CREATE INDEX IF NOT EXISTS ix_folders_tenant ON folders(tenant_id);
CREATE TABLE IF NOT EXISTS files (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
folder_id UUID REFERENCES folders(id) ON DELETE SET NULL,
tenant_id UUID NOT NULL,
uploaded_by UUID NOT NULL,
mime_type VARCHAR(255) NOT NULL,
size_bytes BIGINT NOT NULL,
storage_path VARCHAR(1024) NOT NULL,
deleted_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS ix_files_folder ON files(folder_id);
CREATE INDEX IF NOT EXISTS ix_files_tenant ON files(tenant_id);
CREATE INDEX IF NOT EXISTS ix_files_name ON files(name);