fix logs
This commit is contained in:
@@ -61,13 +61,13 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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 throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
restaurants: data.data,
|
shops: data.data,
|
||||||
count: data.meta.total,
|
count: data.meta.total,
|
||||||
paginate: true,
|
paginate: true,
|
||||||
};
|
};
|
||||||
@@ -80,7 +80,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +94,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -109,7 +109,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ export class DkalaService {
|
|||||||
throw new BadRequestException("User Not found");
|
throw new BadRequestException("User Not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
const setupRestaurantDto: ISetupShop = {
|
const setupShopDto: ISetupShop = {
|
||||||
name: userSubscription.businessName,
|
name: userSubscription.businessName,
|
||||||
slug: dto.slug,
|
slug: dto.slug,
|
||||||
establishedYear: 1400,
|
establishedYear: 1400,
|
||||||
@@ -140,12 +140,12 @@ export class DkalaService {
|
|||||||
try {
|
try {
|
||||||
const { data } = await firstValueFrom(
|
const { data } = await firstValueFrom(
|
||||||
this.httpService
|
this.httpService
|
||||||
.post(`${this.config.baseUrl}/super-admin/shops`, setupRestaurantDto, {
|
.post(`${this.config.baseUrl}/super-admin/shops`, setupShopDto, {
|
||||||
headers: this.getHeaders(),
|
headers: this.getHeaders(),
|
||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -160,7 +160,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -189,7 +189,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -220,7 +220,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -251,7 +251,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
throw new HttpException(errorResponse, error.response.status);
|
||||||
}
|
}
|
||||||
this.logger.error("error in getSmsCountByRestaurant", error);
|
this.logger.error("error in getSmsCountByshop", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -294,7 +294,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -309,7 +309,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -339,7 +339,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -372,7 +372,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -388,7 +388,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -403,7 +403,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,7 +418,7 @@ export class DkalaService {
|
|||||||
})
|
})
|
||||||
.pipe(
|
.pipe(
|
||||||
catchError((err: AxiosError) => {
|
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);
|
return throwError(() => err);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
@@ -433,7 +433,7 @@ export class DkalaService {
|
|||||||
};
|
};
|
||||||
throw new HttpException(errorResponse, error.response.status);
|
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;
|
throw error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -452,13 +452,13 @@ export class DkalaService {
|
|||||||
throw new BadRequestException("Phone number not found in user subscription");
|
throw new BadRequestException("Phone number not found in user subscription");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Get restaurant by subscription id
|
// 3. Get shop by subscription id
|
||||||
const restaurant = await this.getShopBySubscriptionId(userSubscriptionId);
|
const shop = await this.getShopBySubscriptionId(userSubscriptionId);
|
||||||
|
|
||||||
// 4. Get slug from restaurant
|
// 4. Get slug from shop
|
||||||
const slug = restaurant.data.slug;
|
const slug = shop.data.slug;
|
||||||
if (!slug) {
|
if (!slug) {
|
||||||
throw new BadRequestException("Restaurant slug not found");
|
throw new BadRequestException("shop slug not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Login with phone and slug
|
// 5. Login with phone and slug
|
||||||
|
|||||||
Reference in New Issue
Block a user