-
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/fix: Added user entity in auth response
- Loading branch information
1 parent
e4a8552
commit a52504c
Showing
23 changed files
with
98 additions
and
94 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
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
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,2 +1,2 @@ | ||
pub mod auth; | ||
pub mod auth_verify; | ||
pub mod auth_verify; |
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 +1 @@ | ||
pub mod serviceability; | ||
pub mod serviceability; |
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,17 +1,19 @@ | ||
use geo::Contains; | ||
|
||
use crate::{storage::models::geometry::ServiceabilityRequest, tools::polygon_utils::geo_json::get_available_shape_files, web, HttpResponse, ServerState}; | ||
use crate::{ | ||
storage::models::geometry::ServiceabilityRequest, | ||
tools::polygon_utils::geo_json::get_available_shape_files, web, HttpResponse, ServerState, | ||
}; | ||
use geo::{coord, Intersects}; | ||
|
||
pub fn origin_serviceability( | ||
state: web::Data<ServerState>, | ||
_: web::Data<ServerState>, | ||
req: web::Json<ServiceabilityRequest>, | ||
) -> HttpResponse { | ||
let areas = get_available_shape_files(); | ||
let mut result = false; | ||
for area in areas { | ||
if (area.get_polygon().contains(&req.point)) { | ||
result = true; | ||
} | ||
return HttpResponse::Ok().json( | ||
area.get_polygon() | ||
.intersects(&coord! {x: req.point.lon, y: req.point.lat}), | ||
); | ||
} | ||
return HttpResponse::Ok().json(result); | ||
return HttpResponse::Ok().json(false); | ||
} |
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,3 +1,3 @@ | ||
pub mod auth; | ||
pub mod error_handler; | ||
pub mod geometry; | ||
pub mod geometry; |
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
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,4 +1,4 @@ | ||
pub mod auth; | ||
pub mod routes; | ||
pub mod serviceability; | ||
pub mod session; | ||
pub mod serviceability; |
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,10 +1,15 @@ | ||
use actix_web::{get, http::header::AUTHORIZATION, web, HttpRequest, HttpResponse}; | ||
use actix_web::{get, web, HttpResponse}; | ||
|
||
use crate::{ | ||
handlers::geometry::serviceability::origin_serviceability, storage::models, tools::{session_utils::SessionToken, utils::get_token_from_bearer}, types::ServerState | ||
handlers::geometry::serviceability::origin_serviceability, | ||
storage::models, | ||
types::ServerState, | ||
}; | ||
|
||
#[get("origin/serviceability")] | ||
pub async fn serviceability(state: web::Data<ServerState>, req: web::Json<models::geometry::ServiceabilityRequest>,) -> HttpResponse { | ||
return origin_serviceability(state,req); | ||
pub async fn serviceability( | ||
state: web::Data<ServerState>, | ||
req: web::Json<models::geometry::ServiceabilityRequest>, | ||
) -> HttpResponse { | ||
return origin_serviceability(state, req); | ||
} |
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,16 +1,18 @@ | ||
use diesel::sql_types::Bool; | ||
use geo::{coord, Coord}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
|
||
#[derive(Deserialize, Serialize)] | ||
pub struct ServiceabilityRequest { | ||
pub point: LatLong, | ||
} | ||
|
||
#[derive(Deserialize, Serialize)] | ||
pub struct ServiceabilityRequest { | ||
pub point : Coord, | ||
pub struct LatLong { | ||
pub lat: f64, | ||
pub lon: f64, | ||
} | ||
|
||
#[derive(Deserialize, Serialize)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct ServiceabilityResponse { | ||
pub serviceable: bool, | ||
} | ||
} |
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,3 +1,3 @@ | ||
pub mod auth; | ||
pub mod geometry; | ||
pub mod user; | ||
pub mod geometry; |
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,4 +1,3 @@ | ||
|
||
pub const ONEWEEK: i64 = 7 * 24 * 60; | ||
|
||
pub const SHAPE_FILE_PATH: &str = "./shape_files"; | ||
pub const SHAPE_FILE_PATH: &str = "./shape_files"; |
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,5 +1,5 @@ | ||
pub mod utils; | ||
pub mod contants; | ||
pub mod session_utils; | ||
pub mod polygon_utils; | ||
pub mod types; | ||
pub mod session_utils; | ||
pub mod types; | ||
pub mod utils; |
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
Oops, something went wrong.