Skip to content

WSU-V students' capstone project for HP, 2025. Server-side/backend application.

Notifications You must be signed in to change notification settings

amychisholm03/hp-capstone-2025-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Running the Application

Run

Use the following commands to run the application:

  • cargo run: Runs the server with default parameters.
  • cargo run l: Runs the server on localhost:5040.

File Structure

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.
tests/ Contains test files.
db/ Contains SQLite database binary file, and SQL>

Database Schema

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,
you may do so via the sqlite3 program.

  • 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

rasterization_profile

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

printjob

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

workflow

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

workflow_step

Attribute Type
id integer (pk)
title text
setup_time integer
time_per_page integer

assigned_workflow_step

Assigns workflow steps to specific workflows.

Attribute Type
id integer (pk)
workflow_id (fk) integer
workflow_step_id (fk) integer

next_workflow_step

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)

prev_workflow_step

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)

ran_workflow_step

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

Other Data Structures

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.

REST API

HTTP Methods

For more information, visit the following resources:

GET

  • 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

  • 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

  • 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

About

WSU-V students' capstone project for HP, 2025. Server-side/backend application.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published