mirror of
https://github.com/docmost/docmost.git
synced 2026-05-21 17:22:54 +08:00
feat: favorites (#2103)
* feat: favorites and templates(ee) * rename migrations * fix sidebar * cleanup tabs * fix * turn off templates * cleanup * uuid validation
This commit is contained in:
@@ -290,6 +290,32 @@ export class SpaceMemberRepo {
|
||||
return membership.map((space) => space.id);
|
||||
}
|
||||
|
||||
async getUserRolesForSpaces(
|
||||
userId: string,
|
||||
spaceIds: string[],
|
||||
): Promise<{ spaceId: string; role: string }[]> {
|
||||
if (spaceIds.length === 0) return [];
|
||||
|
||||
return this.db
|
||||
.selectFrom('spaceMembers')
|
||||
.select(['spaceId', 'role'])
|
||||
.where('userId', '=', userId)
|
||||
.where('spaceId', 'in', spaceIds)
|
||||
.unionAll(
|
||||
this.db
|
||||
.selectFrom('spaceMembers')
|
||||
.innerJoin(
|
||||
'groupUsers',
|
||||
'groupUsers.groupId',
|
||||
'spaceMembers.groupId',
|
||||
)
|
||||
.select(['spaceMembers.spaceId', 'spaceMembers.role'])
|
||||
.where('groupUsers.userId', '=', userId)
|
||||
.where('spaceMembers.spaceId', 'in', spaceIds),
|
||||
)
|
||||
.execute();
|
||||
}
|
||||
|
||||
async getUserSpaces(userId: string, pagination: PaginationOptions) {
|
||||
let query = this.db
|
||||
.selectFrom('spaces')
|
||||
|
||||
Reference in New Issue
Block a user