Skip to content

Commit

Permalink
removed contact channel from user object
Browse files Browse the repository at this point in the history
  • Loading branch information
fomalhautb committed Oct 1, 2024
1 parent d556a5e commit 3956669
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 235 deletions.
26 changes: 2 additions & 24 deletions apps/backend/src/app/api/v1/users/crud.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,14 @@ export const userFullInclude = {
providerConfig: true,
},
},
contactChannels: true,
authMethods: {
include: {
passwordAuthMethod: true,
otpAuthMethod: true,
oauthAuthMethod: {
include: {
oauthProviderConfig: {
include: {
proxiedOAuthConfig: true,
standardOAuthConfig: true,
},
}
}
},
}
},
connectedAccounts: {
include: {
oauthProviderConfig: {
include: {
proxiedOAuthConfig: true,
standardOAuthConfig: true,
},
}
oauthAuthMethod: true,
}
},
contactChannels: true,
teamMembers: {
include: {
team: true,
Expand Down Expand Up @@ -105,8 +86,6 @@ export const userPrismaToCrud = (
throw new StackAssertionError("User cannot have more than one selected team; this should never happen");
}

const contactChannels = prisma.contactChannels.map(c => contactChannelToCrud(c));

// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
const primaryEmailContactChannel = prisma.contactChannels.find((c) => c.type === 'EMAIL' && c.isPrimary);
const passwordAuth = prisma.authMethods.find((m) => m.passwordAuthMethod);
Expand All @@ -133,7 +112,6 @@ export const userPrismaToCrud = (
selected_team_id: selectedTeamMembers[0]?.teamId ?? null,
selected_team: selectedTeamMembers[0] ? teamPrismaToCrud(selectedTeamMembers[0]?.team) : null,
last_active_at_millis: lastActiveAtMillis,
contact_channels: contactChannels,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ it("should allow signing in to existing accounts", async ({ expect }) => {
}
`);
});
// TODO: check auth methods

it("should not allow signing in with an e-mail that never signed up", async ({ expect }) => {
const response = await niceBackendFetch("/api/v1/auth/password/sign-in", {
Expand Down
30 changes: 0 additions & 30 deletions apps/e2e/tests/backend/endpoints/api/v1/team-memberships.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,6 @@ it("creates a team and manage users on the server", async ({ expect }) => {
"auth_with_email": true,
"client_metadata": null,
"client_read_only_metadata": null,
"contact_channels": [
{
"id": "<stripped UUID>",
"is_primary": true,
"is_verified": true,
"type": "email",
"used_for_auth": true,
"value": "<stripped UUID>@stack-generated.example.com",
},
],
"display_name": null,
"has_password": false,
"id": "<stripped UUID>",
Expand All @@ -99,16 +89,6 @@ it("creates a team and manage users on the server", async ({ expect }) => {
"auth_with_email": true,
"client_metadata": null,
"client_read_only_metadata": null,
"contact_channels": [
{
"id": "<stripped UUID>",
"is_primary": true,
"is_verified": true,
"type": "email",
"used_for_auth": true,
"value": "<stripped UUID>@stack-generated.example.com",
},
],
"display_name": null,
"has_password": false,
"id": "<stripped UUID>",
Expand Down Expand Up @@ -157,16 +137,6 @@ it("creates a team and manage users on the server", async ({ expect }) => {
"auth_with_email": true,
"client_metadata": null,
"client_read_only_metadata": null,
"contact_channels": [
{
"id": "<stripped UUID>",
"is_primary": true,
"is_verified": true,
"type": "email",
"used_for_auth": true,
"value": "<stripped UUID>@stack-generated.example.com",
},
],
"display_name": null,
"has_password": false,
"id": "<stripped UUID>",
Expand Down
Loading

0 comments on commit 3956669

Please sign in to comment.