import * as Boom from "@hapi/boom" ; import { ValidationSchema } from "@triptyk/nfw-core" ; import { MimeTypes } from "../enums/mime-type.enum" ; import { Document } from "../models/document.model" ; export const get = { id : { errorMessage : "Please provide a valid id" , in : [ "params" ] , isInt : true , toInt : true } } ; export const update = { id : { errorMessage : "Please provide a valid id" , in : [ "params" ] , isInt : true , toInt : true } } ; export const remove = { id : { errorMessage : "Please provide a valid id" , in : [ "params" ] , isInt : true , toInt : true } } ; desc param file param cb export const validateFile = ( req , file , next ) => { if ( Object . values ( MimeTypes ) . includes ( file . mimetype as any ) ) { return next ( null , true ) ; } return next ( Boom . unsupportedMediaType ( "File mimetype not supported" ) , false ) ; } ;