Skip to content

Commit

Permalink
Remove plan cache upon create/delete project
Browse files Browse the repository at this point in the history
  • Loading branch information
dangtony98 committed Apr 4, 2024
1 parent 72f50ec commit 5639306
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion backend/src/server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ export const registerRoutes = async (
folderDAL,
licenseService,
projectUserMembershipRoleDAL,
identityProjectMembershipRoleDAL
identityProjectMembershipRoleDAL,
keyStore
});

const projectEnvService = projectEnvServiceFactory({
Expand Down
7 changes: 6 additions & 1 deletion backend/src/services/project/project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TLicenseServiceFactory } from "@app/ee/services/license/license-service
import { OrgPermissionActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service";
import { ProjectPermissionActions, ProjectPermissionSub } from "@app/ee/services/permission/project-permission";
import { TKeyStoreFactory } from "@app/keystore/keystore";
import { isAtLeastAsPrivileged } from "@app/lib/casl";
import { getConfig } from "@app/lib/config/env";
import { createSecretBlindIndex } from "@app/lib/crypto";
Expand Down Expand Up @@ -65,6 +66,7 @@ type TProjectServiceFactoryDep = {
orgService: Pick<TOrgServiceFactory, "addGhostUser">;
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
orgDAL: Pick<TOrgDALFactory, "findOne">;
keyStore: Pick<TKeyStoreFactory, "deleteItem">;
};

export type TProjectServiceFactory = ReturnType<typeof projectServiceFactory>;
Expand All @@ -86,7 +88,8 @@ export const projectServiceFactory = ({
projectEnvDAL,
licenseService,
projectUserMembershipRoleDAL,
identityProjectMembershipRoleDAL
identityProjectMembershipRoleDAL,
keyStore
}: TProjectServiceFactoryDep) => {
/*
* Create workspace. Make user the admin
Expand Down Expand Up @@ -323,6 +326,7 @@ export const projectServiceFactory = ({
};
});

await keyStore.deleteItem(`infisical-cloud-plan-${actorOrgId}`);
return results;
};

Expand Down Expand Up @@ -350,6 +354,7 @@ export const projectServiceFactory = ({
return delProject;
});

await keyStore.deleteItem(`infisical-cloud-plan-${actorOrgId}`);
return deletedProject;
};

Expand Down

0 comments on commit 5639306

Please sign in to comment.