Skip to content

Commit ce5dad4

Browse files
The Morpheus TutorialsThe Morpheus Tutorials
authored andcommitted
feat: [medium] admin routes error responses missing details field in error envelope
Closes #1908
1 parent bccd21c commit ce5dad4

10 files changed

Lines changed: 591 additions & 71 deletions

apps/api/src/modules/admin/__tests__/admin-routes.error-envelope.test.ts

Lines changed: 519 additions & 0 deletions
Large diffs are not rendered by default.

apps/api/src/modules/admin/admin-roles.routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const registerAdminRoleRoutes = async (fastify: FastifyInstance): Promise
6767
if (!user) {
6868
return reply.code(401).send({
6969
success: false,
70-
error: { code: 'UNAUTHORIZED', message: 'Authentication required' },
70+
error: { code: 'UNAUTHORIZED', message: 'Authentication required', details: {} },
7171
});
7272
}
7373

@@ -185,7 +185,7 @@ export const registerAdminRoleRoutes = async (fastify: FastifyInstance): Promise
185185
if (!user) {
186186
return reply.code(401).send({
187187
success: false,
188-
error: { code: 'UNAUTHORIZED', message: 'Authentication required' },
188+
error: { code: 'UNAUTHORIZED', message: 'Authentication required', details: {} },
189189
});
190190
}
191191

apps/api/src/modules/admin/admin-tenants.routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ export const registerAdminTenantRoutes = async (fastify: FastifyInstance): Promi
104104
error: {
105105
code: 'TENANT_CREATION_FAILED',
106106
message: errorMessage,
107+
details: {},
107108
},
108109
});
109110
}

apps/api/src/modules/admin/admin-users.routes.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export const registerAdminUserRoutes = async (fastify: FastifyInstance): Promise
172172
if (!user) {
173173
return reply.code(401).send({
174174
success: false,
175-
error: { code: 'UNAUTHORIZED', message: 'Authentication required' },
175+
error: { code: 'UNAUTHORIZED', message: 'Authentication required', details: {} },
176176
});
177177
}
178178

@@ -235,7 +235,7 @@ export const registerAdminUserRoutes = async (fastify: FastifyInstance): Promise
235235
if (!user) {
236236
return reply.code(401).send({
237237
success: false,
238-
error: { code: 'UNAUTHORIZED', message: 'Authentication required' },
238+
error: { code: 'UNAUTHORIZED', message: 'Authentication required', details: {} },
239239
});
240240
}
241241

@@ -297,7 +297,7 @@ export const registerAdminUserRoutes = async (fastify: FastifyInstance): Promise
297297
if (!user) {
298298
return reply.code(401).send({
299299
success: false,
300-
error: { code: 'UNAUTHORIZED', message: 'Authentication required' },
300+
error: { code: 'UNAUTHORIZED', message: 'Authentication required', details: {} },
301301
});
302302
}
303303

@@ -368,7 +368,7 @@ export const registerAdminUserRoutes = async (fastify: FastifyInstance): Promise
368368
if (!user) {
369369
return reply.code(401).send({
370370
success: false,
371-
error: { code: 'UNAUTHORIZED', message: 'Authentication required' },
371+
error: { code: 'UNAUTHORIZED', message: 'Authentication required', details: {} },
372372
});
373373
}
374374

@@ -421,7 +421,7 @@ export const registerAdminUserRoutes = async (fastify: FastifyInstance): Promise
421421
if (!user) {
422422
return reply.code(401).send({
423423
success: false,
424-
error: { code: 'UNAUTHORIZED', message: 'Authentication required' },
424+
error: { code: 'UNAUTHORIZED', message: 'Authentication required', details: {} },
425425
});
426426
}
427427

0 commit comments

Comments
 (0)