create-velox-app 0.6.98 → 0.6.99
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/CHANGELOG.md +6 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/templates/source/api/procedures/auth.ts +10 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# create-velox-app
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **Beta (v0.6.x)**
|
|
4
4
|
|
|
5
5
|
Interactive project scaffolder for VeloxTS Framework - creates production-ready applications with batteries included. Learn more at [@veloxts/velox](https://www.npmjs.com/package/@veloxts/velox).
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -232,17 +232,24 @@ export const authProcedures = procedures('auth', {
|
|
|
232
232
|
.guard(authenticated)
|
|
233
233
|
.output(UserResponse)
|
|
234
234
|
.query(async ({ ctx }) => {
|
|
235
|
-
|
|
235
|
+
if (!ctx.user) {
|
|
236
|
+
throw new AuthError('Not authenticated', 401, 'NOT_AUTHENTICATED');
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ctx.user only has id/email from the JWT payload — query the DB for the full profile
|
|
240
|
+
const user = await ctx.db.user.findUnique({
|
|
241
|
+
where: { id: ctx.user.id },
|
|
242
|
+
});
|
|
236
243
|
|
|
237
244
|
if (!user) {
|
|
238
|
-
throw new AuthError('
|
|
245
|
+
throw new AuthError('User not found', 404, 'USER_NOT_FOUND');
|
|
239
246
|
}
|
|
240
247
|
|
|
241
248
|
return {
|
|
242
249
|
id: user.id,
|
|
243
250
|
name: user.name ?? '',
|
|
244
251
|
email: user.email,
|
|
245
|
-
roles:
|
|
252
|
+
roles: parseUserRoles(user.roles),
|
|
246
253
|
};
|
|
247
254
|
}),
|
|
248
255
|
});
|