Expose an API that can:
- Create a task of a specific type and execution time, returning the task's ID
- Show a list of tasks, filterable by their state (whatever states you define) and/or their task type
- Show a task based on its ID
- Delete a task based on its ID
- The tasks must be persisted into some external data store (your choice).
- Process each task only once and only at/after their specified execution time.
- Support running multiple instances of your code in parallel.
You will need two terminals:
- Let's create our container with vanilla postgres first
just db-only
- We have vanilla postgres with empty database for the project. Now let's
bootstrap
pg_cron
. Run it in 2nd terminal:
just db-load-pgcron
- Container was restarted. You can attach to it in 1st terminal again:
just db-only
- Let's continue the bootstrap process in 2nd terminal:
just db-bootstrap
Each time you provide new TENANT
value you will need to run:
just db-add-new-tenant db-migrate
For more info inspect the content of .env
(it's symlink to .env.docker
).
Then compare it with .env.local
. Notice the value of TENANT
variable
install dev tools
cargo install just
just dev-tools
find . -type l -iname ".env" | xargs rm -v && ln -s -v .env.local .env
just db-only
just test-unit
just local-api
just test-api
just build run
just test-api
Run migrations on db
just db-migrate
For new migration definition
sqlx migrate add <migration name w/o timestamp>