Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
McPizza0 committed Dec 9, 2024
1 parent dfa3e3c commit 46fc06d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ export const secretApprovalPolicyDALFactory = (db: TDbClient) => {
};

const softDeleteById = async (policyId: string, tx?: Knex) => {
const date = new Date();
const softDeletedPolicy = await secretApprovalPolicyOrm.updateById(policyId, { deletedAt: date }, tx);
const softDeletedPolicy = await secretApprovalPolicyOrm.updateById(policyId, { deletedAt: new Date() }, tx);
return softDeletedPolicy;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,16 @@ export const secretApprovalPolicyServiceFactory = ({
});
}

await secretApprovalPolicyDAL.transaction(async (tx) => {
const deletedPolicy = await secretApprovalPolicyDAL.transaction(async (tx) => {
await secretApprovalRequestDAL.update(
{ policyId: secretPolicyId, status: RequestState.Open },
{ status: RequestState.Closed },
tx
);
await secretApprovalPolicyDAL.softDeleteById(secretPolicyId, tx);
const updatedPolicy = await secretApprovalPolicyDAL.softDeleteById(secretPolicyId, tx);
return updatedPolicy;
});
return sapPolicy;
return deletedPolicy;
};

const getSecretApprovalPolicyByProjectId = async ({
Expand Down

0 comments on commit 46fc06d

Please sign in to comment.