patch secret apporval request secrets

This commit is contained in:
Maidul Islam
2024-01-27 12:40:37 +05:30
committed by Akhil Mohan
parent 29df6f067e
commit dd0f9f5216
+8 -5
View File
@@ -2412,11 +2412,9 @@ const main = async () => {
const secret = await Secret.findById(commit.secret); const secret = await Secret.findById(commit.secret);
if (!secret) return; if (!secret) return;
if ( if (!secret?.secretBlindIndex) return;
!commit.newVersion.secretBlindIndex ||
!secret?.secretBlindIndex const secretVersion = await secVerKv.get(commit.secretVersion._id.toString())
)
return;
return { return {
id, id,
@@ -2452,6 +2450,7 @@ const main = async () => {
secretCommentCiphertext: secretCommentCiphertext:
commit.newVersion.secretCommentCiphertext || commit.newVersion.secretCommentCiphertext ||
secret.secretCommentCiphertext, secret.secretCommentCiphertext,
secretVersion,
createdAt: new Date((doc as any).createdAt), createdAt: new Date((doc as any).createdAt),
updatedAt: new Date((doc as any).updatedAt), updatedAt: new Date((doc as any).updatedAt),
}; };
@@ -2468,6 +2467,9 @@ const main = async () => {
if (!secret) return; if (!secret) return;
if (!secret?.secretBlindIndex) return; if (!secret?.secretBlindIndex) return;
const secretVersion = await secVerKv.get(commit.secretVersion._id.toString())
return { return {
id, id,
op: CommitType.DELETE, op: CommitType.DELETE,
@@ -2486,6 +2488,7 @@ const main = async () => {
secretCommentIV: secret.secretCommentIV, secretCommentIV: secret.secretCommentIV,
secretCommentTag: secret.secretCommentTag, secretCommentTag: secret.secretCommentTag,
secretCommentCiphertext: secret.secretCommentCiphertext, secretCommentCiphertext: secret.secretCommentCiphertext,
secretVersion,
createdAt: new Date((doc as any).createdAt), createdAt: new Date((doc as any).createdAt),
updatedAt: new Date((doc as any).updatedAt), updatedAt: new Date((doc as any).updatedAt),
}; };