Approving API submit request before actually submitting it?

68 Views Asked by At

I am adding a new feature to a website which submits bulk jobs. The goal here is to add a approval step before the job is actually submitted. So earlier on clicking the submit button a request was made instantaneously and returned a jobId to the user to check the status of job, now it will take the user to a preview page which will show the approvalId and status of the approval but no actual jobId is created until approval is done.

After the approval is Completed the job will be submitted. And if the approval is Rejected, we will discard the job.

We have another application which will take care of the approval management and provides APIs using which we can easily integrate with them. We just need to design the changes required on our website.

I am looking for inputs on the following points -

  1. Till now we were directly submitting the jobs and hence do not have a mechanism to store the session while the job is in draft state. How can this be achieved, storing the session in DB would be a large overhead and we are trying to avoid it.
  2. How to handle the pending approvals? Automatically submit the job on approval or manually let the user submit it.

This is something that I would like to implement making least design changes to the existing design.

Thanks

1

There are 1 best solutions below

0
AudioBubble On

I don't see any point in storing user sessions in the database. If the user is logged in, you can always use SignalR to notify the requesting app (and hence the user) of the progress of the request. If the user is logging in again, the requesting app can read this information itself and present it to the user. If the request takes some time to get approved, there is nothing wrong with letting the user log in again. If however, that is inconvenient, you can increase the session timeout (but note that it comes with its own set of risks that need to be evaluated).

The second question is more of what your business wants to do rather than a technical question. (Unless I misunderstood what you are trying to say. In that case, please clarify.)