diff --git a/angular-client/src/utils/types.utils.ts b/angular-client/src/utils/types.utils.ts index a8f54665..8c36c5e8 100644 --- a/angular-client/src/utils/types.utils.ts +++ b/angular-client/src/utils/types.utils.ts @@ -36,6 +36,7 @@ export type Run = { locationName: string; driverName: string; time: Date; + notes: string; }; export type Coordinate = { diff --git a/scylla-server/migrations/2024-11-10-031516_create_all/down.sql b/scylla-server/migrations/2024-11-10-031516_create_all/down.sql index 92b734d9..151b2412 100644 --- a/scylla-server/migrations/2024-11-10-031516_create_all/down.sql +++ b/scylla-server/migrations/2024-11-10-031516_create_all/down.sql @@ -1,4 +1,8 @@ --- This file should undo anything in `up.sql` -DROP TABLE "run"; +-- Drop Foreign Keys +ALTER TABLE "data" DROP CONSTRAINT "data_runId_fkey"; +ALTER TABLE "data" DROP CONSTRAINT "data_dataTypeName_fkey"; + +-- Drop Tables DROP TABLE "data"; -DROP TABLE "dataType"; \ No newline at end of file +DROP TABLE "dataType"; +DROP TABLE "run"; diff --git a/scylla-server/migrations/2024-11-10-031516_create_all/up.sql b/scylla-server/migrations/2024-11-10-031516_create_all/up.sql index 9ad478bf..71d46db7 100644 --- a/scylla-server/migrations/2024-11-10-031516_create_all/up.sql +++ b/scylla-server/migrations/2024-11-10-031516_create_all/up.sql @@ -5,7 +5,7 @@ CREATE TABLE "run" ( "latitude" DOUBLE PRECISION, "longitude" DOUBLE PRECISION, "driverName" TEXT, - "notes" TEXT NOT NULL, + "notes" TEXT DEFAULT '', "time" TIMESTAMPTZ NOT NULL, CONSTRAINT "run_pkey" PRIMARY KEY ("id") diff --git a/scylla-server/src/services/run_service.rs b/scylla-server/src/services/run_service.rs index 1c2e0d11..f12d3205 100644 --- a/scylla-server/src/services/run_service.rs +++ b/scylla-server/src/services/run_service.rs @@ -29,7 +29,7 @@ pub async fn create_run( timestamp: DateTime, ) -> Result { diesel::insert_into(run) - .values((time.eq(timestamp), notes.eq("A"))) + .values(time.eq(timestamp)) .get_result(db) } @@ -44,7 +44,7 @@ pub async fn create_run_with_id( run_id: i32, ) -> Result { diesel::insert_into(run) - .values((time.eq(timestamp), id.eq(run_id), notes.eq("A"))) + .values((time.eq(timestamp), id.eq(run_id))) .get_result(db) } diff --git a/scylla-server/src/transformers/run_transformer.rs b/scylla-server/src/transformers/run_transformer.rs index 5540c1a5..bd7676d1 100644 --- a/scylla-server/src/transformers/run_transformer.rs +++ b/scylla-server/src/transformers/run_transformer.rs @@ -10,6 +10,7 @@ pub struct PublicRun { pub driver_name: String, #[serde(rename = "time")] pub time_ms: i64, + pub notes: String, } impl From for PublicRun { @@ -19,6 +20,7 @@ impl From for PublicRun { location_name: value.locationName.unwrap_or_default(), driver_name: value.driverName.clone().unwrap_or_default(), time_ms: value.time.timestamp_millis(), + notes: value.notes, } } }