Implement lab3 grade 4: balanced API replicas, shared idempotency and failure tests

This commit is contained in:
2026-11-02 20:54:35 +03:00
parent 0ab3a341aa
commit 5332cda400
55 changed files with 102293 additions and 19 deletions
+12
View File
@@ -0,0 +1,12 @@
-- Additive migration: old lab2 tables and rows are unchanged.
-- This table is only for POST /chats/{chat_id}/messages; method/path scope is implicit.
CREATE TABLE message_requests (
actor_id uuid NOT NULL REFERENCES users(id),
chat_id uuid NOT NULL REFERENCES chats(id),
key text NOT NULL CHECK (key ~ '^[A-Za-z0-9._:-]{1,128}$'),
fingerprint text NOT NULL,
response jsonb NOT NULL,
expires_at timestamptz NOT NULL,
PRIMARY KEY (actor_id, chat_id, key)
);
CREATE INDEX message_requests_expiry ON message_requests(expires_at);