Complete Lab 3 for Grade 5 (Track 1)

This commit is contained in:
paflove
2026-11-03 13:37:17 +03:00
parent 0ab3a341aa
commit 67ac1497dc
16 changed files with 1143 additions and 15 deletions
+12
View File
@@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS idempotency_keys (
user_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
chat_id UUID NOT NULL REFERENCES chats(id) ON DELETE CASCADE,
key VARCHAR(128) NOT NULL,
request_hash VARCHAR(64) NOT NULL,
response_code INT NOT NULL,
response_body JSONB NOT NULL,
created_at TIMESTAMPTZ NOT NULL,
PRIMARY KEY (user_id, chat_id, key)
);
CREATE INDEX IF NOT EXISTS idx_idempotency_created_at ON idempotency_keys (created_at);