spine-framework 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,11 +61,20 @@ async function resolveAppId(slug: string): Promise<string | null> {
|
|
|
61
61
|
return data?.id || null
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
async function resolveSystemAccountId(): Promise<string | null> {
|
|
65
|
+
const { data } = await adminDb
|
|
66
|
+
.from('accounts')
|
|
67
|
+
.select('id')
|
|
68
|
+
.eq('slug', 'spine-system')
|
|
69
|
+
.maybeSingle()
|
|
70
|
+
return data?.id || null
|
|
71
|
+
}
|
|
72
|
+
|
|
64
73
|
async function ensureAppRecord(slug: string, name: string): Promise<string> {
|
|
65
74
|
let appId = await resolveAppId(slug)
|
|
66
75
|
|
|
67
76
|
if (!appId) {
|
|
68
|
-
|
|
77
|
+
const ownerAccountId = await resolveSystemAccountId()
|
|
69
78
|
const { error: insertErr, data } = await adminDb
|
|
70
79
|
.from('apps')
|
|
71
80
|
.insert({
|
|
@@ -75,6 +84,7 @@ async function ensureAppRecord(slug: string, name: string): Promise<string> {
|
|
|
75
84
|
renderer: 'custom',
|
|
76
85
|
is_active: true,
|
|
77
86
|
is_system: false,
|
|
87
|
+
owner_account_id: ownerAccountId,
|
|
78
88
|
})
|
|
79
89
|
.select('id')
|
|
80
90
|
.single()
|
|
@@ -38,18 +38,17 @@ export function LoginPage() {
|
|
|
38
38
|
return
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
// Find app matching user's role
|
|
42
|
-
const userRole = user.roles?.[0]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
41
|
+
// Find app matching user's role, or fall back to first routable app
|
|
42
|
+
const userRole = user.roles?.[0]
|
|
43
|
+
const routableApps = apps.filter(a => a.route_prefix && a.renderer !== 'none')
|
|
44
|
+
const matchingApp = (userRole && routableApps.find(app => app.min_role === userRole))
|
|
45
|
+
|| routableApps[0]
|
|
46
|
+
if (matchingApp?.route_prefix) {
|
|
47
|
+
navigate(matchingApp.route_prefix, { replace: true })
|
|
48
|
+
return
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
// No
|
|
52
|
-
// The 404 will be handled by the catch-all route in App.tsx
|
|
51
|
+
// No routable apps installed — stay on login
|
|
53
52
|
}
|
|
54
53
|
}, [user, loading, apps, navigate])
|
|
55
54
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-app.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/install-app.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"install-app.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/install-app.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA4bxC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,QAgB1D"}
|