import * as express from 'express' ; import { checkRequestAdminApiVersionHeaders , checkRequestContentType , addAcceptPatchResponseHeader , } from '../middlewares/adminApiHeaders' ; import errorHandler , { wrapAsync } from '../middlewares/errorHandler' ; import sendSuccess from '../middlewares/sendSuccess' ; import { getUser , postUser , putUser , deleteUser , patchUserPayId , } from '../middlewares/users' ; const adminApiRouter = express . Router ( ) ; /**
 * Routes for the PayID Admin API.
 */ adminApiRouter . use ( '/:payId' , addAcceptPatchResponseHeader ) . use ( '/*' , checkRequestContentType , checkRequestAdminApiVersionHeaders ) . get ( '/:payId' , wrapAsync ( getUser ) , sendSuccess ) . post ( '/' , express . json ( ) , wrapAsync ( postUser ) , sendSuccess ) . put ( '/:payId' , express . json ( ) , wrapAsync ( putUser ) , sendSuccess ) . delete ( '/:payId' , wrapAsync ( deleteUser ) , sendSuccess ) . patch ( '/:payId' , express . json ( { type : 'application/merge-patch+json' } ) , wrapAsync ( patchUserPayId ) , sendSuccess ) . use ( errorHandler ) ; export default adminApiRouter ;