hard delete: restuarant
This commit is contained in:
@@ -402,6 +402,36 @@ export class RestaurantService {
|
||||
}
|
||||
}
|
||||
|
||||
async hardDeleteRestaurant(id: string) {
|
||||
try {
|
||||
const { data } = await firstValueFrom(
|
||||
this.httpService
|
||||
.delete(`${this.config.baseUrl}/super-admin/restaurants/${id}/hard-delete`, {
|
||||
headers: this.getHeaders(),
|
||||
data: {},
|
||||
})
|
||||
.pipe(
|
||||
catchError((err: AxiosError) => {
|
||||
this.logger.error(`Failed to hard delete restaurant: ${err.message}`, err.stack);
|
||||
return throwError(() => err);
|
||||
}),
|
||||
),
|
||||
);
|
||||
return data;
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof AxiosError && error.response) {
|
||||
this.logger.error(`External API error response:`, error.response.data);
|
||||
const errorResponse = {
|
||||
...error.response.data,
|
||||
message: error.response.data.error?.message || error.message,
|
||||
};
|
||||
throw new HttpException(errorResponse, error.response.status);
|
||||
}
|
||||
this.logger.error(`Error hard deleting restaurant: ${error instanceof Error ? error.message : "Unknown error"}`);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async directLogin(userSubscriptionId: string, userId: string) {
|
||||
try {
|
||||
// 1. Get userSubscription by id
|
||||
|
||||
Reference in New Issue
Block a user