Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta01 arthur #5

Merged
merged 6 commits into from
Jul 30, 2020
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
5 changes: 2 additions & 3 deletions packages/common/src/entities/Order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ class Order extends DBObject<IOrder, IOrderCreateObject> implements IOrder {
/**
* Deliver Notes to specify alternative deliveries addresses.
*
* @type {string}
* @type {String}
* @memberof Order
*/
@Schema({ type: string, required: false })
@Schema({ type: String, required: false })
@Column()
deliveryNotes?: string;

Expand Down Expand Up @@ -403,7 +403,6 @@ class Order extends DBObject<IOrder, IOrderCreateObject> implements IOrder {
return 'MAUVAIS_STATUS';
}
}

}

export default Order;
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export class GeoLocationResolver {
}: {
geoLocation;
options?: IGetGeoLocationProductsOptions;
category?;
category?: string;
pagingOptions;
searchText?: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ type Query {

geoLocationProductsByCategory(
geoLocation: GeoLocationFindInput!
category: ProductsCategorySearchInput
category: String
pagingOptions: PagingOptionsInput
options: GetGeoLocationProductsOptions
searchText: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
type Query {
getCoseMerchants(geoLocation: GeoLocationFindInput!): [Warehouse]!

getCloseMerchantsCategory(
geoLocation: GeoLocationFindInput!
category: ProductsCategorySearchInput
category: String
): [Warehouse]!
}

type Query {
getCloseMerchantsCategory(
geoLocation: GeoLocationFindInput!
category: String
): [Warehouse]!

getCloseMerchantsCategory(
geoLocation: GeoLocationFindInput!
category: String
): [Warehouse]!
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class GeoLocationMerchantsResolver {
async getCloseMerchantsCategory(
_,
{ geoLocation }: { geoLocation: IGeoLocation },
{ category }: { category: ICategory }
{ category }: { category: string }
) {
let merchants = await this.geoLocationsWarehousesService.getCloseMerchantsCategory(
geoLocation,
Expand Down
36 changes: 36 additions & 0 deletions packages/core/src/graphql/warehouses/warehouse.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,42 @@ export class WarehouseResolver {
return merchants.map((m) => new Warehouse(m));
}

@Query()
async getMerchantsByService(
_,
{
searchName,
geoLocation,
}: { searchName: string; geoLocation: IGeoLocation }
) {
const count = await this._warehousesService.Model.find({
ordersPhone: { $regex: searchName, $options: 'i' },
})
.countDocuments()
.exec();

let merchants = await this._warehousesService.getMerchants(
{ ordersPhone: { $regex: searchName, $options: 'i' } },
{ skip: 0, limit: count }
);

if (geoLocation) {
merchants = merchants.sort(
(m1, m2) =>
Utils.getDistance(
new GeoLocation(m1.geoLocation),
new GeoLocation(geoLocation)
) -
Utils.getDistance(
new GeoLocation(m2.geoLocation),
new GeoLocation(geoLocation)
)
);
}

return merchants.map((m) => new Warehouse(m));
}

@Mutation()
async warehouseLogin(
_,
Expand Down
5 changes: 5 additions & 0 deletions packages/core/src/graphql/warehouses/warehouses.types.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ type Query {
searchName: String!
geoLocation: GeoLocationFindInput
): [Warehouse]!

getMerchantsByService(
searchName: String!
geoLocation: GeoLocationFindInput
): [Warehouse]!
}

type ExistingCustomersByStores {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import {
} from '@modules/server.common/interfaces/IProduct';
import WarehouseProduct from '@modules/server.common/entities/WarehouseProduct';
import { IGetGeoLocationProductsOptions } from 'graphql/geo-locations/geo-location.resolver';
import ICategory from '@modules/server.common/interfaces/ICategory';

@injectable()
@routerName('geo-location-products')
Expand Down Expand Up @@ -137,7 +136,7 @@ export class GeoLocationsProductsService
async geoLocationProductsByCategory(
@serialization((g: IGeoLocation) => new GeoLocation(g))
geoLocation: GeoLocation,
category: ICategory,
category: string,
pagingOptions,
options?: IGetGeoLocationProductsOptions,
searchText?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export class GeoLocationsWarehousesService
@asyncListener()
async getCloseMerchantsCategory(
geoLocation: IGeoLocation,
category: ICategory,
category: string,
maxDistance: number,
options: {
fullProducts: boolean;
Expand All @@ -201,6 +201,11 @@ export class GeoLocationsWarehousesService
},
},
},

// Service filtering
//ordersPhone: { $regex: category, $options: 'i' },
//username: { $regex: category, $options: 'i' },

options.activeOnly ? { isActive: true } : {},
merchantsIds && merchantsIds.length > 0
? {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/services/warehouses/WarehousesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class WarehousesService extends DBService<Warehouse>

/**
* Get Merchants
{ ordersPhone: { $regex: searchName, $options: 'i' } }
*
* @param {*} findInput
* @param {IPagingOptions} pagingOptions
Expand Down
4 changes: 2 additions & 2 deletions packages/shop-mobile-ionic/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ NO_INTERNET_LOGO=assets/imgs/bellem_logo.png

COMPANY_NAME=BellEM Co. LTD

GOOGLE_MAPS_API_KEY=AIzaSyAvUNNXFK3xlzKE21uNkSVM1wROVAjd_Ak
GOOGLE_MAPS_API_KEY=AIzaSyDudKVRLfNoQFm9JFvGQkGfdxZAbgqXLDE

GOOGLE_ANALYTICS_API_KEY=AIzaSyAvUNNXFK3xlzKE21uNkSVM1wROVAjd_Ak
GOOGLE_ANALYTICS_API_KEY=AIzaSyDudKVRLfNoQFm9JFvGQkGfdxZAbgqXLDE
FAKE_UUID=

# Not secret MixPanel Token
Expand Down
4 changes: 2 additions & 2 deletions packages/shop-mobile-ionic/config.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="cm.bellem.mobile.customer" version="0.2.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Bellem Shop</name>
<description>Bellem Mobile Shop App</description>
<name>Bellem</name>
<description>Bellem Mobile App</description>
<author email="[email protected]" href="https://ever.co/">Bellem</author>
<content src="index.html" />
<access origin="*" />
Expand Down
10 changes: 7 additions & 3 deletions packages/shop-mobile-ionic/scripts/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ export const env: any = cleanEnv(

COMPANY_NAME: str({ default: 'BellEm. LTD' }),

GOOGLE_MAPS_API_KEY: str({ default: 'AIzaSyAvUNNXFK3xlzKE21uNkSVM1wROVAjd_Ak' }),
GOOGLE_MAPS_API_KEY: str({
default: 'AIzaSyAvUNNXFK3xlzKE21uNkSVM1wROVAjd_Ak',
}),

GOOGLE_ANALYTICS_API_KEY: str({ default: 'AIzaSyAvUNNXFK3xlzKE21uNkSVM1wROVAjd_Ak' }),
GOOGLE_ANALYTICS_API_KEY: str({
default: 'AIzaSyAvUNNXFK3xlzKE21uNkSVM1wROVAjd_Ak',
}),
FAKE_UUID: str({ default: uuid() }),

// Not secret MixPanel Token
Expand Down Expand Up @@ -144,7 +148,7 @@ export const env: any = cleanEnv(
// Graphql endpoints for apollo services
GQL_ENDPOINT: str({ default: 'http://bellem.cm:5555/graphql' }),
GQL_SUBSCRIPTIONS_ENDPOINT: str({
default: 'ws://localhost:5050/subscriptions',
default: 'ws://bellem.cm:5050/subscriptions',
}),
SERVICES_ENDPOINT: str({ default: 'http://bellem.cm:5500' }),
HTTPS_SERVICES_ENDPOINT: str({ default: 'https://bellem.cm:5501' }),
Expand Down
Loading