feat: objects_created flag on pictures, native_lang on users
- pictures: add objects_created (bool) + objects_created_at (auto timestamp) GET /pictures supports ?objects_created=true/false filter PATCH /pictures/:id allows setting objects_created - db-migrate: seed German language, link to all existing users - auth/login: include native_lang (from languages table) in response + JWT Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -319,6 +319,26 @@ async function migrate() {
|
||||
)
|
||||
`);
|
||||
|
||||
// objects_created on pictures
|
||||
await query(`ALTER TABLE pictures ADD COLUMN IF NOT EXISTS objects_created BOOLEAN NOT NULL DEFAULT false`);
|
||||
await query(`ALTER TABLE pictures ADD COLUMN IF NOT EXISTS objects_created_at TIMESTAMPTZ`);
|
||||
|
||||
// language_native_id on users
|
||||
await query(`ALTER TABLE users ADD COLUMN IF NOT EXISTS language_native_id UUID REFERENCES languages(id) ON DELETE SET NULL`);
|
||||
|
||||
// Seed German language (idempotent)
|
||||
await query(`
|
||||
INSERT INTO languages (titel_en, titel_de, titel_sv, short_en, status)
|
||||
SELECT 'German', 'Deutsch', 'Tyska', 'de', 'published'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM languages WHERE short_en = 'de')
|
||||
`);
|
||||
|
||||
// Set all users without a native language to German
|
||||
await query(`
|
||||
UPDATE users SET language_native_id = (SELECT id FROM languages WHERE short_en = 'de' LIMIT 1)
|
||||
WHERE language_native_id IS NULL
|
||||
`);
|
||||
|
||||
// blocklist
|
||||
await query(`
|
||||
CREATE TABLE IF NOT EXISTS blocklist (
|
||||
|
||||
Reference in New Issue
Block a user