import { Controller , Mutation , Query } from "../../../../src" ; import { Post } from "../entity/Post" ; import { PostSaveArgs } from "../args/PostSaveArgs" ; import { PostRepository } from "../repository/PostRepository" ; import { PostsArgs } from "../args/PostsArgs" ; @ Controller ( ) export class PostController { constructor ( private postRepository ) { } @ Query ( ) posts ( args ) { return this . postRepository . find ( args ) ; } @ Query ( ) post ( { id } ) { return this . postRepository . findById ( id ) ; } @ Mutation ( ) postSave ( args ) { return this . postRepository . save ( args ) ; } @ Mutation ( ) async postDelete ( { id } ) { return this . postRepository . remove ( id ) ; } }