Added login endpoint
This commit is contained in:
41
src/callers/login.rs
Normal file
41
src/callers/login.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
pub mod request {
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Default, Deserialize, Serialize)]
|
||||
pub struct Request {
|
||||
}
|
||||
}
|
||||
|
||||
pub mod response {
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Default, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub message: String,
|
||||
}
|
||||
}
|
||||
|
||||
pub mod endpoint {
|
||||
use axum::{Json, http::StatusCode};
|
||||
|
||||
use crate::hashing;
|
||||
use crate::repo;
|
||||
use crate::token_stuff;
|
||||
|
||||
use super::request;
|
||||
use super::response;
|
||||
|
||||
pub async fn login(
|
||||
axum::Extension(pool): axum::Extension<sqlx::PgPool>,
|
||||
Json(payload): Json<request::Request>,
|
||||
) -> (StatusCode, Json<response::Response>) {
|
||||
let mut usr = icarus_models::user::User::default();
|
||||
|
||||
(
|
||||
StatusCode::OK,
|
||||
Json(response::Response {
|
||||
message: String::from("Not implemented"),
|
||||
}),
|
||||
)
|
||||
}
|
||||
}
|
@@ -1,8 +1,10 @@
|
||||
pub mod common;
|
||||
pub mod login;
|
||||
pub mod register;
|
||||
|
||||
pub mod endpoints {
|
||||
pub const ROOT: &str = "/";
|
||||
pub const REGISTER: &str = "/api/v2/register";
|
||||
pub const DBTEST: &str = "/api/v2/test/db";
|
||||
pub const LOGIN: &str = "/api/v2/login";
|
||||
}
|
||||
|
Reference in New Issue
Block a user