From 2e242141cc54bd4db974ddf7549f4ae07aef9130 Mon Sep 17 00:00:00 2001 From: alaminyusuf Date: Thu, 19 Sep 2024 11:27:51 +0100 Subject: [PATCH 1/3] fix(*nana services and api-gateways): switched from PING from route controller to PING from Rmq message pattern --- .../src/module.api/admin.controller.ts | 5 +++++ .../src/admin-service.controller.ts | 13 +++++++++++++ .../admin-service/src/admin-service.service.ts | 4 ++++ .../src/module.api/address-book.controller.ts | 5 ----- .../src/module.api/auth.controller.ts | 5 ----- .../src/module.api/coupon.controller.ts | 6 ------ .../src/module.api/deliveries.controller.ts | 2 +- .../src/module.api/general.controller.ts | 5 ----- .../src/module.api/listing.controller.ts | 2 +- .../src/module.api/location.controller.ts | 2 +- .../src/module.api/order.controller.ts | 2 +- .../src/module.api/payment.controller.ts | 2 +- .../src/module.api/review.controller.ts | 4 ++-- .../src/module.api/users.controller.ts | 2 +- .../src/module.api/vendors.controller.ts | 2 +- .../src/module.api/webapp.controller.ts | 5 ----- apps/drivers-service/src/auth.controller.ts | 5 ----- .../src/drivers-service.controller.ts | 18 +++++++++++++----- .../src/drivers-service.service.ts | 4 ++++ .../src/listings.controller.ts | 13 +++++++++++++ apps/listings-service/src/listings.service.ts | 4 ++++ .../src/location-service.controller.ts | 13 +++++++++++++ .../src/location-service.service.ts | 4 ++++ .../src/notification-service.controller.ts | 13 +++++++++++++ .../src/notification-service.service.ts | 4 ++++ .../src/orders-service.controller.ts | 13 +++++++++++++ .../src/orders-service.service.ts | 4 ++++ .../src/wallet/driver/wallet.controller.ts | 13 +++++++++++++ .../src/wallet/driver/wallet.service.ts | 4 ++++ .../src/reviews-service.controller.ts | 13 +++++++++++++ .../src/reviews-service.service.ts | 4 ++++ .../src/users-service.controller.ts | 13 +++++++++++++ .../users-service/src/users-service.service.ts | 4 ++++ .../src/module.api/auth.controller.ts | 5 ----- .../src/module.api/drivers.controller.ts | 5 ----- .../src/module.api/listings.controller.ts | 5 ----- .../src/module.api/orders.controller.ts | 5 ----- .../src/module.api/review.controller.ts | 5 ----- .../src/module.api/vendor.controller.ts | 2 +- .../src/module.api/wallet.controller.ts | 5 ----- apps/vendors-service/src/vendors.controller.ts | 13 +++++++++++++ apps/vendors-service/src/vendors.service.ts | 4 ++++ libs/common/src/typings/QUEUE_MESSAGE.ts | 14 +++++++++++++- 43 files changed, 198 insertions(+), 77 deletions(-) diff --git a/apps/admin-gateway/src/module.api/admin.controller.ts b/apps/admin-gateway/src/module.api/admin.controller.ts index a97b1704..f7b381d5 100644 --- a/apps/admin-gateway/src/module.api/admin.controller.ts +++ b/apps/admin-gateway/src/module.api/admin.controller.ts @@ -137,4 +137,9 @@ export class AdminController { ) ) } + + @Get('ping') + async ping (): Promise { + return await lastValueFrom(this.adminClient.send(QUEUE_MESSAGE.ADMIN_SERVICE_REQUEST_PING, {})) + } } diff --git a/apps/admin-service/src/admin-service.controller.ts b/apps/admin-service/src/admin-service.controller.ts index 56f6712b..38898327 100644 --- a/apps/admin-service/src/admin-service.controller.ts +++ b/apps/admin-service/src/admin-service.controller.ts @@ -119,4 +119,17 @@ export class AdminServiceController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.ADMIN_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.adminServiceService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/admin-service/src/admin-service.service.ts b/apps/admin-service/src/admin-service.service.ts index 0d8d396c..2e101039 100644 --- a/apps/admin-service/src/admin-service.service.ts +++ b/apps/admin-service/src/admin-service.service.ts @@ -142,4 +142,8 @@ export class AdminServiceService { } return getRequest } + + async ping (): Promise { + return 'PONG' + } } diff --git a/apps/api-gateway/src/module.api/address-book.controller.ts b/apps/api-gateway/src/module.api/address-book.controller.ts index 73dc0688..7ed6dad7 100644 --- a/apps/api-gateway/src/module.api/address-book.controller.ts +++ b/apps/api-gateway/src/module.api/address-book.controller.ts @@ -116,9 +116,4 @@ export class AddressBookController { ) ) } - - @Get('check/ping') - async ping (): Promise { - return 'Address Book PONG' - } } diff --git a/apps/api-gateway/src/module.api/auth.controller.ts b/apps/api-gateway/src/module.api/auth.controller.ts index b27607b6..db3289ee 100644 --- a/apps/api-gateway/src/module.api/auth.controller.ts +++ b/apps/api-gateway/src/module.api/auth.controller.ts @@ -22,9 +22,4 @@ export class AuthController { async logout (@Res({ passthrough: true }) response: Response): Promise { return this.authService.logout(response) } - - @Get('ping') - async ping (): Promise { - return 'Auth Controller PONG' - } } diff --git a/apps/api-gateway/src/module.api/coupon.controller.ts b/apps/api-gateway/src/module.api/coupon.controller.ts index d7485804..4749c23a 100644 --- a/apps/api-gateway/src/module.api/coupon.controller.ts +++ b/apps/api-gateway/src/module.api/coupon.controller.ts @@ -1,7 +1,6 @@ import { Body, Controller, - Get, HttpException, Inject, Post, @@ -49,9 +48,4 @@ export class CouponController { ) ) } - - @Get('ping') - async ping (): Promise { - return 'Coupon Controller PONG' - } } diff --git a/apps/api-gateway/src/module.api/deliveries.controller.ts b/apps/api-gateway/src/module.api/deliveries.controller.ts index d6749e3e..9cf740bb 100644 --- a/apps/api-gateway/src/module.api/deliveries.controller.ts +++ b/apps/api-gateway/src/module.api/deliveries.controller.ts @@ -39,6 +39,6 @@ export class DeliveriesController { @Get('ping') async ping (): Promise { - return 'Delivery Controller PONG' + return await lastValueFrom(this.driversClient.send(QUEUE_MESSAGE.DRIVER_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/api-gateway/src/module.api/general.controller.ts b/apps/api-gateway/src/module.api/general.controller.ts index 7f279a8d..85d34c8d 100644 --- a/apps/api-gateway/src/module.api/general.controller.ts +++ b/apps/api-gateway/src/module.api/general.controller.ts @@ -10,9 +10,4 @@ export class GeneralController { delivery: DELIVERY_PRICE_META } } - - @Get('ping') - async ping (): Promise { - return 'General Controller PONG' - } } diff --git a/apps/api-gateway/src/module.api/listing.controller.ts b/apps/api-gateway/src/module.api/listing.controller.ts index 7e0ec4a7..1a5b6bef 100644 --- a/apps/api-gateway/src/module.api/listing.controller.ts +++ b/apps/api-gateway/src/module.api/listing.controller.ts @@ -159,6 +159,6 @@ export class ListingsController { @Get('ping') async ping (): Promise { - return 'Listing Controller PONG' + return await lastValueFrom(this.listingClient.send(QUEUE_MESSAGE.LISTING_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/api-gateway/src/module.api/location.controller.ts b/apps/api-gateway/src/module.api/location.controller.ts index b87655ea..659c4998 100644 --- a/apps/api-gateway/src/module.api/location.controller.ts +++ b/apps/api-gateway/src/module.api/location.controller.ts @@ -61,6 +61,6 @@ export class LocationController { @Get('ping') async ping (): Promise { - return 'Location Controller PONG' + return await lastValueFrom(this.locationClient.send(QUEUE_MESSAGE.LOCATION_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/api-gateway/src/module.api/order.controller.ts b/apps/api-gateway/src/module.api/order.controller.ts index bc09cdce..3b01a5a6 100644 --- a/apps/api-gateway/src/module.api/order.controller.ts +++ b/apps/api-gateway/src/module.api/order.controller.ts @@ -97,6 +97,6 @@ export class OrderController { @Get('ping') async ping (): Promise { - return 'Order Controller PONG' + return await lastValueFrom(this.orderClient.send(QUEUE_MESSAGE.ORDER_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/api-gateway/src/module.api/payment.controller.ts b/apps/api-gateway/src/module.api/payment.controller.ts index 8c14eca2..f6081e16 100644 --- a/apps/api-gateway/src/module.api/payment.controller.ts +++ b/apps/api-gateway/src/module.api/payment.controller.ts @@ -168,6 +168,6 @@ export class PaymentController { @Get('ping') async ping (): Promise { - return 'Payment Controller PONG' + return await lastValueFrom(this.paymentClient.send(QUEUE_MESSAGE.PAYMENT_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/api-gateway/src/module.api/review.controller.ts b/apps/api-gateway/src/module.api/review.controller.ts index 7b121797..7219cd67 100644 --- a/apps/api-gateway/src/module.api/review.controller.ts +++ b/apps/api-gateway/src/module.api/review.controller.ts @@ -104,8 +104,8 @@ export class ReviewController { ) } - @Get('check/ping') + @Get('ping') async ping (): Promise { - return 'Review Controller PONG' + return await lastValueFrom(this.reviewClient.send(QUEUE_MESSAGE.REVIEW_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/api-gateway/src/module.api/users.controller.ts b/apps/api-gateway/src/module.api/users.controller.ts index dedbdeb9..ffeb6afa 100644 --- a/apps/api-gateway/src/module.api/users.controller.ts +++ b/apps/api-gateway/src/module.api/users.controller.ts @@ -158,6 +158,6 @@ export class UsersController { @Get('ping') async ping (): Promise { - return 'User Controller PONG' + return await lastValueFrom(this.usersClient.send(QUEUE_MESSAGE.USER_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/api-gateway/src/module.api/vendors.controller.ts b/apps/api-gateway/src/module.api/vendors.controller.ts index 613fb0ec..0ad43952 100644 --- a/apps/api-gateway/src/module.api/vendors.controller.ts +++ b/apps/api-gateway/src/module.api/vendors.controller.ts @@ -170,6 +170,6 @@ export class VendorsController { @Get('check/ping') async ping (): Promise { - return 'Vendor Controller PONG' + return await lastValueFrom(this.vendorsClient.send(QUEUE_MESSAGE.VENDOR_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/api-gateway/src/module.api/webapp.controller.ts b/apps/api-gateway/src/module.api/webapp.controller.ts index e82b270b..be4b0326 100644 --- a/apps/api-gateway/src/module.api/webapp.controller.ts +++ b/apps/api-gateway/src/module.api/webapp.controller.ts @@ -58,9 +58,4 @@ export class WebAppController { ) ) } - - @Get('ping') - async ping (): Promise { - return 'WebApp Controller PONG' - } } diff --git a/apps/drivers-service/src/auth.controller.ts b/apps/drivers-service/src/auth.controller.ts index 224419f3..35945f1a 100644 --- a/apps/drivers-service/src/auth.controller.ts +++ b/apps/drivers-service/src/auth.controller.ts @@ -30,9 +30,4 @@ export class DriversAuthController { async getUserProfile (@CurrentUser() driver: Driver): Promise { return driver } - - @Get('ping') - async ping (): Promise { - return 'Auth Controller PONG' - } } diff --git a/apps/drivers-service/src/drivers-service.controller.ts b/apps/drivers-service/src/drivers-service.controller.ts index 4cfb4471..14d66c1c 100644 --- a/apps/drivers-service/src/drivers-service.controller.ts +++ b/apps/drivers-service/src/drivers-service.controller.ts @@ -229,11 +229,6 @@ export class DriversServiceController { } } - @Get('ping') - async ping (): Promise { - return 'Driver Controlller PONG' - } - @MessagePattern(QUEUE_MESSAGE.ADMIN_GET_DRIVERS) async getDrivers (@Ctx() context: RmqContext): Promise { try { @@ -310,4 +305,17 @@ export class DriversServiceController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.DRIVER_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.driversServiceService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/drivers-service/src/drivers-service.service.ts b/apps/drivers-service/src/drivers-service.service.ts index 2cd7f219..7c94e01e 100644 --- a/apps/drivers-service/src/drivers-service.service.ts +++ b/apps/drivers-service/src/drivers-service.service.ts @@ -318,4 +318,8 @@ export class DriversServiceService { ) } } + + async ping (): Promise { + return 'PONG' + } } diff --git a/apps/listings-service/src/listings.controller.ts b/apps/listings-service/src/listings.controller.ts index 035fc4a9..1778e9e7 100644 --- a/apps/listings-service/src/listings.controller.ts +++ b/apps/listings-service/src/listings.controller.ts @@ -508,4 +508,17 @@ export class ListingsController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.LISTING_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.listingService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/listings-service/src/listings.service.ts b/apps/listings-service/src/listings.service.ts index fc3ef0f9..afbfc3de 100644 --- a/apps/listings-service/src/listings.service.ts +++ b/apps/listings-service/src/listings.service.ts @@ -945,6 +945,10 @@ export class ListingsService { ) } } + + async ping (): Promise { + return 'PONG' + } } function getVendorsMapper (vendors: VendorI[]): VendorUserI[] { diff --git a/apps/location-service/src/location-service.controller.ts b/apps/location-service/src/location-service.controller.ts index 9e69e1f3..7b11e43e 100644 --- a/apps/location-service/src/location-service.controller.ts +++ b/apps/location-service/src/location-service.controller.ts @@ -87,4 +87,17 @@ export class LocationController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.LOCATION_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.locationService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/location-service/src/location-service.service.ts b/apps/location-service/src/location-service.service.ts index f582ddc5..e84c2f83 100644 --- a/apps/location-service/src/location-service.service.ts +++ b/apps/location-service/src/location-service.service.ts @@ -94,4 +94,8 @@ export class LocationService { ) } } + + async ping (): Promise { + return 'PONG' + } } diff --git a/apps/notification-service/src/notification-service.controller.ts b/apps/notification-service/src/notification-service.controller.ts index 6317e22b..7f756d3c 100644 --- a/apps/notification-service/src/notification-service.controller.ts +++ b/apps/notification-service/src/notification-service.controller.ts @@ -191,4 +191,17 @@ export class NotificationServiceController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.NOTIFICATION_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.notificationServiceService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/notification-service/src/notification-service.service.ts b/apps/notification-service/src/notification-service.service.ts index fe501ec9..4265155c 100644 --- a/apps/notification-service/src/notification-service.service.ts +++ b/apps/notification-service/src/notification-service.service.ts @@ -258,4 +258,8 @@ export class NotificationServiceService { })) } catch (error) {} } + + async ping (): Promise { + return 'PONG' + } } diff --git a/apps/orders-service/src/orders-service.controller.ts b/apps/orders-service/src/orders-service.controller.ts index 59e93f24..81858c5f 100644 --- a/apps/orders-service/src/orders-service.controller.ts +++ b/apps/orders-service/src/orders-service.controller.ts @@ -261,4 +261,17 @@ export class OrdersServiceController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.ORDER_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.ordersServiceService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/orders-service/src/orders-service.service.ts b/apps/orders-service/src/orders-service.service.ts index a60af32c..59b100c4 100644 --- a/apps/orders-service/src/orders-service.service.ts +++ b/apps/orders-service/src/orders-service.service.ts @@ -558,4 +558,8 @@ export class OrdersServiceService { console.error(error) } } + + async ping (): Promise { + return 'PONG' + } } diff --git a/apps/payment-service/src/wallet/driver/wallet.controller.ts b/apps/payment-service/src/wallet/driver/wallet.controller.ts index e8604b2d..cbe11261 100644 --- a/apps/payment-service/src/wallet/driver/wallet.controller.ts +++ b/apps/payment-service/src/wallet/driver/wallet.controller.ts @@ -144,4 +144,17 @@ export class DriverWalletController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.PAYMENT_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.walletService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/payment-service/src/wallet/driver/wallet.service.ts b/apps/payment-service/src/wallet/driver/wallet.service.ts index e691b0df..84492822 100644 --- a/apps/payment-service/src/wallet/driver/wallet.service.ts +++ b/apps/payment-service/src/wallet/driver/wallet.service.ts @@ -259,4 +259,8 @@ export class DriverWalletService { return balance >= amount } + + async ping (): Promise { + return 'PONG' + } } diff --git a/apps/reviews-service/src/reviews-service.controller.ts b/apps/reviews-service/src/reviews-service.controller.ts index 5f6a68eb..2ac558b1 100644 --- a/apps/reviews-service/src/reviews-service.controller.ts +++ b/apps/reviews-service/src/reviews-service.controller.ts @@ -175,4 +175,17 @@ export class ReviewsServiceController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.REVIEW_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.reviewService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/reviews-service/src/reviews-service.service.ts b/apps/reviews-service/src/reviews-service.service.ts index 385c7ac8..f1588bd0 100644 --- a/apps/reviews-service/src/reviews-service.service.ts +++ b/apps/reviews-service/src/reviews-service.service.ts @@ -286,4 +286,8 @@ export class ReviewsService implements ReviewsServiceI { reviews: listingReview } } + + async ping (): Promise { + return 'PONG' + } } diff --git a/apps/users-service/src/users-service.controller.ts b/apps/users-service/src/users-service.controller.ts index 55c992f1..81779ea8 100644 --- a/apps/users-service/src/users-service.controller.ts +++ b/apps/users-service/src/users-service.controller.ts @@ -254,4 +254,17 @@ export class UsersServiceController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.USER_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.usersService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/users-service/src/users-service.service.ts b/apps/users-service/src/users-service.service.ts index af515482..930dc0ce 100644 --- a/apps/users-service/src/users-service.service.ts +++ b/apps/users-service/src/users-service.service.ts @@ -484,4 +484,8 @@ export class UsersService { this.logger.log('Can not add coupon to user account') } } + + async ping (): Promise { + return 'PONG' + } } diff --git a/apps/vendor-gateway/src/module.api/auth.controller.ts b/apps/vendor-gateway/src/module.api/auth.controller.ts index fcb27ccf..c98ffaa2 100644 --- a/apps/vendor-gateway/src/module.api/auth.controller.ts +++ b/apps/vendor-gateway/src/module.api/auth.controller.ts @@ -30,9 +30,4 @@ export class AuthController { async getUserProfile (@CurrentUser() vendor: Vendor): Promise { return vendor } - - @Get('ping') - async ping (): Promise { - return 'Auth Controller PONG' - } } diff --git a/apps/vendor-gateway/src/module.api/drivers.controller.ts b/apps/vendor-gateway/src/module.api/drivers.controller.ts index 28440807..39b0af35 100644 --- a/apps/vendor-gateway/src/module.api/drivers.controller.ts +++ b/apps/vendor-gateway/src/module.api/drivers.controller.ts @@ -55,9 +55,4 @@ export class DriversController { ) ) } - - @Get('ping') - async ping (): Promise { - return 'Delivery Controller PONG' - } } diff --git a/apps/vendor-gateway/src/module.api/listings.controller.ts b/apps/vendor-gateway/src/module.api/listings.controller.ts index 441c607e..08872950 100644 --- a/apps/vendor-gateway/src/module.api/listings.controller.ts +++ b/apps/vendor-gateway/src/module.api/listings.controller.ts @@ -372,9 +372,4 @@ export class ListingsController { ) ) } - - @Get('ping') - async ping (): Promise { - return 'Listing Controller PONG' - } } diff --git a/apps/vendor-gateway/src/module.api/orders.controller.ts b/apps/vendor-gateway/src/module.api/orders.controller.ts index 5e24aa54..2fff064f 100644 --- a/apps/vendor-gateway/src/module.api/orders.controller.ts +++ b/apps/vendor-gateway/src/module.api/orders.controller.ts @@ -84,9 +84,4 @@ export class OrdersController { ) ) } - - @Get('check/ping') - async ping (): Promise { - return 'Order Controlller PONG' - } } diff --git a/apps/vendor-gateway/src/module.api/review.controller.ts b/apps/vendor-gateway/src/module.api/review.controller.ts index f2d57692..d7d926e1 100644 --- a/apps/vendor-gateway/src/module.api/review.controller.ts +++ b/apps/vendor-gateway/src/module.api/review.controller.ts @@ -96,9 +96,4 @@ export class ReviewController { ) ) } - - @Get('check/ping') - async ping (): Promise { - return 'Review Controller PONG' - } } diff --git a/apps/vendor-gateway/src/module.api/vendor.controller.ts b/apps/vendor-gateway/src/module.api/vendor.controller.ts index e7c2f3ae..1151e55a 100644 --- a/apps/vendor-gateway/src/module.api/vendor.controller.ts +++ b/apps/vendor-gateway/src/module.api/vendor.controller.ts @@ -249,6 +249,6 @@ export class VendorController { @Get('ping') async ping (): Promise { - return 'Vendor Controller PONG' + return await lastValueFrom(this.notificationClient.send(QUEUE_MESSAGE.NOTIFICATION_SERVICE_REQUEST_PING, {})) } } diff --git a/apps/vendor-gateway/src/module.api/wallet.controller.ts b/apps/vendor-gateway/src/module.api/wallet.controller.ts index 393e161f..a0fbf01c 100644 --- a/apps/vendor-gateway/src/module.api/wallet.controller.ts +++ b/apps/vendor-gateway/src/module.api/wallet.controller.ts @@ -58,9 +58,4 @@ export class WalletController { ) ) } - - @Get('ping') - async ping (): Promise { - return 'Wallet Controller PONG' - } } diff --git a/apps/vendors-service/src/vendors.controller.ts b/apps/vendors-service/src/vendors.controller.ts index 074c2f63..9039b569 100644 --- a/apps/vendors-service/src/vendors.controller.ts +++ b/apps/vendors-service/src/vendors.controller.ts @@ -344,4 +344,17 @@ export class VendorsController { this.rmqService.ack(context) } } + + @MessagePattern(QUEUE_MESSAGE.VENDOR_SERVICE_REQUEST_PING) + async ping ( + @Ctx() context: RmqContext + ): Promise { + try { + return await this.vendorsService.ping() + } catch (error) { + throw new RpcException(error) + } finally { + this.rmqService.ack(context) + } + } } diff --git a/apps/vendors-service/src/vendors.service.ts b/apps/vendors-service/src/vendors.service.ts index d2e1c57d..29a292d1 100644 --- a/apps/vendors-service/src/vendors.service.ts +++ b/apps/vendors-service/src/vendors.service.ts @@ -557,6 +557,10 @@ export class VendorsService { throw new FitRpcException('Something went wrong updating vendor review', HttpStatus.INTERNAL_SERVER_ERROR) } } + + async ping (): Promise { + return 'PONG' + } } // @TODO(siradji) fully implement the mapping feature diff --git a/libs/common/src/typings/QUEUE_MESSAGE.ts b/libs/common/src/typings/QUEUE_MESSAGE.ts index c97a8ecc..012e22b4 100644 --- a/libs/common/src/typings/QUEUE_MESSAGE.ts +++ b/libs/common/src/typings/QUEUE_MESSAGE.ts @@ -288,7 +288,19 @@ export enum QUEUE_MESSAGE { UPDATE_USER_PAYSTACK_INFO = 'UPDATE_USER_PAYSTACK_INFO', USER_WALLET_DEDUCT_BALANCE = 'USER_WALLET_DEDUCT_BALANCE', - VENDORS_SEED_DATABASE = 'VENDORS_SEED_DATABASE' + VENDORS_SEED_DATABASE = 'VENDORS_SEED_DATABASE', + + // PING REQUEST + USER_SERVICE_REQUEST_PING = 'USER_SERVICE_REQUEST_PING', + VENDOR_SERVICE_REQUEST_PING = 'VENDOR_SERVICE_REQUEST_PING', + ADMIN_SERVICE_REQUEST_PING = 'ADDRESS_BOOK_REQUEST_PING', + DRIVER_SERVICE_REQUEST_PING = 'DRIVER_SERVICE_REQUEST_PING', + LISTING_SERVICE_REQUEST_PING = 'LISTING_SERVICE_REQUEST_PING', + LOCATION_SERVICE_REQUEST_PING = 'LOCATION_SERVICE_REQUEST_PING', + NOTIFICATION_SERVICE_REQUEST_PING = 'NOTIFICATION_SERVICE_REQUEST_PING', + REVIEW_SERVICE_REQUEST_PING = 'REVIEW_SERVICE_REQUEST_PING', + PAYMENT_SERVICE_REQUEST_PING = 'PAYMENT_SERVICE_REQUEST_PING', + ORDER_SERVICE_REQUEST_PING = 'ORDER_SERVICE_REQUEST_PING' } export enum QUEUE_SERVICE { From 15ef0890c890ad585fe621557794360f2bee0400 Mon Sep 17 00:00:00 2001 From: alaminyusuf Date: Fri, 20 Sep 2024 10:10:07 +0100 Subject: [PATCH 2/3] packages(sticky): added new interfaces to dto --- packages/sticky/libs/common/src/dto/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/sticky/libs/common/src/dto/index.ts b/packages/sticky/libs/common/src/dto/index.ts index c22496b2..4c9b5252 100644 --- a/packages/sticky/libs/common/src/dto/index.ts +++ b/packages/sticky/libs/common/src/dto/index.ts @@ -383,3 +383,13 @@ export interface UpdateTransaction { driverId: string; status: WalletTransactionStatus; } + +export interface updateIsDriverInternalDto { + id: string + internal: boolean +} + +export interface verifyTermiiToken { + pinId: string + pin: string +} From 36ff6ac97650d8c7480e1778484df74b78f8dc61 Mon Sep 17 00:00:00 2001 From: alaminyusuf Date: Fri, 20 Sep 2024 22:14:19 +0100 Subject: [PATCH 3/3] packages(CreateListingCategoryDto): changed menu prop from required to optional --- packages/sticky/libs/common/src/dto/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sticky/libs/common/src/dto/index.ts b/packages/sticky/libs/common/src/dto/index.ts index 4c9b5252..943c08f1 100644 --- a/packages/sticky/libs/common/src/dto/index.ts +++ b/packages/sticky/libs/common/src/dto/index.ts @@ -53,7 +53,7 @@ export interface CreateListingCategoryDto { tags: string[]; isLive: boolean; type: ' PRE_ORDER' | 'ON_DEMAND'; - menu: string; + menu?: string; } export interface UpdateListingCategoryDto {