Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/config/docs/enum/SellerType.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ components:
- activeSeller
- inactiveSeller
- testSeller
- holidaySeller
description: The type of seller.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ const startServer = async () => {

// Start the server setup process
startServer();
scheduleCronJobs();
// scheduleCronJobs();

export default app;
1 change: 1 addition & 0 deletions src/models/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const userSettingsSchema = new Schema<IUserSettings>(
include_active_sellers: { type: Boolean, default: true },
include_inactive_sellers: { type: Boolean, default: false },
include_test_sellers: { type: Boolean, default: false },
include_holiday_sellers: { type: Boolean, default: true },
include_trust_level_100: { type: Boolean, default: true },
include_trust_level_80: { type: Boolean, default: true },
include_trust_level_50: { type: Boolean, default: true },
Expand Down
3 changes: 2 additions & 1 deletion src/models/enums/sellerType.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum SellerType {
Active = 'activeSeller',
Inactive = 'inactiveSeller',
Test = 'testSeller'
Test = 'testSeller',
Holiday = 'holidaySeller'
}
2 changes: 2 additions & 0 deletions src/services/seller.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const buildDefaultSearchFilters = () => {
include_active_sellers: true,
include_inactive_sellers: false,
include_test_sellers: false,
include_holiday_sellers: true,
include_trust_level_100: true,
include_trust_level_80: true,
include_trust_level_50: true,
Expand All @@ -47,6 +48,7 @@ const buildBaseCriteria = (searchFilters: any): Record<string, any> => {
if (searchFilters.include_active_sellers) sellerTypeFilters.push(SellerType.Active);
if (searchFilters.include_inactive_sellers) sellerTypeFilters.push(SellerType.Inactive);
if (searchFilters.include_test_sellers) sellerTypeFilters.push(SellerType.Test);
if (searchFilters.include_holiday_sellers) sellerTypeFilters.push(SellerType.Holiday);

// include filtered seller types
if (sellerTypeFilters.length > 0) {
Expand Down
32 changes: 31 additions & 1 deletion test/mockData.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"include_active_sellers": true,
"include_inactive_sellers": true,
"include_test_sellers": true,
"include_holiday_sellers": false,
"include_trust_level_100": true,
"include_trust_level_80": true,
"include_trust_level_50": true,
Expand All @@ -76,6 +77,7 @@
"include_active_sellers": true,
"include_inactive_sellers": false,
"include_test_sellers": true,
"include_holiday_sellers": false,
"include_trust_level_100": true,
"include_trust_level_80": true,
"include_trust_level_50": false,
Expand All @@ -88,8 +90,24 @@
"user_name": "Test Three",
"email": "[email protected]",
"phone_number": "333-333-3333",
"image": "http://example.com/testThree.jpg",
"findme": "deviceGPS",
"trust_meter_rating": 50
"trust_meter_rating": 50,
"search_map_center": {
"type": "Point",
"coordinates": [-88.6298, 42.8781]
},
"search_filters": {
"include_active_sellers": true,
"include_inactive_sellers": false,
"include_test_sellers": true,
"include_holiday_sellers": true,
"include_trust_level_100": true,
"include_trust_level_80": true,
"include_trust_level_50": false,
"include_trust_level_0": false
},
"wallet_address": null
},
{
"user_settings_id": "0d0d0d-0d0d-0d0d",
Expand Down Expand Up @@ -385,6 +403,18 @@
"type": "Point",
"coordinates": [60.753873, 80.534107]
}
},
{
"seller_id": "0q0q0q-0q0q-0q0q",
"name": "Test Seller Holiday",
"description": "Test Seller Holiday Event",
"address": "Test Seller Holiday Address",
"seller_type": "holidaySeller",
"isRestricted": false,
"sell_map_center": {
"type": "Point",
"coordinates": [-88.6298, 42.8781]
}
}
],
"sellerItems": [
Expand Down
5 changes: 4 additions & 1 deletion test/services/seller.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ describe('getAllSellers function', () => {
const userData = await User.findOne({ pi_username: 'TestUser1' }) as IUser;
const sellersData = await getAllSellers(undefined, undefined, userData.pi_uid);

const expectedCount = await Seller.countDocuments({ isRestricted: { $ne: true } });
const expectedCount = await Seller.countDocuments({
isRestricted: { $ne: true },
seller_type: { $ne: 'holidaySeller' }
});
expect(sellersData).toHaveLength(expectedCount);
});

Expand Down