mirror of
https://github.com/docmost/docmost.git
synced 2025-11-23 12:01:11 +10:00
fix pagination issue where user is not part of any space
This commit is contained in:
@ -107,7 +107,11 @@ export class PageRepo {
|
||||
return dbOrTx(this.db, trx)
|
||||
.updateTable('pages')
|
||||
.set({ ...updatePageData, updatedAt: new Date() })
|
||||
.where(pageIds.some(pageId => !isValidUUID(pageId)) ? "slugId" : "id", "in", pageIds)
|
||||
.where(
|
||||
pageIds.some((pageId) => !isValidUUID(pageId)) ? 'slugId' : 'id',
|
||||
'in',
|
||||
pageIds,
|
||||
)
|
||||
.executeTakeFirst();
|
||||
}
|
||||
|
||||
@ -161,9 +165,11 @@ export class PageRepo {
|
||||
.where('spaceId', 'in', userSpaceIds)
|
||||
.orderBy('updatedAt', 'desc');
|
||||
|
||||
const hasEmptyIds = userSpaceIds.length === 0;
|
||||
const result = executeWithPagination(query, {
|
||||
page: pagination.page,
|
||||
perPage: pagination.limit,
|
||||
hasEmptyIds,
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
@ -221,7 +221,7 @@ export class SpaceMemberRepo {
|
||||
|
||||
let query = this.db
|
||||
.selectFrom('spaces')
|
||||
.selectAll('spaces')
|
||||
.selectAll()
|
||||
.select((eb) => [this.spaceRepo.withMemberCount(eb)])
|
||||
//.where('workspaceId', '=', workspaceId)
|
||||
.where('id', 'in', userSpaceIds)
|
||||
@ -237,9 +237,12 @@ export class SpaceMemberRepo {
|
||||
);
|
||||
}
|
||||
|
||||
const hasEmptyIds = userSpaceIds.length === 0;
|
||||
|
||||
const result = executeWithPagination(query, {
|
||||
page: pagination.page,
|
||||
perPage: pagination.limit,
|
||||
hasEmptyIds,
|
||||
});
|
||||
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user