Initial PR with core structure. It's not all there yet, but it's enough to get started.
Overview
Overview of the layout
Tonic service: The top level of the service. All implementations will be instances of this struct with the ProcessForm function and form elements defined separately for each.
web.Server: The web server component.
Database: A sqlite database that holds the submitted jobs.
JobInfo: Maps to the database table for the jobs and holds all information required for a job, minus the actual action performed.
Worker: Maintains a job queue and runs them in order of submission. The actual task carried out by each job is implemented separately for each instance. This can be defined inside the ProcessForm implementation of the Tonic service, which will have access to each submitted form's data and can bind the values through a closure.
Job: Extends the ORMed JobInfo with the function carried out for each job.
Form: The form is currently defined as a list of Element instances. I'm planning to extend this to support multiple pages of elements.
Notes and plans
Web routes are defined outside the web layer at the Tonic service layer. This is useful for having access to the database or the job queue as needed. I also intend to add the ability for implementations to define extra routes in case an implementation requires one.
The configuration struct is there but there's no way to get data into it yet.
I intend to add a top-level logger that's attached to the Tonic service. Implementations can use the same logger for their own messaging.
I will also add a session store in the database. Currently, the user's token is stored in a cookie. Instead, I want to store a session ID that maps to a cookie in the database as well as any other information we might need.
I expect more details will change in the next PR when I finalise the implementation for the research project creation bot. I'll also add a bot that does nothing except create empty jobs that print a log line as an example and test implementation.
Initial PR with core structure. It's not all there yet, but it's enough to get started.
Overview
Overview of the layout
ProcessForm
function and form elements defined separately for each.Notes and plans