import Place from "../../../entities/Place" ; import User from "../../../entities/User" ; import { AddPlaceMutationArgs , AddPlaceResponse } from "../../../types/graph" ; import { Resolvers } from "../../../types/resolvers" ; import privateResolver from "../../../utils/privateResolver" ; const resolvers = { Mutation : { AddPlace : privateResolver ( async ( _ , args , { req } ) : Promise < AddPlaceResponse > => { const user = req . user ; try { await Place . create ( { ... args , user } ) . save ( ) ; return { ok : true , error : null } ; } catch ( error ) { return { ok : false , error : error . message } ; } } ) } } ; export default resolvers ;