mirror of
https://github.com/Infisical/infisical.git
synced 2025-03-27 09:40:45 +00:00
Fixed rebase oopsie and updated for days instead of cron
This commit is contained in:
@ -1039,7 +1039,7 @@ export const updateSecretByName = async (req: Request, res: Response) => {
|
||||
secretKeyTag,
|
||||
secretKeyCiphertext,
|
||||
skipMultilineEncoding,
|
||||
secretReminderCron,
|
||||
secretReminderRepeatDays,
|
||||
secretReminderNote
|
||||
},
|
||||
params: { secretName }
|
||||
@ -1116,62 +1116,31 @@ export const updateSecretByName = async (req: Request, res: Response) => {
|
||||
authData: req.authData
|
||||
});
|
||||
|
||||
if (secretReminderCron !== undefined) {
|
||||
if (secretReminderRepeatDays !== undefined) {
|
||||
if (
|
||||
(secretReminderCron && existingSecret.secretReminderCron !== secretReminderCron) ||
|
||||
(secretReminderRepeatDays &&
|
||||
existingSecret.secretReminderRepeatDays !== secretReminderRepeatDays) ||
|
||||
(secretReminderNote && existingSecret.secretReminderNote !== secretReminderNote)
|
||||
) {
|
||||
await createReminder(existingSecret, {
|
||||
_id: existingSecret._id,
|
||||
secretReminderCron,
|
||||
secretReminderRepeatDays,
|
||||
secretReminderNote,
|
||||
workspace: existingSecret.workspace
|
||||
});
|
||||
} else if (
|
||||
secretReminderCron === null &&
|
||||
secretReminderRepeatDays === null &&
|
||||
secretReminderNote === null &&
|
||||
existingSecret.secretReminderCron
|
||||
existingSecret.secretReminderRepeatDays
|
||||
) {
|
||||
await deleteReminder({
|
||||
_id: existingSecret._id,
|
||||
secretReminderCron: existingSecret.secretReminderCron
|
||||
secretReminderRepeatDays: existingSecret.secretReminderRepeatDays
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type !== "personal") {
|
||||
const existingSecret = await SecretService.getSecret({
|
||||
secretName,
|
||||
workspaceId: new Types.ObjectId(workspaceId),
|
||||
environment,
|
||||
type,
|
||||
secretPath,
|
||||
authData: req.authData
|
||||
});
|
||||
|
||||
if (
|
||||
(secretReminderCron && existingSecret.secretReminderCron !== secretReminderCron) ||
|
||||
(secretReminderNote && existingSecret.secretReminderNote !== secretReminderNote)
|
||||
) {
|
||||
await createReminder(existingSecret, {
|
||||
_id: existingSecret._id,
|
||||
secretReminderCron,
|
||||
secretReminderNote,
|
||||
workspace: existingSecret.workspace
|
||||
});
|
||||
} else if (
|
||||
secretReminderCron === null &&
|
||||
secretReminderNote === null &&
|
||||
existingSecret.secretReminderCron
|
||||
) {
|
||||
await deleteReminder({
|
||||
_id: existingSecret._id,
|
||||
secretReminderCron: existingSecret.secretReminderCron
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const secret = await SecretService.updateSecret({
|
||||
secretName,
|
||||
workspaceId: new Types.ObjectId(workspaceId),
|
||||
@ -1182,7 +1151,7 @@ export const updateSecretByName = async (req: Request, res: Response) => {
|
||||
newSecretName,
|
||||
secretValueCiphertext,
|
||||
secretValueIV,
|
||||
secretReminderCron,
|
||||
secretReminderRepeatDays,
|
||||
secretReminderNote,
|
||||
secretValueTag,
|
||||
secretPath,
|
||||
|
Reference in New Issue
Block a user