import { Args , ID , Mutation , Query , Resolver } from '@nestjs/graphql' ; import { CreateNotificationInput } from '../model/create-notification.input' ; import { Notification } from '../model/notification.model' ; import { UpdateNotificationInput } from '../model/update-notification.input' ; import { NotificationService } from '../service/notification.service' ; @ Resolver ( ( ) => Notification ) export class NotificationResolver { constructor ( private readonly notificationService ) { } @ Mutation ( ( ) => Notification ) createNotification ( @ Args ( 'input' ) input ) { return this . notificationService . create ( input ) ; } @ Mutation ( ( ) => Notification ) updateNotification ( @ Args ( 'id' , { type : ( ) => ID } ) id , @ Args ( 'input' ) input ) { return this . notificationService . update ( { id } , input ) ; } @ Query ( ( ) => Notification ) notification ( @ Args ( 'id' , { type : ( ) => ID } ) id ) { return this . notificationService . findOne ( { id } ) ; } @ Query ( ( ) => [ Notification ] ) notificationByUserId ( @ Args ( 'userId' ) userId ) { return this . notificationService . findByUserId ( userId ) ; } @ Query ( ( ) => [ Notification ] ) notificationByTargetId ( @ Args ( 'targetId' ) targetId ) { return this . notificationService . findByTargetId ( targetId ) ; } }