mirror of
https://github.com/thanipro/Axum-Rust-Rest-Api-Template
synced 2024-11-10 06:04:16 +00:00
group use statement, fix user sql
This commit is contained in:
parent
6715970628
commit
0c342b3484
6 changed files with 10 additions and 23 deletions
|
@ -6,7 +6,7 @@ CREATE TABLE `user` (
|
|||
`email` varchar(255) NOT NULL,
|
||||
`password` varchar(255) NOT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`updated_at` timestamp NULL,
|
||||
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `user_name` (`user_name`),
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use crate::error::db_error::DbError;
|
||||
use crate::error::token_error::TokenError;
|
||||
use crate::error::user_error::UserError;
|
||||
use crate::error::{db_error::DbError,token_error::TokenError, user_error::UserError };
|
||||
use axum::response::{IntoResponse, Response};
|
||||
use thiserror::Error;
|
||||
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
use crate::response::api_response::ApiErrorResponse;
|
||||
use async_trait::async_trait;
|
||||
use axum::body::HttpBody;
|
||||
use axum::extract::rejection::JsonRejection;
|
||||
use axum::extract::FromRequest;
|
||||
use axum::http::Request;
|
||||
use axum::{body::HttpBody,http::Request, BoxError, Json};
|
||||
use axum::extract::{rejection::JsonRejection, FromRequest};
|
||||
use axum::response::{IntoResponse, Response};
|
||||
use axum::{BoxError, Json};
|
||||
use serde::de::DeserializeOwned;
|
||||
use thiserror::Error;
|
||||
use validator::Validate;
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
use crate::dto::token_dto::TokenReadDto;
|
||||
use crate::dto::user_dto::UserLoginDto;
|
||||
use crate::error::api_error::ApiError;
|
||||
use crate::error::request_error::ValidatedRequest;
|
||||
use crate::error::user_error::UserError;
|
||||
use crate::dto::{token_dto::TokenReadDto, user_dto::UserLoginDto};
|
||||
use crate::error::{api_error::ApiError,request_error::ValidatedRequest, user_error::UserError};
|
||||
use crate::repository::user_repository::UserRepositoryTrait;
|
||||
use crate::service::token_service::TokenServiceTrait;
|
||||
use crate::state::auth_state::AuthState;
|
||||
use axum::extract::State;
|
||||
use axum::Json;
|
||||
use axum::{extract::State, Json};
|
||||
|
||||
pub async fn auth(
|
||||
State(state): State<AuthState>,
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
use crate::dto::user_dto::{UserReadDto, UserRegisterDto};
|
||||
use crate::error::api_error::ApiError;
|
||||
use crate::error::request_error::ValidatedRequest;
|
||||
use crate::error::{api_error::ApiError, request_error::ValidatedRequest};
|
||||
use crate::state::user_state::UserState;
|
||||
use axum::extract::State;
|
||||
use axum::Json;
|
||||
use axum::{extract::State, Json};
|
||||
|
||||
pub async fn register(
|
||||
State(state): State<UserState>,
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
use crate::error::api_error::ApiError;
|
||||
use crate::error::token_error::TokenError;
|
||||
use crate::error::user_error::UserError;
|
||||
use crate::error::{api_error::ApiError, token_error::TokenError, user_error::UserError};
|
||||
use crate::repository::user_repository::UserRepositoryTrait;
|
||||
use crate::service::token_service::TokenServiceTrait;
|
||||
use crate::state::token_state::TokenState;
|
||||
|
|
Loading…
Reference in a new issue