hard delete: restuarant

This commit is contained in:
2026-01-06 09:06:22 +03:30
parent 6732de8066
commit 245e84b877
3 changed files with 44 additions and 1 deletions
@@ -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