Persist user login/logout audit in ncue_user
Add first_login_at and last_logout_at, ensure table exists at runtime, upsert user on /api/auth/sync, and record logout via /api/auth/logout from the client. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,7 +15,9 @@ BEGIN
|
||||
name text,
|
||||
picture text,
|
||||
provider text,
|
||||
first_login_at timestamptz,
|
||||
last_login_at timestamptz,
|
||||
last_logout_at timestamptz,
|
||||
can_manage boolean NOT NULL DEFAULT false,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
@@ -25,3 +27,7 @@ BEGIN
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Backward-compatible migration (if table already exists)
|
||||
ALTER TABLE public.ncue_user ADD COLUMN IF NOT EXISTS first_login_at timestamptz;
|
||||
ALTER TABLE public.ncue_user ADD COLUMN IF NOT EXISTS last_logout_at timestamptz;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user