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

packages(sticky): added new interfaces to dto #489

Open
wants to merge 4 commits into
base: staging
Choose a base branch
from
Open
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: 5 additions & 0 deletions apps/admin-gateway/src/module.api/admin.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,9 @@ export class AdminController {
)
)
}

@Get('ping')
async ping (): Promise<string> {
return await lastValueFrom<any>(this.adminClient.send(QUEUE_MESSAGE.ADMIN_SERVICE_REQUEST_PING, {}))
}
}
13 changes: 13 additions & 0 deletions apps/admin-service/src/admin-service.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,17 @@ export class AdminServiceController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.ADMIN_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.adminServiceService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
4 changes: 4 additions & 0 deletions apps/admin-service/src/admin-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,8 @@ export class AdminServiceService {
}
return getRequest
}

async ping (): Promise<string> {
return 'PONG'
}
}
5 changes: 0 additions & 5 deletions apps/api-gateway/src/module.api/address-book.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,4 @@ export class AddressBookController {
)
)
}

@Get('check/ping')
async ping (): Promise<string> {
return 'Address Book PONG'
}
}
5 changes: 0 additions & 5 deletions apps/api-gateway/src/module.api/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,4 @@ export class AuthController {
async logout (@Res({ passthrough: true }) response: Response): Promise<void> {
return this.authService.logout(response)
}

@Get('ping')
async ping (): Promise<string> {
return 'Auth Controller PONG'
}
}
6 changes: 0 additions & 6 deletions apps/api-gateway/src/module.api/coupon.controller.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Body,
Controller,
Get,
HttpException,
Inject,
Post,
Expand Down Expand Up @@ -49,9 +48,4 @@ export class CouponController {
)
)
}

@Get('ping')
async ping (): Promise<string> {
return 'Coupon Controller PONG'
}
}
2 changes: 1 addition & 1 deletion apps/api-gateway/src/module.api/deliveries.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ export class DeliveriesController {

@Get('ping')
async ping (): Promise<string> {
return 'Delivery Controller PONG'
return await lastValueFrom<any>(this.driversClient.send(QUEUE_MESSAGE.DRIVER_SERVICE_REQUEST_PING, {}))
}
}
5 changes: 0 additions & 5 deletions apps/api-gateway/src/module.api/general.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,4 @@ export class GeneralController {
delivery: DELIVERY_PRICE_META
}
}

@Get('ping')
async ping (): Promise<string> {
return 'General Controller PONG'
}
}
2 changes: 1 addition & 1 deletion apps/api-gateway/src/module.api/listing.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@ export class ListingsController {

@Get('ping')
async ping (): Promise<string> {
return 'Listing Controller PONG'
return await lastValueFrom<any>(this.listingClient.send(QUEUE_MESSAGE.LISTING_SERVICE_REQUEST_PING, {}))
}
}
2 changes: 1 addition & 1 deletion apps/api-gateway/src/module.api/location.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ export class LocationController {

@Get('ping')
async ping (): Promise<string> {
return 'Location Controller PONG'
return await lastValueFrom<any>(this.locationClient.send(QUEUE_MESSAGE.LOCATION_SERVICE_REQUEST_PING, {}))
}
}
2 changes: 1 addition & 1 deletion apps/api-gateway/src/module.api/order.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ export class OrderController {

@Get('ping')
async ping (): Promise<string> {
return 'Order Controller PONG'
return await lastValueFrom<any>(this.orderClient.send(QUEUE_MESSAGE.ORDER_SERVICE_REQUEST_PING, {}))
}
}
2 changes: 1 addition & 1 deletion apps/api-gateway/src/module.api/payment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,6 @@ export class PaymentController {

@Get('ping')
async ping (): Promise<string> {
return 'Payment Controller PONG'
return await lastValueFrom<any>(this.paymentClient.send(QUEUE_MESSAGE.PAYMENT_SERVICE_REQUEST_PING, {}))
}
}
4 changes: 2 additions & 2 deletions apps/api-gateway/src/module.api/review.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ export class ReviewController {
)
}

@Get('check/ping')
@Get('ping')
async ping (): Promise<string> {
return 'Review Controller PONG'
return await lastValueFrom<any>(this.reviewClient.send(QUEUE_MESSAGE.REVIEW_SERVICE_REQUEST_PING, {}))
}
}
2 changes: 1 addition & 1 deletion apps/api-gateway/src/module.api/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,6 @@ export class UsersController {

@Get('ping')
async ping (): Promise<string> {
return 'User Controller PONG'
return await lastValueFrom<any>(this.usersClient.send(QUEUE_MESSAGE.USER_SERVICE_REQUEST_PING, {}))
}
}
2 changes: 1 addition & 1 deletion apps/api-gateway/src/module.api/vendors.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ export class VendorsController {

@Get('check/ping')
async ping (): Promise<string> {
return 'Vendor Controller PONG'
return await lastValueFrom<any>(this.vendorsClient.send(QUEUE_MESSAGE.VENDOR_SERVICE_REQUEST_PING, {}))
}
}
5 changes: 0 additions & 5 deletions apps/api-gateway/src/module.api/webapp.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,4 @@ export class WebAppController {
)
)
}

@Get('ping')
async ping (): Promise<string> {
return 'WebApp Controller PONG'
}
}
5 changes: 0 additions & 5 deletions apps/drivers-service/src/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@ export class DriversAuthController {
async getUserProfile (@CurrentUser() driver: Driver): Promise<Driver> {
return driver
}

@Get('ping')
async ping (): Promise<string> {
return 'Auth Controller PONG'
}
}
18 changes: 13 additions & 5 deletions apps/drivers-service/src/drivers-service.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ export class DriversServiceController {
}
}

@Get('ping')
async ping (): Promise<string> {
return 'Driver Controlller PONG'
}

@MessagePattern(QUEUE_MESSAGE.ADMIN_GET_DRIVERS)
async getDrivers (@Ctx() context: RmqContext): Promise<Driver[]> {
try {
Expand Down Expand Up @@ -310,4 +305,17 @@ export class DriversServiceController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.DRIVER_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.driversServiceService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
4 changes: 4 additions & 0 deletions apps/drivers-service/src/drivers-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,4 +318,8 @@ export class DriversServiceService {
)
}
}

async ping (): Promise<string> {
return 'PONG'
}
}
13 changes: 13 additions & 0 deletions apps/listings-service/src/listings.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,4 +508,17 @@ export class ListingsController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.LISTING_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.listingService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
4 changes: 4 additions & 0 deletions apps/listings-service/src/listings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,10 @@ export class ListingsService {
)
}
}

async ping (): Promise<string> {
return 'PONG'
}
}

function getVendorsMapper (vendors: VendorI[]): VendorUserI[] {
Expand Down
13 changes: 13 additions & 0 deletions apps/location-service/src/location-service.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,17 @@ export class LocationController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.LOCATION_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.locationService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
4 changes: 4 additions & 0 deletions apps/location-service/src/location-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,8 @@ export class LocationService {
)
}
}

async ping (): Promise<string> {
return 'PONG'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,17 @@ export class NotificationServiceController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.NOTIFICATION_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.notificationServiceService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,8 @@ export class NotificationServiceService {
}))
} catch (error) {}
}

async ping (): Promise<string> {
return 'PONG'
}
}
13 changes: 13 additions & 0 deletions apps/orders-service/src/orders-service.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,17 @@ export class OrdersServiceController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.ORDER_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.ordersServiceService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
4 changes: 4 additions & 0 deletions apps/orders-service/src/orders-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,4 +558,8 @@ export class OrdersServiceService {
console.error(error)
}
}

async ping (): Promise<string> {
return 'PONG'
}
}
13 changes: 13 additions & 0 deletions apps/payment-service/src/wallet/driver/wallet.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,17 @@ export class DriverWalletController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.PAYMENT_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.walletService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
4 changes: 4 additions & 0 deletions apps/payment-service/src/wallet/driver/wallet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,8 @@ export class DriverWalletService {

return balance >= amount
}

async ping (): Promise<string> {
return 'PONG'
}
}
13 changes: 13 additions & 0 deletions apps/reviews-service/src/reviews-service.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,17 @@ export class ReviewsServiceController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.REVIEW_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.reviewService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
4 changes: 4 additions & 0 deletions apps/reviews-service/src/reviews-service.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,4 +286,8 @@ export class ReviewsService implements ReviewsServiceI {
reviews: listingReview
}
}

async ping (): Promise<string> {
return 'PONG'
}
}
13 changes: 13 additions & 0 deletions apps/users-service/src/users-service.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,17 @@ export class UsersServiceController {
this.rmqService.ack(context)
}
}

@MessagePattern(QUEUE_MESSAGE.USER_SERVICE_REQUEST_PING)
async ping (
@Ctx() context: RmqContext
): Promise<string | undefined> {
try {
return await this.usersService.ping()
} catch (error) {
throw new RpcException(error)
} finally {
this.rmqService.ack(context)
}
}
}
Loading