@lastbrain/module-auth 0.1.4 → 0.1.5
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.
- package/dist/api/admin/users.d.ts.map +1 -1
- package/dist/api/admin/users.js +4 -1
- package/dist/api/auth/me.d.ts.map +1 -1
- package/dist/api/auth/me.js +1 -1
- package/dist/auth.build.config.js +1 -1
- package/dist/web/auth/profile.d.ts.map +1 -1
- package/dist/web/auth/profile.js +1 -0
- package/package.json +1 -1
- package/src/api/admin/users.ts +7 -2
- package/src/api/auth/me.ts +3 -1
- package/src/auth.build.config.ts +2 -2
- package/src/web/admin/users.tsx +1 -1
- package/src/web/auth/dashboard.tsx +1 -1
- package/src/web/auth/profile.tsx +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/api/admin/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD;;;;;GAKG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../../src/api/admin/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGxD;;;;;GAKG;AACH,wBAAsB,GAAG,CAAC,OAAO,EAAE,WAAW,8BA8C7C"}
|
package/dist/api/admin/users.js
CHANGED
|
@@ -26,7 +26,10 @@ export async function GET(request) {
|
|
|
26
26
|
return NextResponse.json({ error: "Database Error", message: usersError.message }, { status: 500 });
|
|
27
27
|
}
|
|
28
28
|
// The RPC function returns the complete response with data and pagination
|
|
29
|
-
return NextResponse.json(result || {
|
|
29
|
+
return NextResponse.json(result || {
|
|
30
|
+
data: [],
|
|
31
|
+
pagination: { page, per_page: perPage, total: 0, total_pages: 0 },
|
|
32
|
+
});
|
|
30
33
|
}
|
|
31
34
|
catch (error) {
|
|
32
35
|
console.error("Error in admin users endpoint:", error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../src/api/auth/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C;;;GAGG;AACH,wBAAsB,GAAG;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"me.d.ts","sourceRoot":"","sources":["../../../src/api/auth/me.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C;;;GAGG;AACH,wBAAsB,GAAG;;;;;;;;;;IAiCxB"}
|
package/dist/api/auth/me.js
CHANGED
|
@@ -8,7 +8,7 @@ export async function GET() {
|
|
|
8
8
|
try {
|
|
9
9
|
const supabase = await getSupabaseServerClient();
|
|
10
10
|
// Get the authenticated user
|
|
11
|
-
const { data: { user } } = await supabase.auth.getUser();
|
|
11
|
+
const { data: { user }, } = await supabase.auth.getUser();
|
|
12
12
|
// L'utilisateur est déjà authentifié grâce au middleware
|
|
13
13
|
// Get user profile
|
|
14
14
|
const { data: profile } = await supabase
|
|
@@ -88,7 +88,7 @@ const authBuildConfig = {
|
|
|
88
88
|
files: [
|
|
89
89
|
"20251112000000_user_init.sql",
|
|
90
90
|
"20251112000001_auto_profile_and_admin_view.sql",
|
|
91
|
-
"20251112000002_sync_avatars.sql"
|
|
91
|
+
"20251112000002_sync_avatars.sql",
|
|
92
92
|
],
|
|
93
93
|
migrationsDownPath: "supabase/migrations-down",
|
|
94
94
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/web/auth/profile.tsx"],"names":[],"mappings":"AAyCA,wBAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../../src/web/auth/profile.tsx"],"names":[],"mappings":"AAyCA,wBAAgB,WAAW,4CA6X1B"}
|
package/dist/web/auth/profile.js
CHANGED
|
@@ -10,6 +10,7 @@ export function ProfilePage() {
|
|
|
10
10
|
const [isLoading, setIsLoading] = useState(true);
|
|
11
11
|
const [isSaving, setIsSaving] = useState(false);
|
|
12
12
|
const [_error, setError] = useState(null);
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
14
|
const [currentUser, setCurrentUser] = useState(null);
|
|
14
15
|
useEffect(() => {
|
|
15
16
|
fetchProfile();
|
package/package.json
CHANGED
package/src/api/admin/users.ts
CHANGED
|
@@ -25,7 +25,7 @@ export async function GET(request: NextRequest) {
|
|
|
25
25
|
page_number: page,
|
|
26
26
|
page_size: perPage,
|
|
27
27
|
search_term: search,
|
|
28
|
-
}
|
|
28
|
+
},
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
if (usersError) {
|
|
@@ -37,7 +37,12 @@ export async function GET(request: NextRequest) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// The RPC function returns the complete response with data and pagination
|
|
40
|
-
return NextResponse.json(
|
|
40
|
+
return NextResponse.json(
|
|
41
|
+
result || {
|
|
42
|
+
data: [],
|
|
43
|
+
pagination: { page, per_page: perPage, total: 0, total_pages: 0 },
|
|
44
|
+
},
|
|
45
|
+
);
|
|
41
46
|
} catch (error) {
|
|
42
47
|
console.error("Error in admin users endpoint:", error);
|
|
43
48
|
return NextResponse.json(
|
package/src/api/auth/me.ts
CHANGED
|
@@ -10,7 +10,9 @@ export async function GET() {
|
|
|
10
10
|
const supabase = await getSupabaseServerClient();
|
|
11
11
|
|
|
12
12
|
// Get the authenticated user
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
data: { user },
|
|
15
|
+
} = await supabase.auth.getUser();
|
|
14
16
|
|
|
15
17
|
// L'utilisateur est déjà authentifié grâce au middleware
|
|
16
18
|
// Get user profile
|
package/src/auth.build.config.ts
CHANGED
|
@@ -88,9 +88,9 @@ const authBuildConfig: ModuleBuildConfig = {
|
|
|
88
88
|
priority: 20,
|
|
89
89
|
path: "supabase/migrations",
|
|
90
90
|
files: [
|
|
91
|
-
"20251112000000_user_init.sql",
|
|
91
|
+
"20251112000000_user_init.sql",
|
|
92
92
|
"20251112000001_auto_profile_and_admin_view.sql",
|
|
93
|
-
"20251112000002_sync_avatars.sql"
|
|
93
|
+
"20251112000002_sync_avatars.sql",
|
|
94
94
|
],
|
|
95
95
|
migrationsDownPath: "supabase/migrations-down",
|
|
96
96
|
},
|
package/src/web/admin/users.tsx
CHANGED
|
@@ -195,7 +195,7 @@ export function DashboardPage() {
|
|
|
195
195
|
<p className="text-2xl font-bold text-secondary">
|
|
196
196
|
{Math.floor(
|
|
197
197
|
(Date.now() - new Date(userData.created_at).getTime()) /
|
|
198
|
-
(1000 * 60 * 60 * 24)
|
|
198
|
+
(1000 * 60 * 60 * 24),
|
|
199
199
|
)}
|
|
200
200
|
</p>
|
|
201
201
|
<p className="text-small text-default-500">Days active</p>
|
package/src/web/auth/profile.tsx
CHANGED
|
@@ -44,6 +44,7 @@ export function ProfilePage() {
|
|
|
44
44
|
const [isLoading, setIsLoading] = useState(true);
|
|
45
45
|
const [isSaving, setIsSaving] = useState(false);
|
|
46
46
|
const [_error, setError] = useState<string | null>(null);
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
48
|
const [currentUser, setCurrentUser] = useState<any>(null);
|
|
48
49
|
|
|
49
50
|
useEffect(() => {
|
|
@@ -145,19 +146,19 @@ export function ProfilePage() {
|
|
|
145
146
|
"avatar",
|
|
146
147
|
`${currentUser.id}_32_${version}.webp`,
|
|
147
148
|
files.small,
|
|
148
|
-
"image/webp"
|
|
149
|
+
"image/webp",
|
|
149
150
|
);
|
|
150
151
|
urls.medium = await uploadFile(
|
|
151
152
|
"avatar",
|
|
152
153
|
`${currentUser.id}_64_${version}.webp`,
|
|
153
154
|
files.medium,
|
|
154
|
-
"image/webp"
|
|
155
|
+
"image/webp",
|
|
155
156
|
);
|
|
156
157
|
urls.large = await uploadFile(
|
|
157
158
|
"avatar",
|
|
158
159
|
`${currentUser.id}_128_${version}.webp`,
|
|
159
160
|
files.large,
|
|
160
|
-
"image/webp"
|
|
161
|
+
"image/webp",
|
|
161
162
|
);
|
|
162
163
|
|
|
163
164
|
// Update user metadata
|