add recent changes tab to home

This commit is contained in:
Philipinho
2023-11-13 12:36:56 +00:00
parent f5cd140a7d
commit dc65fbafa4
17 changed files with 240 additions and 36 deletions
+19 -3
View File
@@ -50,8 +50,14 @@ export class PageController {
@HttpCode(HttpStatus.OK)
@Post('update')
async update(@Body() updatePageDto: UpdatePageDto) {
return this.pageService.update(updatePageDto.id, updatePageDto);
async update(
@Req() req: FastifyRequest,
@Body() updatePageDto: UpdatePageDto,
) {
const jwtPayload = req['user'];
const userId = jwtPayload.sub;
return this.pageService.update(updatePageDto.id, updatePageDto, userId);
}
@HttpCode(HttpStatus.OK)
@@ -72,6 +78,16 @@ export class PageController {
return this.pageOrderService.movePage(movePageDto);
}
@HttpCode(HttpStatus.OK)
@Post('recent')
async getRecentWorkspacePages(@Req() req: FastifyRequest) {
const jwtPayload = req['user'];
const workspaceId = (
await this.workspaceService.getUserCurrentWorkspace(jwtPayload.sub)
).id;
return this.pageService.getRecentWorkspacePages(workspaceId);
}
@HttpCode(HttpStatus.OK)
@Post()
async getWorkspacePages(@Req() req: FastifyRequest) {
@@ -79,7 +95,7 @@ export class PageController {
const workspaceId = (
await this.workspaceService.getUserCurrentWorkspace(jwtPayload.sub)
).id;
return this.pageService.getByWorkspaceId(workspaceId);
return this.pageService.getSidebarPagesByWorkspaceId(workspaceId);
}
@HttpCode(HttpStatus.OK)