import { DocumentDefinition , FilterQuery , UpdateQuery , QueryOptions , } from "mongoose" ; import Post , { PostDocument } from "../model/post.model" ; export function createPost ( input ) { return Post . create ( input ) ; } export function findPost ( query , options = { lean : true } ) { return Post . findOne ( query , { } , options ) ; } export function findAndUpdate ( query , update , options ) { return Post . findOneAndUpdate ( query , update , options ) ; } export function deletePost ( query ) { return Post . deleteOne ( query ) ; }