diff --git a/packages/graphql/api/orders.ts b/packages/graphql/api/orders.ts index 18d8c01..2ecd2e7 100644 --- a/packages/graphql/api/orders.ts +++ b/packages/graphql/api/orders.ts @@ -43,6 +43,7 @@ const DEFAULT_ORDERS_SORT = ['slot.datetime_start:desc', 'datetime_start:desc']; export class OrdersService extends BaseService { async createOrder(variables: VariablesOf) { + await this.checkIsBanned(); const { customer } = await this._getUser(); // Проверки на существование обязательных полей для предотвращения ошибок типов @@ -107,6 +108,7 @@ export class OrdersService extends BaseService { } async getOrder(variables: VariablesOf) { + await this.checkIsBanned(); const { query } = await getClientWithToken(); const result = await query({ @@ -118,6 +120,7 @@ export class OrdersService extends BaseService { } async getOrders(variables: VariablesOf) { + await this.checkIsBanned(); const { query } = await getClientWithToken(); const result = await query({ @@ -132,6 +135,7 @@ export class OrdersService extends BaseService { } async updateOrder(variables: VariablesOf) { + await this.checkIsBanned(); await this.checkUpdatePermission(variables); await this.checkBeforeUpdate(variables); diff --git a/packages/graphql/api/subscriptions.ts b/packages/graphql/api/subscriptions.ts index 084b892..c6a79f4 100644 --- a/packages/graphql/api/subscriptions.ts +++ b/packages/graphql/api/subscriptions.ts @@ -226,7 +226,9 @@ export class SubscriptionsService extends BaseService { const { maxOrdersPerMonth } = subscriptionSetting; - const remainingOrdersCount = maxOrdersPerMonth - (orders?.length ?? 0); + let remainingOrdersCount = maxOrdersPerMonth - (orders?.length ?? 0); + + if (remainingOrdersCount < 0) remainingOrdersCount = 0; return { maxOrdersPerMonth, remainingOrdersCount }; }