@@ -6,7 +6,7 @@ import { IOrder } from "../models/order";
66import { Telegraf } from "telegraf" ;
77
88const { parsePaymentRequest } = require ( 'invoices' ) ;
9- const { ObjectId } = require ( 'mongoose' ) . Types ;
9+ import { Types } from 'mongoose' ;
1010import * as messages from './messages' ;
1111import { Order , User , Community } from '../models' ;
1212import { isIso4217 , isDisputeSolver } from '../util' ;
@@ -94,7 +94,6 @@ const validateAdmin = async (ctx: MainContext, id?: string) => {
9494 if ( user . default_community_id )
9595 community = await Community . findOne ( { _id : user . default_community_id } ) ;
9696
97- if ( community === null ) throw Error ( "Community was not found in DB" ) ;
9897 const isSolver = isDisputeSolver ( community , user ) ;
9998
10099 if ( ! user . admin && ! isSolver )
@@ -593,7 +592,7 @@ const validateParams = async (ctx: MainContext, paramNumber: number, errOutputSt
593592
594593const validateObjectId = async ( ctx : MainContext , id : string ) => {
595594 try {
596- if ( ! ObjectId . isValid ( id ) ) {
595+ if ( ! Types . ObjectId . isValid ( id ) ) {
597596 await messages . notValidIdMessage ( ctx ) ;
598597 return false ;
599598 }
@@ -647,7 +646,7 @@ const isBannedFromCommunity = async (user: UserDocument, communityId: string) =>
647646 }
648647} ;
649648
650- module . exports = {
649+ export {
651650 validateSellOrder ,
652651 validateBuyOrder ,
653652 validateUser ,
0 commit comments