refactor(auth): remove GET /users/me endpoint and related exports
This commit is contained in:
@@ -37,24 +37,6 @@ function logAndObscureError(error, fallback) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// GET /zen/api/users/me
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
async function handleGetCurrentUser(_request, _params, { session }) {
|
||||
return apiSuccess({
|
||||
user: {
|
||||
id: session.user.id,
|
||||
email: session.user.email,
|
||||
name: session.user.name,
|
||||
role: session.user.role,
|
||||
image: session.user.image,
|
||||
emailVerified: session.user.email_verified,
|
||||
createdAt: session.user.created_at
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// GET /zen/api/users/:id (admin only)
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -481,12 +463,11 @@ async function handleDeleteRole(_request, { id: roleId }) {
|
||||
// Route definitions
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// Order matters: specific paths (/users/me, /users/profile) must come before
|
||||
// Order matters: specific paths (/users/profile) must come before
|
||||
// parameterised paths (/users/:id) so they match first.
|
||||
|
||||
export const routes = defineApiRoutes([
|
||||
{ path: '/users', method: 'GET', handler: handleListUsers, auth: 'admin' },
|
||||
{ path: '/users/me', method: 'GET', handler: handleGetCurrentUser, auth: 'user' },
|
||||
{ path: '/users/profile', method: 'PUT', handler: handleUpdateProfile, auth: 'user' },
|
||||
{ path: '/users/profile/picture', method: 'POST', handler: handleUploadProfilePicture, auth: 'user' },
|
||||
{ path: '/users/profile/picture', method: 'DELETE', handler: handleDeleteProfilePicture, auth: 'user' },
|
||||
|
||||
Reference in New Issue
Block a user