group use statement, fix user sql

This commit is contained in:
Thani Sheun 2023-05-04 17:03:49 +02:00
parent 6715970628
commit 0c342b3484
6 changed files with 10 additions and 23 deletions

View file

@ -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`),

View file

@ -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;

View file

@ -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;

View file

@ -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>,

View file

@ -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>,

View file

@ -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;