ToolJet/server/src/controllers/comment_users.controller.ts
Gandharv b5850a4694
feat: trigger mail when user is mentioned in comment (#3443)
* feat: trigger mail when user is mentioned in comment

* reset email service

* fix backspace issue

* open comment on view comment clicked from email

* add helper to highlight user in mail

* reset mentioned input value when value turns empty in parent

* fix test

* use where condition + throw error

* add userId

* feat: add notification center (#3484)

* remove commented code
2022-07-25 11:14:59 +05:30

31 lines
1.1 KiB
TypeScript

import { Controller, Get, Body, Param, UseGuards, Patch, Query } from '@nestjs/common';
import { CommentUsersService } from '@services/comment_users.service';
import { JwtAuthGuard } from '../../src/modules/auth/jwt-auth.guard';
import { User } from 'src/decorators/user.decorator';
import { UpdateCommentUserDto } from '@dto/comment-user.dto';
@Controller('comment_notifications')
export class CommentUsersController {
constructor(private commentUsersService: CommentUsersService) {}
@UseGuards(JwtAuthGuard)
@Get()
public async index(@User() user, @Query() query) {
const notifications = await this.commentUsersService.findAll(user.id, query.isRead);
return notifications;
}
@UseGuards(JwtAuthGuard)
@Patch(':id')
public async update(@Param('id') id: string, @Body() body: UpdateCommentUserDto) {
const notification = await this.commentUsersService.update(id, body);
return notification;
}
@UseGuards(JwtAuthGuard)
@Patch()
public async updateAll(@User() user, @Body() body: UpdateCommentUserDto) {
const notifications = await this.commentUsersService.updateAll(user.id, body);
return notifications;
}
}