fix : delete endpoints bug
This commit is contained in:
@@ -99,7 +99,7 @@ export class IconsService {
|
||||
async removeIcon(id: string) {
|
||||
try {
|
||||
const response = await firstValueFrom(
|
||||
this.httpService.delete(`${this.config.baseUrl}/super-admin/icons/${id}`, { headers: this.getHeaders() }).pipe(
|
||||
this.httpService.delete(`${this.config.baseUrl}/super-admin/icons/${id}`, { headers: this.getHeaders(), data: {} }).pipe(
|
||||
catchError((err: AxiosError) => {
|
||||
this.logger.error(`Failed to delete icon: ${err.message}`, err.stack);
|
||||
return throwError(() => err);
|
||||
@@ -185,7 +185,7 @@ export class IconsService {
|
||||
async removeGroup(id: string) {
|
||||
try {
|
||||
const response = await firstValueFrom(
|
||||
this.httpService.delete(`${this.config.baseUrl}/super-admin/icons/groups/${id}`, { headers: this.getHeaders() }).pipe(
|
||||
this.httpService.delete(`${this.config.baseUrl}/super-admin/icons/groups/${id}`, { headers: this.getHeaders(), data: {} }).pipe(
|
||||
catchError((err: AxiosError) => {
|
||||
this.logger.error(`Failed to delete group: ${err.message}`, err.stack);
|
||||
return throwError(() => err);
|
||||
|
||||
@@ -22,7 +22,7 @@ export class RestaurantService {
|
||||
@Inject(DMENU_CONFIG) private readonly config: IDmenuConfig,
|
||||
private readonly httpService: HttpService,
|
||||
private readonly subscriptionService: SubscriptionsService,
|
||||
) { }
|
||||
) {}
|
||||
|
||||
private getHeaders(): Record<string, string> {
|
||||
const credentials = Buffer.from(`${this.config.username}:${this.config.password}`).toString("base64");
|
||||
@@ -37,8 +37,8 @@ export class RestaurantService {
|
||||
const params: Record<string, any> = {
|
||||
page: queryDto.page || 1,
|
||||
limit: queryDto.limit || 10,
|
||||
orderBy: queryDto.orderBy || 'createdAt',
|
||||
order: queryDto.order || 'desc',
|
||||
orderBy: queryDto.orderBy || "createdAt",
|
||||
order: queryDto.order || "desc",
|
||||
};
|
||||
|
||||
if (queryDto.search) {
|
||||
@@ -86,7 +86,7 @@ export class RestaurantService {
|
||||
if (!userSubscription) {
|
||||
throw new BadRequestException(SubscriptionMessage.USER_SUBS_NOT_FOUND);
|
||||
}
|
||||
const plan = userSubscription.plan.name.includes('دلیوری') ? PlanEnum.Premium : PlanEnum.Base;
|
||||
const plan = userSubscription.plan.name.includes("دلیوری") ? PlanEnum.Premium : PlanEnum.Base;
|
||||
|
||||
const setupRestaurantDto: ISetupRestaurant = {
|
||||
name: dto.name,
|
||||
@@ -189,7 +189,7 @@ export class RestaurantService {
|
||||
try {
|
||||
const { data } = await firstValueFrom(
|
||||
this.httpService
|
||||
.get(this.config.baseUrl + '/super-admin/notifications/sms-count', {
|
||||
.get(this.config.baseUrl + "/super-admin/notifications/sms-count", {
|
||||
params: { page, limit },
|
||||
})
|
||||
.pipe(
|
||||
@@ -279,6 +279,7 @@ export class RestaurantService {
|
||||
this.httpService
|
||||
.delete(`${this.config.baseUrl}/super-admin/restaurants/${restaurantId}/admins/${adminId}`, {
|
||||
headers: this.getHeaders(),
|
||||
data: {},
|
||||
})
|
||||
.pipe(
|
||||
catchError((err: AxiosError) => {
|
||||
@@ -331,4 +332,3 @@ export class RestaurantService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user