File tree Expand file tree Collapse file tree 6 files changed +15
-11
lines changed Expand file tree Collapse file tree 6 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ ADMIN_API_USERNAME="ADD YOUR ADMIN API USERNAME"
11
11
ADMIN_API_PASSWORD = " ADD YOUR ADMIN API PASSWORD"
12
12
13
13
MONGODB_URL = mongodb://localhost:27017/demoDB
14
+ MONGODB_MIN_POOL_SIZE = 1
15
+ MONGODB_MAX_POOL_SIZE = 5
16
+
14
17
SENTRY_DSN = " ADD YOUR SENTRY DSN"
15
18
16
19
PORT = 8001
Original file line number Diff line number Diff line change @@ -6,10 +6,13 @@ import { env } from "../utils/env";
6
6
export const connectDB = async ( ) => {
7
7
try {
8
8
// Only log the MongoDB URL in non-production environments
9
- if ( process . env . NODE_ENV !== 'production' ) {
9
+ if ( env . NODE_ENV !== 'production' ) {
10
10
logger . info ( `Connecting to MongoDB with URL: ${ env . MONGODB_URL } ` ) ;
11
11
}
12
- await mongoose . connect ( env . MONGODB_URL ) ;
12
+ await mongoose . connect ( env . MONGODB_URL , {
13
+ minPoolSize : env . MONGODB_MIN_POOL_SIZE ,
14
+ maxPoolSize : env . MONGODB_MAX_POOL_SIZE
15
+ } ) ;
13
16
logger . info ( "Successful connection to MongoDB." ) ;
14
17
} catch ( error ) {
15
18
logger . error ( 'Failed connection to MongoDB:' , error ) ;
Original file line number Diff line number Diff line change @@ -70,13 +70,11 @@ const sellerSchema = new Schema<ISeller>(
70
70
) ;
71
71
72
72
// Creating a text index on the 'name' and 'description' fields
73
- sellerSchema . index ( { name : " text" , description : " text" } ) ;
73
+ sellerSchema . index ( { ' name' : ' text' , ' description' : ' text' } ) ;
74
74
75
75
// Creating a 2dsphere index for the sell_map_center field
76
76
sellerSchema . index ( { 'sell_map_center.coordinates' : '2dsphere' } ) ;
77
- sellerSchema . index (
78
- { 'updatedAt' : - 1 , 'sell_map_center.coordinates' : '2dsphere' }
79
- ) ;
77
+ sellerSchema . index ( { 'sell_map_center' : '2dsphere' , 'updatedAt' : - 1 } ) ;
80
78
81
79
// Creating the Seller model from the schema
82
80
const Seller = mongoose . model < ISeller > ( "Seller" , sellerSchema ) ;
Original file line number Diff line number Diff line change @@ -33,9 +33,6 @@ app.use(cookieParser());
33
33
34
34
// serve static files for Swagger documentation
35
35
app . use ( '/api/docs' , express . static ( path . join ( __dirname , '../config/docs' ) ) ) ;
36
- app . use ( '/api/docs/enum' , express . static ( path . join ( __dirname , '../config/docs/enum' ) ) ) ;
37
- // Serve Swagger UI static files
38
- app . use ( '/api/docs/swagger-ui' , express . static ( path . join ( __dirname , '../node_modules/swagger-ui-dist' ) ) ) ;
39
36
40
37
// Swagger OpenAPI documentation
41
38
app . use ( "/api/docs" , docRouter ) ;
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ export const env = {
13
13
ADMIN_API_PASSWORD : process . env . ADMIN_API_PASSWORD || '' ,
14
14
UPLOAD_PATH : process . env . UPLOAD_PATH || '' ,
15
15
MONGODB_URL : process . env . MONGODB_URL || '' ,
16
+ MONGODB_MIN_POOL_SIZE : Number ( process . env . MONGODB_MIN_POOL_SIZE ) || 1 ,
17
+ MONGODB_MAX_POOL_SIZE : Number ( process . env . MONGODB_MAX_POOL_SIZE ) || 5 ,
16
18
SENTRY_DSN : process . env . SENTRY_DSN || '' ,
17
19
CLOUDINARY_CLOUD_NAME : process . env . CLOUDINARY_CLOUD_NAME || '' ,
18
20
CLOUDINARY_API_KEY : process . env . CLOUDINARY_API_KEY || '' ,
Original file line number Diff line number Diff line change @@ -9,14 +9,15 @@ jest.mock('../../src/helpers/location', () => ({
9
9
10
10
describe ( 'reportSanctionedSellers function' , ( ) => {
11
11
it ( 'should build sanctioned sellers report for affected sellers' , async ( ) => {
12
- ( reverseLocationDetails as jest . Mock )
12
+ ( reverseLocationDetails as jest . Mock )
13
13
. mockResolvedValueOnce ( { data : { display_name : 'Cuba' } } )
14
14
. mockResolvedValueOnce ( { data : { display_name : 'Iran' } } )
15
15
. mockResolvedValueOnce ( { data : { display_name : 'North Korea' } } )
16
16
. mockResolvedValueOnce ( { data : { display_name : 'Syria' } } )
17
17
. mockResolvedValueOnce ( { data : { display_name : 'Republic of Crimea' } } )
18
18
. mockResolvedValueOnce ( { data : { display_name : 'Donetsk Oblast' } } )
19
- . mockResolvedValueOnce ( { data : { display_name : 'Luhansk Oblast' } } ) ;
19
+ . mockResolvedValueOnce ( { data : { display_name : 'Luhansk Oblast' } } )
20
+ . mockResolvedValue ( { data : { display_name : 'Russia' } } ) ;
20
21
21
22
const sanctionedSellers = await reportSanctionedSellers ( ) ;
22
23
You can’t perform that action at this time.
0 commit comments