Skip to content
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

Add sId to UserType + move user route to use sId #4564

Merged
merged 3 commits into from
Apr 4, 2024
Merged

Conversation

spolu
Copy link
Contributor

@spolu spolu commented Apr 4, 2024

Description

  • Add sId to UserType
  • Move pages/api/w/[wId]/members/[uId]/index to using sId instead of ModelId
  • Refactor implementation to use a new lib/api/user.ts getUserForWorkspace
  • Update call-sites

Risk

High-ish given that it touches UserType. Mitigated by local tests of touched route (members role change) and general login

Tested:

  • Login
  • Invite by email
  • Change role
  • Run a conversation

Deploy Plan

  • deploy front

@spolu spolu requested a review from flvndvd April 4, 2024 11:34
Copy link
Contributor

@flvndvd flvndvd left a comment

Choose a reason for hiding this comment

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

LGTM, left two small comments to make TS happy.

@@ -61,8 +61,7 @@ async function handler(
});
}

const invitationId = req.query.iId;
let invitation = await getInvitation(auth, { invitationId });
Copy link
Contributor

Choose a reason for hiding this comment

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

TS won't be able to infer that req.query.iId is of type string even with the previous check on line 54. the object needs to be de-structure and the type assertion run on it.

]);

if (!user || !membership) {
const user = await getUserForWorkspace(auth, { userId: req.query.uId });
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

@spolu spolu merged commit b458004 into main Apr 4, 2024
5 checks passed
@spolu spolu deleted the spolu-users_sId branch April 4, 2024 12:24
flvndvd pushed a commit that referenced this pull request May 26, 2024
* move user route to sId

* more sId

* nit
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