Use the following commands to run the application:
cargo run
: Runs the server with default parameters.cargo run l
: Runs the server onlocalhost:5040
.
File | Description |
---|---|
src/api.rs |
Sets up REST API routes. |
src/database.rs |
Interfaces with the database and defines the data structures. |
src/main.rs |
Runs the server. |
src/simulation.rs |
Simulates a print job going through a workflow. |
src/validation.rs |
Validates a workflow before it gets inserted into the database. |
tests/ |
Contains test files. |
db/ |
Contains SQLite database binary file, and SQL |
This project uses SQLite 3.
SQLite stores data in a single file (.db3)
The database is executed and maintained via the Rusqlite library for Rust.
If you require access to the database to inspect it's contents, or to make changes,<br>
you may do so via the sqlite3 program. <br>
- To access an existing database:
- sqlite3 /path/to/database.db3
- To execute SQL on a database
- sqlite3 /path/to/database.db3 < /path/to/file.sql
Stores the various rasterization profile options. Currently, only the title is stored, but more fields may be added soon.
Attribute | Type |
---|---|
id (pk) |
integer |
title |
text |
Print jobs are used in conjunction with workflows to run simulations. Factors such as page_count
and rasterization_profile
will affect simulation times.
Attribute | Type |
---|---|
id (pk) |
integer |
title |
text |
creation_time |
integer |
page_count |
integer |
rasterization_profile_id (fk) |
integer |
Workflows simulate print jobs and define the steps involved. The steps of a workflow are stored in the workflow_step
table and assigned to workflows via the assigned_workflow_step
table.
Attribute | Type |
---|---|
id (pk) |
integer |
title |
text |
creation_time |
integer |
total_time_taken |
integer |
printjobID (fk) |
integer |
workflowID (fk) |
integer |
Attribute | Type |
---|---|
id |
integer (pk) |
title |
text |
setup_time |
integer |
time_per_page |
integer |
Assigns workflow steps to specific workflows.
Attribute | Type |
---|---|
id |
integer (pk) |
workflow_id (fk) |
integer |
workflow_step_id (fk) |
integer |
Defines the sequence of steps in a workflow by linking a workflow step to its next step.
Attribute | Type |
---|---|
assigned_workflow_step_id |
integer (pk, fk) |
next_step_id |
integer (pk, fk) |
Defines the reverse sequence of steps in a workflow by linking a workflow step to its previous step.
Attribute | Type |
---|---|
assigned_workflow_step_id |
integer (pk, fk) |
prev_step_id |
integer (pk, fk) |
Tracks the execution of workflow steps within a simulation report.
These haven't been implemented yet.
Attribute | Type |
---|---|
workflow_step_id (fk) |
integer |
simulation_report_id (fk) |
integer |
time_taken |
integer |
These could either be hardcoded or stored in a database:
- Rules: A data structure that enforces constraints on data being entered into the database. For example, ensuring specific workflow steps are performed in a particular order (e.g., printing must occur before laminating). These rules can be requested by the frontend to provide real-time feedback when creating resources. The frontend sends the validated data to the backend, where the same rules are enforced.
For more information, visit the following resources:
GET /[COLL]?opt_param1=example1&opt_param2=example2
Retrieves all documents from a collection matching the given parameters. If no parameters are specified, returns the entire collection.- 200 (OK): Returns a list of documents (can be empty).
- 400 (Bad Request): Improperly formatted query.
GET /[COLL]/:id
Retrieves a specific document by ID.- 200 (OK): Returns the document.
- 400 (Bad Request): Invalid ID format.
- 404 (Not Found): Document does not exist.
POST /RasterizationProfile
Creates a new rasterization profile. Request body includes:- id
- title
POST /PrintJob
Creates a new print job. Request body includes:- Title
- DateCreated
- PageCount
- RasterizationProfile
POST /Workflow
Creates a new workflow. Request body includes:- Title
- WorkflowSteps
POST /SimulationReport
Creates a new simulation report. Request body includes:- pj_id
- wf_id
- 201 (Created): Returns new SimulationReport ID.
DELETE /RasterizationProfile/:id
Deletes a specific print job by ID.- 204 (No Content): Successful deletion.
- 400 (Bad Request): Invalid ID format.
- 404 (Not Found): Document does not exist.
- 409 (Conflict): Existing PrintJob rely on this PrintJob.
DELETE /PrintJob/:id
Deletes a specific print job by ID.- 204 (No Content): Successful deletion.
- 400 (Bad Request): Invalid ID format.
- 404 (Not Found): Document does not exist.
- 409 (Conflict): Existing SimulationReports rely on this PrintJob.
DELETE /Workflow/:id
Deletes a specific workflow by ID.- 204 (No Content): Successful deletion.
- 400 (Bad Request): Invalid ID format.
- 404 (Not Found): Document does not exist.
- 409 (Conflict): Existing SimulationReports rely on this Workflow.
DELETE /SimulationReport/:id
Deletes a specific simulation report by ID.- 204 (No Content): Successful deletion