import { Args , Mutation , Query , Resolver } from '@nestjs/graphql' ; import { Media } from '@medium-stories/entities' ; import { MediaService } from '../services/media.service' ; @ Resolver ( 'Media' ) export class MediaResolver { constructor ( private readonly mediaService ) { } @ Query ( 'medias' ) async getMedias ( ) { return this . mediaService . find ( ) ; } @ Query ( 'media' ) async getMedia ( @ Args ( 'id' ) id ) { return this . mediaService . findOne ( id ) ; } @ Mutation ( 'singleUpload' ) async singleUpload ( @ Args ( 'file' ) file ) { const { stream , filename , mimetype , encoding } = await file ; return { filename , mimetype , encoding } ; } }