fix : get restuarant by user sub id
This commit is contained in:
@@ -104,24 +104,36 @@ export class RestaurantService {
|
||||
);
|
||||
return data;
|
||||
} catch (error: unknown) {
|
||||
// Return validation errors or other error types from external API
|
||||
if (error instanceof AxiosError && error.response?.data) {
|
||||
this.logger.error(`External API error response:`, error.response.data);
|
||||
return error.response.data;
|
||||
}
|
||||
|
||||
this.logger.error(`Error creating restaurant: ${error instanceof Error ? error.message : "Unknown error"}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async getRestaurantSubscription(subscriptionId: string) {
|
||||
// TODO: Implement the business logic to get restaurant subscription
|
||||
// This could involve querying the database, making external API calls, etc.
|
||||
|
||||
this.logger.log(`Getting restaurant subscription for ID: ${subscriptionId}`);
|
||||
|
||||
// For now, return a placeholder response
|
||||
// You should implement the actual logic based on your business requirements
|
||||
return {
|
||||
subscriptionId,
|
||||
message: "Restaurant subscription endpoint created successfully",
|
||||
// Add actual data structure based on your requirements
|
||||
};
|
||||
try {
|
||||
const { data } = await firstValueFrom(
|
||||
this.httpService
|
||||
.get(`${this.config.baseUrl}/super-admin/restaurants/subscription/${subscriptionId}`, {
|
||||
headers: this.getHeaders(),
|
||||
})
|
||||
.pipe(
|
||||
catchError((err: AxiosError) => {
|
||||
this.logger.error(`Failed to get restaurant subscription: ${err.message}`, err.stack);
|
||||
return throwError(() => err);
|
||||
}),
|
||||
),
|
||||
);
|
||||
return data;
|
||||
} catch (error: unknown) {
|
||||
this.logger.error(`Error getting restaurant subscription: ${error instanceof Error ? error.message : "Unknown error"}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async getSmsCountByRestaurant(page: number, limit: number) {
|
||||
|
||||
Reference in New Issue
Block a user