mirror of
https://github.com/docmost/docmost.git
synced 2025-11-20 10:21:09 +10:00
feat: keep track of page contributors (#959)
* WIP * feat: store and retrieve page contributors
This commit is contained in:
@ -46,6 +46,7 @@ export class PageController {
|
||||
includeContent: true,
|
||||
includeCreator: true,
|
||||
includeLastUpdatedBy: true,
|
||||
includeContributors: true,
|
||||
});
|
||||
|
||||
if (!page) {
|
||||
@ -93,7 +94,7 @@ export class PageController {
|
||||
}
|
||||
|
||||
return this.pageService.update(
|
||||
updatePageDto.pageId,
|
||||
page,
|
||||
updatePageDto,
|
||||
user.id,
|
||||
);
|
||||
|
||||
@ -112,21 +112,32 @@ export class PageService {
|
||||
}
|
||||
|
||||
async update(
|
||||
pageId: string,
|
||||
page: Page,
|
||||
updatePageDto: UpdatePageDto,
|
||||
userId: string,
|
||||
): Promise<Page> {
|
||||
const contributors = new Set<string>(page.contributorIds);
|
||||
contributors.add(userId);
|
||||
const contributorIds = Array.from(contributors);
|
||||
|
||||
await this.pageRepo.updatePage(
|
||||
{
|
||||
title: updatePageDto.title,
|
||||
icon: updatePageDto.icon,
|
||||
lastUpdatedById: userId,
|
||||
updatedAt: new Date(),
|
||||
contributorIds: contributorIds,
|
||||
},
|
||||
pageId,
|
||||
page.id,
|
||||
);
|
||||
|
||||
return await this.pageRepo.findById(pageId);
|
||||
return await this.pageRepo.findById(page.id, {
|
||||
includeSpace: true,
|
||||
includeContent: true,
|
||||
includeCreator: true,
|
||||
includeLastUpdatedBy: true,
|
||||
includeContributors: true,
|
||||
});
|
||||
}
|
||||
|
||||
withHasChildren(eb: ExpressionBuilder<DB, 'pages'>) {
|
||||
|
||||
Reference in New Issue
Block a user