feat: enhance collaboration session and LiveKit integration
- Added LiveKitRoomService to manage meeting room creation and recording functionalities. - Updated CollaborationSessionSchema to create a LiveKit room upon new collaboration session creation. - Introduced meetingRoomJoinInfo field in MeetingRoomSchema to provide join tokens and server URLs for meeting rooms. - Improved LiveKitService to include user metadata in token generation and added a method to retrieve the server URL. - Enhanced error handling and authorization checks across schemas to ensure proper access control for collaboration sessions and meeting rooms.
This commit is contained in:
@@ -352,6 +352,28 @@ export class DocumentSchema extends PothosSchema {
|
||||
})
|
||||
},
|
||||
}),
|
||||
editCollaboratorPermission: t.prismaField({
|
||||
type: this.documentCollaborator(),
|
||||
args: {
|
||||
documentId: t.arg({ type: 'String', required: true }),
|
||||
userId: t.arg({ type: 'String', required: true }),
|
||||
readable: t.arg({ type: 'Boolean', required: true }),
|
||||
writable: t.arg({ type: 'Boolean', required: true }),
|
||||
},
|
||||
resolve: async (_, __, args, ctx: SchemaContext) => {
|
||||
if (ctx.isSubscription) throw new Error('Not allowed')
|
||||
// check if ctx user is owner of document
|
||||
const document = await this.prisma.document.findUnique({
|
||||
where: { id: args.documentId },
|
||||
})
|
||||
if (!document) throw new Error('Document not found')
|
||||
if (document.ownerId !== ctx.http?.me?.id) throw new Error('User is not owner of document')
|
||||
return await this.prisma.documentCollaborator.update({
|
||||
where: { documentId_userId: { documentId: args.documentId, userId: args.userId } },
|
||||
data: { readable: args.readable, writable: args.writable },
|
||||
})
|
||||
},
|
||||
}),
|
||||
}))
|
||||
|
||||
this.builder.subscriptionFields((t) => ({
|
||||
|
||||
Reference in New Issue
Block a user