From 73cb9e83b2c15bf6ec83f85bf45b90bf85a85969 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sun, 15 Feb 2026 15:51:49 +0330 Subject: [PATCH] fix logs --- src/modules/dkala/providers/dkala.service.ts | 60 ++++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/modules/dkala/providers/dkala.service.ts b/src/modules/dkala/providers/dkala.service.ts index 8ab4f5c..feace90 100644 --- a/src/modules/dkala/providers/dkala.service.ts +++ b/src/modules/dkala/providers/dkala.service.ts @@ -61,13 +61,13 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to fetch restaurants: ${err.message}`, err.stack); + this.logger.error(`Failed to fetch shops: ${err.message}`, err.stack); return throwError(() => err); }), ), ); return { - restaurants: data.data, + shops: data.data, count: data.meta.total, paginate: true, }; @@ -80,7 +80,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error fetching restaurants: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error fetching shops: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -94,7 +94,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to get restaurant by ID: ${err.message}`, err.stack); + this.logger.error(`Failed to get shop by ID: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -109,7 +109,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error getting restaurant by ID: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error getting shop by ID: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -126,7 +126,7 @@ export class DkalaService { throw new BadRequestException("User Not found"); } - const setupRestaurantDto: ISetupShop = { + const setupShopDto: ISetupShop = { name: userSubscription.businessName, slug: dto.slug, establishedYear: 1400, @@ -140,12 +140,12 @@ export class DkalaService { try { const { data } = await firstValueFrom( this.httpService - .post(`${this.config.baseUrl}/super-admin/shops`, setupRestaurantDto, { + .post(`${this.config.baseUrl}/super-admin/shops`, setupShopDto, { headers: this.getHeaders(), }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to create restaurant: ${err.message}`, err.stack); + this.logger.error(`Failed to create shop: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -160,7 +160,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error creating restaurant: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error creating shop: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -174,7 +174,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to update restaurant: ${err.message}`, err.stack); + this.logger.error(`Failed to update shop: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -189,7 +189,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error updating restaurant: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error updating shop: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -204,7 +204,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to get restaurant subscription: ${err.message}`, err.stack); + this.logger.error(`Failed to get shop subscription: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -220,7 +220,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error getting restaurant subscription: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error getting shop subscription: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -235,7 +235,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error("error in getting SMS count by restaurant", err); + this.logger.error("error in getting SMS count by shop", err); return throwError(() => err); }), ), @@ -251,7 +251,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error("error in getSmsCountByRestaurant", error); + this.logger.error("error in getSmsCountByshop", error); throw error; } } @@ -294,7 +294,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to get restaurant admins: ${err.message}`, err.stack); + this.logger.error(`Failed to get shop admins: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -309,7 +309,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error getting restaurant admins: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error getting shop admins: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -324,7 +324,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to revoke restaurant admin: ${err.message}`, err.stack); + this.logger.error(`Failed to revoke shop admin: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -339,7 +339,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error revoking restaurant admin: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error revoking shop admin: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -354,7 +354,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to assign restaurant admin: ${err.message}`, err.stack); + this.logger.error(`Failed to assign shop admin: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -372,7 +372,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error assigning restaurant admin: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error assigning shop admin: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -388,7 +388,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to upgrade restaurant subscription: ${err.message}`, err.stack); + this.logger.error(`Failed to upgrade shop subscription: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -403,7 +403,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error upgrading restaurant subscription: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error upgrading shop subscription: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -418,7 +418,7 @@ export class DkalaService { }) .pipe( catchError((err: AxiosError) => { - this.logger.error(`Failed to hard delete restaurant: ${err.message}`, err.stack); + this.logger.error(`Failed to hard delete shop: ${err.message}`, err.stack); return throwError(() => err); }), ), @@ -433,7 +433,7 @@ export class DkalaService { }; throw new HttpException(errorResponse, error.response.status); } - this.logger.error(`Error hard deleting restaurant: ${error instanceof Error ? error.message : "Unknown error"}`); + this.logger.error(`Error hard deleting shop: ${error instanceof Error ? error.message : "Unknown error"}`); throw error; } } @@ -452,13 +452,13 @@ export class DkalaService { throw new BadRequestException("Phone number not found in user subscription"); } - // 3. Get restaurant by subscription id - const restaurant = await this.getShopBySubscriptionId(userSubscriptionId); + // 3. Get shop by subscription id + const shop = await this.getShopBySubscriptionId(userSubscriptionId); - // 4. Get slug from restaurant - const slug = restaurant.data.slug; + // 4. Get slug from shop + const slug = shop.data.slug; if (!slug) { - throw new BadRequestException("Restaurant slug not found"); + throw new BadRequestException("shop slug not found"); } // 5. Login with phone and slug