Feature: Shared lists & Invite Code invitation mechanism
- Backend:
- Migration 000002: add invite_code column to lists & list_members auto-population
- ListStore: GetLists/GetList check owner_id & list_members; add GetInviteCode & JoinByInviteCode
- HTTP API: add POST /api/lists/{id}/invite & POST /api/lists/join
- Android App:
- DTOs & MitbringslApi: add JoinListRequestDto, InviteCodeResponseDto & endpoints
- ListsScreen & ViewModel: add 'Liste beitreten' action button & dialog for entering invite code
- ListDetailScreen & ViewModel: add 'Liste teilen' action icon in top bar with System Share Sheet
- ADB reinstall & launch verified ✅
This commit is contained in:
parent
47b24dfcdf
commit
69591df12a
11 changed files with 457 additions and 56 deletions
1
backend/migrations/000002_add_invite_code.down.sql
Normal file
1
backend/migrations/000002_add_invite_code.down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE lists DROP COLUMN IF EXISTS invite_code;
|
||||
13
backend/migrations/000002_add_invite_code.up.sql
Normal file
13
backend/migrations/000002_add_invite_code.up.sql
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
-- Add invite_code to lists table for sharing
|
||||
ALTER TABLE lists ADD COLUMN IF NOT EXISTS invite_code TEXT UNIQUE;
|
||||
|
||||
-- Generate random 8-character invite code for lists that don't have one
|
||||
UPDATE lists
|
||||
SET invite_code = UPPER(SUBSTRING(MD5(RANDOM()::TEXT) FROM 1 FOR 8))
|
||||
WHERE invite_code IS NULL;
|
||||
|
||||
-- Automatically insert owner into list_members on list creation if missing
|
||||
INSERT INTO list_members (list_id, user_id, role)
|
||||
SELECT id, owner_id, 'owner'
|
||||
FROM lists
|
||||
ON CONFLICT (list_id, user_id) DO NOTHING;
|
||||
Loading…
Add table
Add a link
Reference in a new issue