Merge pull request #3676 from Infisical/revert-3675-revert-3546-feat/point-in-time-revamp

Revert "Revert "feat(PIT): Point In Time Revamp""
This commit is contained in:
Maidul Islam
2025-06-08 20:29:51 -04:00
committed by GitHub
114 changed files with 10782 additions and 130 deletions
+12 -1
View File
@@ -12,7 +12,7 @@ import {
TProjectsUpdate
} from "@app/db/schemas";
import { BadRequestError, DatabaseError, NotFoundError, UnauthorizedError } from "@app/lib/errors";
import { ormify, selectAllTableCols, sqlNestRelationships } from "@app/lib/knex";
import { buildFindFilter, ormify, selectAllTableCols, sqlNestRelationships } from "@app/lib/knex";
import { ActorType } from "../auth/auth-type";
import { Filter, ProjectFilterType, SearchProjectSortBy } from "./project-types";
@@ -475,6 +475,16 @@ export const projectDALFactory = (db: TDbClient) => {
return { docs, totalCount: Number(docs?.[0]?.count ?? 0) };
};
const findProjectByEnvId = async (envId: string, tx?: Knex) => {
const project = await (tx || db.replicaNode())(TableName.Project)
.leftJoin(TableName.Environment, `${TableName.Environment}.projectId`, `${TableName.Project}.id`)
// eslint-disable-next-line @typescript-eslint/no-misused-promises
.where(buildFindFilter({ id: envId }, TableName.Environment))
.select(selectAllTableCols(TableName.Project))
.first();
return project;
};
const countOfOrgProjects = async (orgId: string | null, tx?: Knex) => {
try {
const doc = await (tx || db.replicaNode())(TableName.Project)
@@ -504,6 +514,7 @@ export const projectDALFactory = (db: TDbClient) => {
checkProjectUpgradeStatus,
getProjectFromSplitId,
searchProjects,
findProjectByEnvId,
countOfOrgProjects
};
};
@@ -671,7 +671,8 @@ export const projectServiceFactory = ({
enforceCapitalization: update.autoCapitalization,
hasDeleteProtection: update.hasDeleteProtection,
slug: update.slug,
secretSharing: update.secretSharing
secretSharing: update.secretSharing,
showSnapshotsLegacy: update.showSnapshotsLegacy
});
return updatedProject;
@@ -94,6 +94,7 @@ export type TUpdateProjectDTO = {
hasDeleteProtection?: boolean;
slug?: string;
secretSharing?: boolean;
showSnapshotsLegacy?: boolean;
};
} & Omit<TProjectPermission, "projectId">;