重命名controller和service

This commit is contained in:
李运家 2024-09-23 15:53:04 +08:00
parent acda323a42
commit c358552582
9 changed files with 16 additions and 16 deletions

View File

@ -10,7 +10,7 @@ pub async fn authenticate_google(
Json(req): Json<AuthenticateGooleAccountReq> Json(req): Json<AuthenticateGooleAccountReq>
) -> ResResult<ResData<LoginAccount>> { ) -> ResResult<ResData<LoginAccount>> {
validator::validate_params(&req, context.get_lang_tag())?; validator::validate_params(&req, context.get_lang_tag())?;
service::account::authenticate_google(context, req).await service::account_service::authenticate_google(context, req).await
} }
/// 账号密码登录 /// 账号密码登录
@ -19,7 +19,7 @@ pub async fn authenticate_with_password(
Json(req): Json<AuthenticateWithPassword> Json(req): Json<AuthenticateWithPassword>
) -> ResResult<ResData<LoginAccount>> { ) -> ResResult<ResData<LoginAccount>> {
validator::validate_params(&req, context.get_lang_tag())?; validator::validate_params(&req, context.get_lang_tag())?;
service::sys_account::authenticate_with_password(context, req).await service::sys_account_service::authenticate_with_password(context, req).await
} }
/// 刷新token /// 刷新token
@ -29,10 +29,10 @@ pub async fn refresh_token(
) -> ResResult<ResData<RefreshTokenResult>> { ) -> ResResult<ResData<RefreshTokenResult>> {
tracing::debug!("刷新token, {:?}", context); tracing::debug!("刷新token, {:?}", context);
validator::validate_params(&refresh_token, "")?; validator::validate_params(&refresh_token, "")?;
service::account::refresh_token(context, refresh_token.token).await service::account_service::refresh_token(context, refresh_token.token).await
} }
/// 添加管理员账号 /// 添加管理员账号
pub async fn add_account() -> ResResult<ResData<()>> { pub async fn add_account() -> ResResult<ResData<()>> {
service::sys_account::add_account().await service::sys_account_service::add_account().await
} }

View File

@ -16,7 +16,7 @@ pub async fn add_feedback(
Json(req): Json<FeedbackAdd> Json(req): Json<FeedbackAdd>
) -> ResResult<ResData<()>> { ) -> ResResult<ResData<()>> {
validator::validate_params(&req, context.get_lang_tag())?; validator::validate_params(&req, context.get_lang_tag())?;
service::feedback::add_feedback(context, req).await service::feedback_service::add_feedback(context, req).await
} }
/// 获取反馈信息列表 /// 获取反馈信息列表
@ -24,5 +24,5 @@ pub async fn get_feedback_list_by_page(
Extension(context): Extension<Context>, Extension(context): Extension<Context>,
Query(page_params): Query<PageParams> Query(page_params): Query<PageParams>
) -> ResResult<ResData<Pageable<Feedback>>> { ) -> ResResult<ResData<Pageable<Feedback>>> {
service::feedback::get_feedback_list_by_page(context, page_params.page.unwrap(), page_params.page_size.unwrap()).await service::feedback_service::get_feedback_list_by_page(context, page_params.page.unwrap(), page_params.page_size.unwrap()).await
} }

View File

@ -1,2 +1,2 @@
pub mod account; pub mod account_controller;
pub mod feedback; pub mod feedback_controller;

View File

@ -11,20 +11,20 @@ pub(crate) fn init() -> Router {
let auth: Router = Router::new() let auth: Router = Router::new()
.route( .route(
"/account/google", "/account/google",
post(controller::account::authenticate_google), post(controller::account_controller::authenticate_google),
) )
.route( .route(
"/account/sys", "/account/sys",
post(controller::account::authenticate_with_password), post(controller::account_controller::authenticate_with_password),
) )
.route( .route(
"/account/refresh-token", "/account/refresh-token",
post(controller::account::refresh_token) post(controller::account_controller::refresh_token)
) )
.route( .route(
"/feedback", "/feedback",
post(controller::feedback::add_feedback) post(controller::feedback_controller::add_feedback)
.get(controller::feedback::get_feedback_list_by_page), .get(controller::feedback_controller::get_feedback_list_by_page),
) )
.layer(axum::middleware::from_fn( .layer(axum::middleware::from_fn(
library::middleware::req_ctx::authenticate_ctx, library::middleware::req_ctx::authenticate_ctx,

View File

@ -1,3 +1,3 @@
pub mod account; pub mod account_service;
pub mod feedback; pub mod feedback_service;
pub mod sys_account; pub mod sys_account_service;