feat: Implement api/v1/users/:userId API endpoint

This commit is contained in:
Faruk AYDIN
2024-02-13 03:44:44 +01:00
parent 9f0e0ca656
commit 824c434b0b
7 changed files with 107 additions and 3 deletions

View File

@@ -0,0 +1,16 @@
import { renderObject } from '../../../../helpers/renderer.js';
import User from '../../../../models/user.js';
export default async (request, response) => {
const user = await User.query()
.leftJoinRelated({
role: true,
})
.withGraphFetched({
role: true,
})
.findById(request.params.userId)
.throwIfNotFound();
renderObject(response, user);
};