Skip to content

Commit

Permalink
chore: remove excess currentQuota cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Kolezhanchik committed Sep 26, 2024
1 parent 5c70515 commit 32a9d30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { z } from 'zod';
import createApiHandler from '@/core/api-handler';
import prisma from '@/core/prisma';
import { OkResponse, BadRequestResponse } from '@/core/responses';
import { checkIfQuotaAutoApproval } from '@/helpers/auto-approval-check';
import { checkIfQuotaAutoApproval, Quotas } from '@/helpers/auto-approval-check';
import { quotaSchema } from '@/validation-schemas/private-cloud';

const quotasSchema = z.object({
Expand Down Expand Up @@ -40,15 +40,8 @@ export const POST = apiHandler(async ({ body }) => {
return BadRequestResponse(`failed to get product data for ${licencePlate} licencePlate`);
}

const currentQuota = {
testQuota: currentProduct.testQuota,
toolsQuota: currentProduct.toolsQuota,
developmentQuota: currentProduct.developmentQuota,
productionQuota: currentProduct.productionQuota,
};

const quotaChangesReview = await checkIfQuotaAutoApproval(
currentQuota,
currentProduct as Quotas,
requestedQuota,
licencePlate,
currentProduct.cluster,
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/auto-approval-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const checkIfQuotaAutoApproval = async (
if (!noQuotaChange) {
let hasIncreasedSignificantly = false;

const currentQuotaCasted = {
const castCurrentQuota = {
testQuota: currentQuota.testQuota,
toolsQuota: currentQuota.toolsQuota,
developmentQuota: currentQuota.developmentQuota,
Expand All @@ -147,7 +147,7 @@ export const checkIfQuotaAutoApproval = async (

// Iterate over each environment's quota
// @ts-ignore
_each(currentQuotaCasted, (quota: Quota, envQuota: keyof Quotas) => {
_each(castCurrentQuota, (quota: Quota, envQuota: keyof Quotas) => {
// Iterate over each resource in the quota
// @ts-ignore
// _each(quota, async (currentResource: string, resourceName: keyof Quota) => {
Expand Down

0 comments on commit 32a9d30

Please sign in to comment.