twilio connect

This commit is contained in:
m5r
2022-05-15 00:35:51 +02:00
parent 845249bc53
commit a435cb5b75
7 changed files with 95 additions and 74 deletions

View File

@ -9,10 +9,11 @@ import authenticator from "./authenticator.server";
import { AuthenticationError } from "./errors";
import { commitSession, destroySession, getSession } from "./session.server";
export type SessionOrganization = Pick<Organization, "id"> & { role: MembershipRole };
export type SessionOrganization = Pick<Organization, "id" | "twilioAccountSid"> & { role: MembershipRole };
export type SessionUser = Omit<User, "hashedPassword"> & {
organizations: SessionOrganization[];
};
export type SessionData = SessionUser & { currentOrganization: SessionOrganization };
const SP = new SecurePassword();
@ -38,7 +39,7 @@ export async function login({ form }: FormStrategyVerifyParams): Promise<Session
memberships: {
select: {
organization: {
select: { id: true },
select: { id: true, twilioAccountSid: true },
},
role: true,
},
@ -150,7 +151,7 @@ export async function refreshSessionData(request: Request) {
memberships: {
select: {
organization: {
select: { id: true },
select: { id: true, twilioAccountSid: true },
},
role: true,
},