-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update and retrieve display name #193
Update and retrieve display name #193
Conversation
…into update-and-retrieve-display-name
…into update-and-retrieve-display-name
server/src/index.ts
Outdated
|
||
const success = await getConnectedUserDisplayName(userId); | ||
if (success) { | ||
res.json(success); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you rename this to something other than success. the variable name is not descriptive enough for people to know that it is a displayName: "string". You could rename it displayName
.
@@ -1,6 +1,19 @@ | |||
import { distanceBetween, geohashForLocation, geohashQueryBounds } from 'geofire-common' | |||
import { connectedUsersCollection } from '../utilities/firebaseInit' | |||
|
|||
export const getConnectedUserDisplayName = async (socketID: string) => { | |||
try { | |||
const snap = await connectedUsersCollection.doc(socketID).get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you change this to user
instead of snap
?
The API endpoint used for returning the displayName is So I'm going to update the GET route to just return the document in json. This will also prevent us from trying to build more routes to just return one parameter in a user doc. |
…rn all ConnectedUser document information. Updated /users?userId GET endpoint to match this change.
Everything has been tested and works 👍 |
Resolves #183
To avoid confusion between functions involving multiple users and those for the current user, I've renamed the
getConnectedUsers.ts
file togetMultipleConnectedUsers.ts
and created a seperate file for a function to get the display name for the author of the message.