Implement Lab 7 service security
Application / https-smoke (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
dmice9
2026-12-03 20:56:06 +03:00
parent 20afc2c790
commit 9bf101b322
57 changed files with 3802 additions and 53 deletions
+21
View File
@@ -0,0 +1,21 @@
ALTER TABLE attachments
ADD COLUMN status text NOT NULL DEFAULT 'queued'
CHECK (status IN ('queued', 'processing', 'ready', 'failed')),
ADD COLUMN variants jsonb NOT NULL DEFAULT '[]',
ADD COLUMN error_code text,
ADD CHECK ((status = 'failed') = (error_code IS NOT NULL));
CREATE TABLE attachment_jobs (
id uuid PRIMARY KEY,
attachment_id uuid NOT NULL UNIQUE REFERENCES attachments(id),
source_key text NOT NULL,
attempts integer NOT NULL DEFAULT 0 CHECK (attempts >= 0),
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
publish_at timestamptz DEFAULT clock_timestamp()
);
CREATE INDEX attachment_jobs_pending_idx ON attachment_jobs(publish_at, id)
WHERE publish_at IS NOT NULL;
-- Existing Lab 4 originals can be used as input without copying or deleting them.
INSERT INTO attachment_jobs(id, attachment_id, source_key)
SELECT gen_random_uuid(), id, object_key FROM attachments;