Skip to content

Add endpoint to get usernames by id#73

Open
aaronb12-ux wants to merge 3 commits intomainfrom
add-endpoint-to-get-usernames-by-id
Open

Add endpoint to get usernames by id#73
aaronb12-ux wants to merge 3 commits intomainfrom
add-endpoint-to-get-usernames-by-id

Conversation

@aaronb12-ux
Copy link
Copy Markdown
Contributor

I added an endpoint to get the usernames by ID:

It exists in the already existing users router.

router.get('/:id', getUserDocument) //gets the entire user document of a user NOT in the session

where 'id' is the id of the user. This endpoint returns the entire document in the users collection of the users.

@aaronb12-ux aaronb12-ux changed the title Add endpoint to get usernames by Add endpoint to get usernames by id May 8, 2026
@naomitzhao naomitzhao requested review from naomitzhao and removed request for naomitzhao May 10, 2026 22:19
Copy link
Copy Markdown
Contributor

@naomitzhao naomitzhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well! Just had a nit about function naming. Also please format the files you changed with Prettier! Other than that, I can approve this soon.

import { MongoClient, ObjectId } from 'mongodb';


export async function getDocument(client: MongoClient, id: string) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function can be given a more descriptive name-- maybe getUserById

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants