인증 요청 안정화와 월간 메일 한도 적용

This commit is contained in:
2026-06-25 14:05:23 +09:00
parent 35a2976182
commit 5fbd58bd07
20 changed files with 350 additions and 30 deletions

View File

@@ -78,6 +78,20 @@ export function initDb(dbPath) {
CREATE INDEX IF NOT EXISTS idx_auth_tokens_user_type
ON auth_tokens(user_id, type);
CREATE TABLE IF NOT EXISTS email_send_logs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
type TEXT NOT NULL,
month_key TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'reserved',
created_at TEXT NOT NULL DEFAULT (datetime('now')),
sent_at TEXT,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);
CREATE INDEX IF NOT EXISTS idx_email_send_logs_user_month
ON email_send_logs(user_id, month_key, status);
`);
const deckCols = db.prepare('PRAGMA table_info(decks)').all();