Loading packages/admin-web-angular/src/app/pages/+orders/+order/order.component.ts +3 −3 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ export class OrderComponent implements OnDestroy { details.push(warehouse.contactPhone); details.push(warehouse.contactEmail); } if (warehouse.geoLocation) { if (warehouse && warehouse.geoLocation) { details.push(this.getFullAddress(warehouse.geoLocation)); } return details.filter((d) => d); Loading @@ -96,7 +96,7 @@ export class OrderComponent implements OnDestroy { details.push(user.phone); details.push(user.email); } if (user.geoLocation) { if (user && user.geoLocation) { details.push(user.fullAddress); user.geoLocation.notes = Loading @@ -119,7 +119,7 @@ export class OrderComponent implements OnDestroy { ); details.push(carrier.phone); } if (carrier.geoLocation) { if (carrier && carrier.geoLocation) { details.push(this.getFullAddress(carrier.geoLocation)); } return details.filter((d) => d); Loading packages/admin-web-angular/src/app/pages/+orders/orders.component.ts +1 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,6 @@ import { Component } from '@angular/core'; @Component({ selector: 'ea-orders', templateUrl: './orders.component.html', styleUrls: ['/orders.component.scss'], styleUrls: ['./orders.component.scss'], }) export class OrdersComponent {} packages/core/src/graphql/orders/order.resolver.ts +4 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import Product from '@modules/server.common/entities/Product'; import * as _ from 'lodash'; import { ObjectId } from 'bson'; import { FakeOrdersService } from '../../services/fake-data/FakeOrdersService'; import { firstValueFrom } from 'rxjs'; @Resolver('Order') export class OrderResolver { Loading Loading @@ -612,7 +613,9 @@ export class OrderResolver { @Query('getOrder') async getOrder(_context, { id }: { id: string }): Promise<Order> { return this._ordersService.get(id).pipe(first()).toPromise(); return firstValueFrom( this._ordersService.get(id) ); } @Query('orders') Loading packages/core/src/services/orders/OrdersService.ts +9 −11 Original line number Diff line number Diff line Loading @@ -930,22 +930,20 @@ export class OrdersService extends DBService<Order> id: string, options: { populateWarehouse?: boolean; populateCarrier?: boolean } = {} ): Promise<Order> { let toPopulate = ''; const query = this.Model.findById(id); if (options.populateCarrier) { toPopulate += 'carrier '; query.populate('carrier'); } if (options.populateWarehouse) { toPopulate += 'warehouse '; query.populate('warehouse'); } return new Order( (await this.Model.findById(id) .populate(toPopulate) ( await query .sort({ _createdAt: -1, orderNumber: -1 }) .lean() .exec()) as IOrder .exec() ) as IOrder ); } Loading Loading
packages/admin-web-angular/src/app/pages/+orders/+order/order.component.ts +3 −3 Original line number Diff line number Diff line Loading @@ -76,7 +76,7 @@ export class OrderComponent implements OnDestroy { details.push(warehouse.contactPhone); details.push(warehouse.contactEmail); } if (warehouse.geoLocation) { if (warehouse && warehouse.geoLocation) { details.push(this.getFullAddress(warehouse.geoLocation)); } return details.filter((d) => d); Loading @@ -96,7 +96,7 @@ export class OrderComponent implements OnDestroy { details.push(user.phone); details.push(user.email); } if (user.geoLocation) { if (user && user.geoLocation) { details.push(user.fullAddress); user.geoLocation.notes = Loading @@ -119,7 +119,7 @@ export class OrderComponent implements OnDestroy { ); details.push(carrier.phone); } if (carrier.geoLocation) { if (carrier && carrier.geoLocation) { details.push(this.getFullAddress(carrier.geoLocation)); } return details.filter((d) => d); Loading
packages/admin-web-angular/src/app/pages/+orders/orders.component.ts +1 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,6 @@ import { Component } from '@angular/core'; @Component({ selector: 'ea-orders', templateUrl: './orders.component.html', styleUrls: ['/orders.component.scss'], styleUrls: ['./orders.component.scss'], }) export class OrdersComponent {}
packages/core/src/graphql/orders/order.resolver.ts +4 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ import Product from '@modules/server.common/entities/Product'; import * as _ from 'lodash'; import { ObjectId } from 'bson'; import { FakeOrdersService } from '../../services/fake-data/FakeOrdersService'; import { firstValueFrom } from 'rxjs'; @Resolver('Order') export class OrderResolver { Loading Loading @@ -612,7 +613,9 @@ export class OrderResolver { @Query('getOrder') async getOrder(_context, { id }: { id: string }): Promise<Order> { return this._ordersService.get(id).pipe(first()).toPromise(); return firstValueFrom( this._ordersService.get(id) ); } @Query('orders') Loading
packages/core/src/services/orders/OrdersService.ts +9 −11 Original line number Diff line number Diff line Loading @@ -930,22 +930,20 @@ export class OrdersService extends DBService<Order> id: string, options: { populateWarehouse?: boolean; populateCarrier?: boolean } = {} ): Promise<Order> { let toPopulate = ''; const query = this.Model.findById(id); if (options.populateCarrier) { toPopulate += 'carrier '; query.populate('carrier'); } if (options.populateWarehouse) { toPopulate += 'warehouse '; query.populate('warehouse'); } return new Order( (await this.Model.findById(id) .populate(toPopulate) ( await query .sort({ _createdAt: -1, orderNumber: -1 }) .lean() .exec()) as IOrder .exec() ) as IOrder ); } Loading