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