feat(store): add totp columns, org totp policy and global scope

Orgs are created inside their own tenant scope, so signup needs no
system scope.

Refs #3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-11-21 23:55:23 +01:00
1 parent caff396264
commit 99e9b1e57d
12 files changed
+203 -31

No files matched your search

+7 -5
View File
@@ -70,7 +70,7 @@ func (q *Queries) ListOrgMembers(ctx context.Context, orgID uuid.UUID) ([]ListOr
}
const listUserOrgs = `-- name: ListUserOrgs :many
SELECT o.id, o.slug, o.name, m.is_owner
SELECT o.id, o.slug, o.name, o.require_totp, m.is_owner
FROM memberships m
JOIN orgs o ON o.id = m.org_id
WHERE m.user_id = $1
@@ -78,10 +78,11 @@ ORDER BY o.name
`
type ListUserOrgsRow struct {
ID uuid.UUID
Slug string
Name string
IsOwner bool
ID uuid.UUID
Slug string
Name string
RequireTotp bool
IsOwner bool
}
func (q *Queries) ListUserOrgs(ctx context.Context, userID uuid.UUID) ([]ListUserOrgsRow, error) {
@@ -97,6 +98,7 @@ func (q *Queries) ListUserOrgs(ctx context.Context, userID uuid.UUID) ([]ListUse
&i.ID,
&i.Slug,
&i.Name,
&i.RequireTotp,
&i.IsOwner,
); err != nil {
return nil, err