import { Controller , Get , Query , Headers , UseGuards , ParseIntPipe , Post , Body } from '@nestjs/common' ; import { UserGuard } from '../../../common/guards/user.guard' ; import { Auth } from '../../../common/interface/Auth' ; import { NoticeService } from '../service/notice.service' ; import { USER_RANK } from '../../../common/constant/User' ; import { CreateNoticeDto } from '../form/create_notice.dto' ; @ Controller ( 'notice/user' ) @ UseGuards ( UserGuard ) export class UserController { constructor ( private readonly service ) { } @ Get ( '/list' ) async getList ( @ Headers ( 'auth' ) auth ) { const rank = USER_RANK ; return this . service . getList ( auth . user_id , rank ) ; } @ Get ( '/set-read' ) async setNoticeRead ( @ Headers ( 'auth' ) auth , @ Query ( 'notice_id' , new ParseIntPipe ( ) ) noticeId ) { return this . service . setNoticeRead ( noticeId , auth . user_id ) ; } @ Get ( '/set-all-read' ) async setAllNoticeRead ( @ Headers ( 'auth' ) auth ) { return this . service . setAllNoticeRead ( auth . user_id ) ; } }