-
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.
Merge pull request #61 from Chronolens/face_creation_endpoint
Face creation endpoint
- Loading branch information
Showing
5 changed files
with
72 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use axum::{ | ||
extract::{Json, State, Extension}, | ||
http::StatusCode, | ||
}; | ||
use crate::models::api_models::CreateFacePayload; | ||
use crate::ServerConfig; | ||
|
||
pub async fn create_face( | ||
State(server_config): State<ServerConfig>, | ||
Extension(user_id): Extension<String>, | ||
Json(payload): Json<CreateFacePayload>, | ||
) -> StatusCode { | ||
// println!("User ID: {}", user_id); | ||
// println!("Payload IDs: {:?}", payload.ids); | ||
// println!("Payload Name: {}", payload.name); | ||
match server_config | ||
.database | ||
.insert_face(user_id.clone(), payload.ids.clone(), payload.name.clone()) | ||
.await | ||
{ | ||
Ok(_) => StatusCode::OK, | ||
Err(_) => StatusCode::INTERNAL_SERVER_ERROR, | ||
} | ||
} |
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 |
---|---|---|
|
@@ -12,3 +12,4 @@ pub mod register; | |
pub mod sync_full; | ||
pub mod sync_partial; | ||
pub mod upload_image; | ||
pub mod create_face; |
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