mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
PIT: add envID to rollback endpoint
This commit is contained in:
@@ -440,7 +440,8 @@ export const registerPITRouter = async (server: FastifyZodProvider) => {
|
||||
body: z.object({
|
||||
folderId: z.string().trim(),
|
||||
deepRollback: z.boolean().default(false),
|
||||
message: z.string().trim().optional()
|
||||
message: z.string().trim().optional(),
|
||||
envId: z.string().trim()
|
||||
}),
|
||||
response: {
|
||||
200: z.object({
|
||||
@@ -467,8 +468,8 @@ export const registerPITRouter = async (server: FastifyZodProvider) => {
|
||||
|
||||
if (req.body.deepRollback) {
|
||||
await server.services.folderCommit.deepRollbackFolder(
|
||||
latestCommit.id,
|
||||
req.body.folderId,
|
||||
req.params.commitId,
|
||||
req.body.envId,
|
||||
req.permission.id,
|
||||
req.permission.type,
|
||||
req.params.workspaceId
|
||||
|
||||
@@ -112,14 +112,16 @@ const fetchRollback = async (
|
||||
commitId: string,
|
||||
projectId: string,
|
||||
deepRollback: boolean,
|
||||
message?: string
|
||||
message?: string,
|
||||
envId?: string
|
||||
) => {
|
||||
const { data } = await apiRequest.post<{ success: boolean }>(
|
||||
`/api/v1/pit/commits/${projectId}/${commitId}/rollback`,
|
||||
{
|
||||
folderId,
|
||||
deepRollback,
|
||||
message
|
||||
message,
|
||||
envId
|
||||
}
|
||||
);
|
||||
return data;
|
||||
@@ -164,7 +166,8 @@ export const useCommitRollback = ({
|
||||
folderId,
|
||||
deepRollback,
|
||||
environment,
|
||||
directory
|
||||
directory,
|
||||
envId
|
||||
}: {
|
||||
workspaceId: string;
|
||||
commitId: string;
|
||||
@@ -172,11 +175,12 @@ export const useCommitRollback = ({
|
||||
deepRollback: boolean;
|
||||
environment: string;
|
||||
directory: string;
|
||||
envId: string;
|
||||
}) => {
|
||||
const queryClient = useQueryClient();
|
||||
return useMutation({
|
||||
mutationFn: (message: string) =>
|
||||
fetchRollback(folderId, commitId, workspaceId, deepRollback, message),
|
||||
fetchRollback(folderId, commitId, workspaceId, deepRollback, message, envId),
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: [
|
||||
|
||||
@@ -121,7 +121,8 @@ export const RollbackPreviewTab = (): JSX.Element => {
|
||||
folderId,
|
||||
deepRollback,
|
||||
environment: envSlug,
|
||||
directory: secretPath
|
||||
directory: secretPath,
|
||||
envId: currentWorkspace.environments.find((e) => e.slug === envSlug)?.id || ""
|
||||
});
|
||||
|
||||
const { data: rollbackChangesNested, isLoading } = useGetRollbackPreview(
|
||||
|
||||
Reference in New Issue
Block a user