Skip to content

Commit

Permalink
add comments, fix tests, rename more files, fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jr1221 committed Sep 16, 2024
1 parent 6c18461 commit f0956c2
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
- name: Build and push Docker image for scylla server rust
uses: docker/[email protected]
with:
context: ./scylla-server-rust
context: ./scylla-server
push: true
platforms: linux/arm64,linux/amd64
tags: ${{ steps.meta.outputs.tags }}
Expand Down
7 changes: 4 additions & 3 deletions scylla-server/integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

echo "Starting db"
cd ..
docker compose run -Pd odyssey-timescale
docker compose up -d odyssey-timescale

echo "Deploying prisma"
cd ./scylla-server-rust
cd ./scylla-server
cargo prisma migrate deploy

echo "Running tests"
SOURCE_DATABASE_URL=postgresql://postgres:[email protected]:5432/postgres cargo test -- --test-threads=1

echo "Please stop your db in docker"
cd ..
docker compose down
1 change: 1 addition & 0 deletions scylla-server/src/controllers/data_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
Database,
};

/// Get all of the data points of a certain data type name and run ID
pub async fn get_data(
State(db): State<Database>,
Path((data_type_name, run_id)): Path<(String, i32)>,
Expand Down
1 change: 1 addition & 0 deletions scylla-server/src/controllers/data_type_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
transformers::data_type_transformer::PublicDataType, Database,
};

/// Get a list of data types
pub async fn get_all_data_types(
State(db): State<Database>,
) -> Result<Json<Vec<PublicDataType>>, ScyllaError> {
Expand Down
1 change: 1 addition & 0 deletions scylla-server/src/controllers/driver_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
Database,
};

/// Get a list of drivers
pub async fn get_all_drivers(
State(db): State<Database>,
) -> Result<Json<Vec<PublicDriver>>, ScyllaError> {
Expand Down
1 change: 1 addition & 0 deletions scylla-server/src/controllers/location_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
transformers::location_transformer::PublicLocation, Database,
};

/// get a list of locations
pub async fn get_all_locations(
State(db): State<Database>,
) -> Result<Json<Vec<PublicLocation>>, ScyllaError> {
Expand Down
1 change: 1 addition & 0 deletions scylla-server/src/controllers/node_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
Database,
};

/// get a list of nodes
pub async fn get_all_nodes(
State(db): State<Database>,
) -> Result<Json<Vec<PublicNode>>, ScyllaError> {
Expand Down
4 changes: 4 additions & 0 deletions scylla-server/src/controllers/run_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::{
error::ScyllaError, services::run_service, transformers::run_transformer::PublicRun, Database,
};

/// get a list of runs
pub async fn get_all_runs(State(db): State<Database>) -> Result<Json<Vec<PublicRun>>, ScyllaError> {
let run_data = run_service::get_all_runs(&db).await?;

Expand All @@ -18,6 +19,7 @@ pub async fn get_all_runs(State(db): State<Database>) -> Result<Json<Vec<PublicR
Ok(Json::from(transformed_run_data))
}

/// get a run given its ID
pub async fn get_run_by_id(
State(db): State<Database>,
Path(run_id): Path<i32>,
Expand All @@ -35,6 +37,8 @@ pub async fn get_run_by_id(
Ok(Json::from(transformed_run_data))
}

/// create a new run with an auto-incremented ID
/// note the new run must be updated so the channel passed in notifies the data processor to use the new run
pub async fn new_run(
State(db): State<Database>,
Extension(channel): Extension<mpsc::Sender<run_service::public_run::Data>>,
Expand Down
1 change: 1 addition & 0 deletions scylla-server/src/controllers/system_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use crate::{
Database,
};

/// get a list of systems
pub async fn get_all_systems(
State(db): State<Database>,
) -> Result<Json<Vec<PublicSystem>>, ScyllaError> {
Expand Down
4 changes: 2 additions & 2 deletions scylla-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ async fn main() {
};

let app = Router::new()
// DATA ROUTES
// DATA
.route(
"/data/:dataTypeName/:runId",
get(controllers::data_controller::get_data),
)
// DATA TYPE ROUTES
// DATA TYPE
.route("/datatypes", get(data_type_controller::get_all_data_types))
// DRIVERS
.route("/drivers", get(driver_controller::get_all_drivers))
Expand Down

0 comments on commit f0956c2

Please sign in to comment.