bcgov / entity

ServiceBC Registry Team working on Legal Entities
Apache License 2.0
23 stars 57 forks source link

Dissolution Job - add logic to initiate dissolution process for businesses #21092

Open argush3 opened 2 weeks ago

argush3 commented 2 weeks ago

Note: #21091 is only a soft blocker for this ticket**

Implement logic in dissolutions job to initiate dissolution for businesses. This will be essentially step 1 in the RFC under the involuntary dissolutions section.

As there are still some unknowns and dependencies, do what you can and flag any issues that come up. We may need to cut additional tickets to address things that cannot be implemented yet.

TODOs

Example code that may be useful for checking if job can run today based off of NEW_DISSOLUTIONS_SCHEDULE value

import datetime
from croniter import croniter

def should_run_today(cron_string):
    """ Check if the cron_string matches today's date. """
    base = datetime.datetime.now()
    iter = croniter(cron_string, base)
    next_run = iter.get_next(datetime.datetime)
    return next_run.date() == base.date()

def main():
    # Cron string for running at midnight on Tuesday, Wednesday, and Thursday
    cron_string = '0 0 * * 2-4'

    if should_run_today(cron_string):
        print("Cron job logic runs today.")
    else:
        print("Cron job logic does not run today.")

if __name__ == "__main__":
    main()