Init create/admin call links flow

This commit is contained in:
Jamie Kyle 2024-06-10 08:23:43 -07:00 committed by GitHub
parent 53b8f5f152
commit f19f0fb47d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 1256 additions and 149 deletions

View file

@ -92,7 +92,7 @@ export async function insertCallLink(callLink: CallLinkType): Promise<void> {
export async function updateCallLinkState(
roomId: string,
callLinkState: CallLinkStateType
): Promise<void> {
): Promise<CallLinkType> {
const { name, restrictions, expiration, revoked } = callLinkState;
const db = await getWritableInstance();
const restrictionsValue = callLinkRestrictionsSchema.parse(restrictions);
@ -103,9 +103,12 @@ export async function updateCallLinkState(
restrictions = ${restrictionsValue},
expiration = ${expiration},
revoked = ${revoked ? 1 : 0}
WHERE roomId = ${roomId};
WHERE roomId = ${roomId}
RETURNING *;
`;
db.prepare(query).run(params);
const row = db.prepare(query).get(params);
strictAssert(row, 'Expected row to be returned');
return callLinkFromRecord(callLinkRecordSchema.parse(row));
}
export async function updateCallLinkAdminKeyByRoomId(