isomerpages / isomercms-backend

A static website builder and host for the Singapore Government
5 stars 1 forks source link

Is 219 be add routes to start of site launch process to be called from fe #818

Closed kishore03109 closed 1 year ago

kishore03109 commented 1 year ago

Problem

Add in routes for site launch. To be reviewed in conjunction with fe pr

Solution

Add in the routes launchSite and launchInfo to enable this functionality.

Breaking Changes

Features:

This PR introduces some semantic changes for the end state for the site that will be stored in the db. Previously, all site launches used end with a site_status = LAUNCHED and the job_status = RUNNING. Moving forward, we want to make it such that at the end state, we want to change this site_status = LAUNCHED and job_status = READY. The problem I am trying to solve here is that I need a way to store in the DB that the launch process has started, but has yet to complete, as this leads to a visual change of what we display to the user. What this means is that there will be some manual remediation for the already launched sites to modify their states to job_status from RUNNING to READY. Open to alternatives to solve this!

CC. @seaerchin @harishv7 I want to introduce a util method for the error handling stuff. I noticed that there are quite a number of functions that require me to throw an error, and log the exact same message. I have introduced this in here, but am not sure if this is the best place to put this/if there is already an util function for this.

Note to reviewers I am not too sure if I am logging this error message properly. The reason for this dilemma is that an error thrown here is not necessarily an error. It could mean that the site launch process has not started, or already ended. I am still opting for logging the error here as if in the case of an genuine error, at least we can refer to the logs for this rather than being confused about why that occurred in the first place

Tests

I will be exploring introducing e2e tests for this but don't have bandwidth to do this yet. for now a manual test is shown here.