Skip to content

Commit

Permalink
start session creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoerlitz committed Aug 10, 2023
1 parent ef7d9d6 commit c6b2409
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ router.use(
"/user",
routerGroup((r: Router) => {
r.get("/data/", UserInformationAdminController.getUserDataByID);
r.get("/data/basic", UserInformationAdminController.getBasicUserDataByID);
r.get("/data/sensitive", UserInformationAdminController.getSensitiveUserDataByID);

r.put("/note", UserNoteAdminController.createUserNote);
Expand Down
18 changes: 18 additions & 0 deletions src/controllers/user/UserInformationAdminController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ async function getUserDataByID(request: Request, response: Response) {
response.send(data);
}

async function getBasicUserDataByID(request: Request, response: Response) {
const query = request.query as { user_id: string };

const user = await User.findOne({
where: {
id: query.user_id,
},
});

if (user == null) {
response.status(404).send();
return;
}

response.send(user);
}

/**
* Returns the user data for a user with id request.query.user_id
* @param request
Expand Down Expand Up @@ -79,5 +96,6 @@ async function getSensitiveUserDataByID(request: Request, response: Response) {

export default {
getUserDataByID,
getBasicUserDataByID,
getSensitiveUserDataByID,
};

0 comments on commit c6b2409

Please sign in to comment.