feat: resolved backend ts issues

This commit is contained in:
=
2025-09-16 00:08:41 +05:30
parent 5f902229f6
commit 37a80fa1ac
17 changed files with 512 additions and 271 deletions
@@ -55,7 +55,7 @@ export const importDataIntoInfisicalFn = async ({
actorId,
actorOrgId,
actorAuthMethod,
workspaceName: project.name,
projectName: project.name,
createDefaultEnvs: false,
tx
})
@@ -237,8 +237,8 @@ export const projectServiceFactory = ({
actorId,
actorOrgId,
actorAuthMethod,
workspaceName,
workspaceDescription,
projectName: workspaceName,
projectDescription: workspaceDescription,
slug: projectSlug,
kmsKeyId,
tx: trx,
@@ -591,7 +591,8 @@ export const projectServiceFactory = ({
secretSharing: update.secretSharing,
defaultProduct: update.defaultProduct,
showSnapshotsLegacy: update.showSnapshotsLegacy,
secretDetectionIgnoreValues: update.secretDetectionIgnoreValues
secretDetectionIgnoreValues: update.secretDetectionIgnoreValues,
pitVersionLimit: update.pitVersionLimit
});
return updatedProject;
@@ -684,19 +685,21 @@ export const projectServiceFactory = ({
actorOrgId,
actorAuthMethod,
auditLogsRetentionDays,
workspaceSlug
filter
}: TUpdateAuditLogsRetentionDTO) => {
const project = await projectDAL.findProjectBySlug(workspaceSlug, actorOrgId);
const project = await projectDAL.findProjectByFilter(filter);
const projectId = project.id;
if (!project) {
throw new NotFoundError({
message: `Project with slug '${workspaceSlug}' not found`
message: `Project not found`
});
}
const { hasRole } = await permissionService.getProjectPermission({
actor,
actorId,
projectId: project.id,
projectId,
actorAuthMethod,
actorOrgId,
actionProjectType: ActionProjectType.Any
@@ -42,12 +42,13 @@ export type TCreateProjectDTO = {
actorAuthMethod: ActorAuthMethod;
actorId: string;
actorOrgId?: string;
workspaceName: string;
workspaceDescription?: string;
projectName: string;
projectDescription?: string;
slug?: string;
kmsKeyId?: string;
createDefaultEnvs?: boolean;
template?: string;
pitVersionLimit?: number;
tx?: Knex;
type?: ProjectType;
};
@@ -78,7 +79,7 @@ export type TUpdateProjectVersionLimitDTO = {
export type TUpdateAuditLogsRetentionDTO = {
auditLogsRetentionDays: number;
workspaceSlug: string;
filter: Filter;
} & Omit<TProjectPermission, "projectId">;
export type TUpdateProjectNameDTO = {
@@ -90,6 +91,7 @@ export type TUpdateProjectDTO = {
update: {
name?: string;
description?: string;
pitVersionLimit?: number;
autoCapitalization?: boolean;
hasDeleteProtection?: boolean;
defaultProduct?: ProjectType;
+14 -5
View File
@@ -2970,14 +2970,23 @@ export const secretServiceFactory = ({
actor,
actorId,
actorAuthMethod,
actorOrgId
actorOrgId,
projectId: inputProjectId
}: TMoveSecretsDTO) => {
const project = await projectDAL.findProjectBySlug(projectSlug, actorOrgId);
let project;
if (projectSlug) {
project = await projectDAL.findProjectBySlug(projectSlug, actorOrgId);
} else if (inputProjectId) {
project = await projectDAL.findById(inputProjectId);
}
if (!project) {
throw new NotFoundError({
message: `Project with slug '${projectSlug}' not found`
});
}
const projectId = project.id;
if (project.version === ProjectVersion.V3) {
return secretV2BridgeService.moveSecrets({
sourceEnvironment,
@@ -3170,7 +3179,7 @@ export const secretServiceFactory = ({
});
}
const destinationFolderPolicy = await secretApprovalPolicyService.getSecretApprovalPolicy(
project.id,
projectId,
destinationFolder.environment.slug,
destinationFolder.path
);
@@ -3257,7 +3266,7 @@ export const secretServiceFactory = ({
}
if (locallyUpdatedSecrets.length) {
await fnSecretBulkUpdate({
projectId: project.id,
projectId,
folderId: destinationFolder.id,
secretVersionDAL,
secretDAL,
@@ -3300,7 +3309,7 @@ export const secretServiceFactory = ({
const locallyDeletedSecrets = decryptedSourceSecrets.map((el) => ({ ...el, operation: SecretOperations.Delete }));
const sourceFolderPolicy = await secretApprovalPolicyService.getSecretApprovalPolicy(
project.id,
projectId,
sourceFolder.environment.slug,
sourceFolder.path
);