-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
backend/feat: #20 Added Driver Module
- Loading branch information
1 parent
a52504c
commit 20da1e2
Showing
108 changed files
with
989 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Rust | ||
|
||
on: [pull_request] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
permissions: | ||
statuses: write | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: Backend/crates/driver/ | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Update Status | ||
uses: ouzi-dev/commit-status-updater@v2 | ||
with: | ||
status: "${{ job.status }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,6 @@ | ||
[package] | ||
name = "stosp" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
actix-web = "4.3.0" | ||
actix-rt = "2.8.0" | ||
chrono = { version = "0.4", features = ["serde"] } | ||
dotenv = "0.15.0" | ||
diesel = { version = "2.0.3", features = ["postgres", "r2d2", "uuid", "chrono"] } | ||
diesel_migrations = "2.0.0" | ||
env_logger = "0.11.1" | ||
lazy_static = "1.4" | ||
listenfd = "1.0.0" | ||
log = "0.4" | ||
serde = {version = "1.0", features = ["derive"]} | ||
serde_json = "1.0" | ||
r2d2 = "0.8" | ||
rand = "0.8" | ||
futures = "0.3.26" | ||
futures-util = "0.3.26" | ||
futures-macro = "0.3.26" | ||
chacha20poly1305 = "0.10.1" | ||
base64 = "0.22.0" | ||
jsonwebtoken = "9.2.0" | ||
serde_dhall ="0.12.1" | ||
uuid = { version = "1.3.0", features = ["serde", "v4"] } | ||
cargo-watch = "8.5.2" | ||
cargo-run-script = "0.2.0" | ||
geo = { version = "0.28.0", features = ["use-serde"] } | ||
geojson = { version = "0.24.1", features = ["geo-types"] } | ||
|
||
[package.metadata.scripts] | ||
start = "cargo watch -x run" | ||
goodbye = "echo Goodbye" | ||
install = "cargo install --path . --force" | ||
[workspace] | ||
resolver = "2" | ||
members = ["crates/*"] | ||
package.name = "stosp" | ||
package.edition = "2021" | ||
package.license = "Apache-2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[package] | ||
name = "common" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
actix-web = "4.5.1" | ||
actix-rt = "2.9.0" | ||
chrono = { version = "0.4", features = ["serde"] } | ||
diesel = { version = "2.1.6", features = ["postgres", "r2d2", "uuid", "chrono"] } | ||
diesel_migrations = "2.1.0" | ||
geo = { version = "0.28.0", features = ["use-serde"] } | ||
geojson = { version = "0.24.1", features = ["geo-types"] } | ||
jsonwebtoken = "9.3.0" | ||
serde = {version = "1.0.199", features = ["derive"]} | ||
serde_json = "1.0.116" | ||
log = "0.4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub mod tools; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[package] | ||
name = "driver" | ||
version = "0.1.0" | ||
edition.workspace = true | ||
license.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
actix-web = "4.5.1" | ||
actix-rt = "2.9.0" | ||
chrono = { version = "0.4", features = ["serde"] } | ||
dotenv = "0.15.0" | ||
diesel = { version = "2.1.6", features = ["postgres", "r2d2", "uuid", "chrono"] } | ||
diesel_migrations = "2.1.0" | ||
lazy_static = "1.4" | ||
listenfd = "1.0.1" | ||
log = "0.4" | ||
serde = {version = "1.0.199", features = ["derive"]} | ||
serde_json = "1.0.116" | ||
r2d2 = "0.8.10" | ||
rand = "0.8.5" | ||
futures = "0.3.30" | ||
futures-util = "0.3.30" | ||
futures-macro = "0.3.30" | ||
chacha20poly1305 = "0.10.1" | ||
base64 = "0.22.0" | ||
jsonwebtoken = "9.3.0" | ||
serde_dhall ="0.12.1" | ||
uuid = { version = "1.8.0", features = ["serde", "v4"] } | ||
cargo-watch = "8.5.2" | ||
cargo-run-script = "0.2.0" | ||
geo = { version = "0.28.0", features = ["use-serde"] } | ||
geojson = { version = "0.24.1", features = ["geo-types"] } | ||
common = { path = "../common" } | ||
|
||
[package.metadata.scripts] | ||
start = "cargo watch -x run" | ||
goodbye = "echo Goodbye" | ||
install = "cargo install --path . --force" | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# For documentation on how to configure this file, | ||
# see https://diesel.rs/guides/configuring-diesel-cli | ||
|
||
[print_schema] | ||
file = "src/db/schema.rs" | ||
schema = "school_trips_driver" | ||
|
||
[migrations_directory] | ||
dir = "./migrations" |
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
Backend/crates/driver/migrations/2024-05-01-125352_initial-queries/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-- This file should undo anything in `up.sql` |
33 changes: 33 additions & 0 deletions
33
Backend/crates/driver/migrations/2024-05-01-125352_initial-queries/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- Your SQL goes here | ||
CREATE SCHEMA IF NOT EXISTS school_trips_driver; | ||
CREATE TABLE school_trips_driver.auth | ||
( | ||
id VARCHAR(255) PRIMARY KEY, | ||
mobile_number VARCHAR NOT NULL, | ||
country_code VARCHAR(10) NOT NULL, | ||
token VARCHAR NOT NULL, | ||
created_at TIMESTAMP NOT NULL, | ||
otp VARCHAR(10) NOT NULL, | ||
updated_at TIMESTAMP NOT NULL | ||
); | ||
|
||
ALTER TABLE school_trips_driver.auth ADD COLUMN token_expiry TIMESTAMP NOT NULL DEFAULT now(); | ||
ALTER TABLE school_trips_driver.auth ALTER COLUMN created_at SET DATA TYPE TIMESTAMPTZ; | ||
ALTER TABLE school_trips_driver.auth ALTER COLUMN updated_at SET DATA TYPE TIMESTAMPTZ; | ||
ALTER TABLE school_trips_driver.auth ALTER COLUMN token_expiry SET DATA TYPE TIMESTAMPTZ; | ||
|
||
CREATE TYPE school_trips_driver.role_type AS ENUM ('PARENT', 'DRIVER'); | ||
|
||
CREATE TABLE school_trips_driver.users | ||
( name Varchar(255), | ||
created_at TIMESTAMPTZ NOT NULL, | ||
updated_at TIMESTAMPTZ NOT NULL, | ||
session_token Varchar NOT NULL, | ||
mobile_number Varchar NOT NULL, | ||
role role_type NOT NULL, | ||
id Varchar PRIMARY KEY | ||
); | ||
|
||
ALTER TABLE school_trips_driver.auth ADD COLUMN role role_type NOT NULL; | ||
|
||
ALTER TABLE school_trips_driver.users DROP COLUMN session_token; |
1 change: 1 addition & 0 deletions
1
Backend/crates/driver/migrations/2024-05-01-125647_create-role-type/down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-- This file should undo anything in `up.sql` |
2 changes: 2 additions & 0 deletions
2
Backend/crates/driver/migrations/2024-05-01-125647_create-role-type/up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Your SQL goes here | ||
CREATE TYPE school_trips_driver.role_type AS ENUM ('PARENT', 'DRIVER'); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// @generated automatically by Diesel CLI. | ||
|
||
pub mod school_trips_driver { | ||
pub mod sql_types { | ||
#[derive(diesel::sql_types::SqlType)] | ||
#[diesel(postgres_type(name = "role_type"))] | ||
pub struct RoleType; | ||
} | ||
|
||
diesel::table! { | ||
use diesel::sql_types::*; | ||
use super::sql_types::RoleType; | ||
|
||
school_trips_driver.auth (id) { | ||
#[max_length = 255] | ||
id -> Varchar, | ||
mobile_number -> Varchar, | ||
#[max_length = 10] | ||
country_code -> Varchar, | ||
token -> Varchar, | ||
created_at -> Timestamptz, | ||
#[max_length = 10] | ||
otp -> Varchar, | ||
updated_at -> Timestamptz, | ||
token_expiry -> Timestamptz, | ||
role -> RoleType, | ||
} | ||
} | ||
|
||
diesel::table! { | ||
use diesel::sql_types::*; | ||
use super::sql_types::RoleType; | ||
|
||
school_trips_driver.users (id) { | ||
#[max_length = 255] | ||
name -> Nullable<Varchar>, | ||
created_at -> Timestamptz, | ||
updated_at -> Timestamptz, | ||
mobile_number -> Varchar, | ||
role -> RoleType, | ||
id -> Varchar, | ||
} | ||
} | ||
|
||
diesel::allow_tables_to_appear_in_same_query!( | ||
auth, | ||
users, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...d/src/handlers/geometry/serviceability.rs → ...r/src/handlers/geometry/serviceability.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
Backend/src/routes/session.rs → Backend/crates/driver/src/routes/session.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.