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