Skip to content

Commit

Permalink
Merge pull request #336 from GiganticMinecraft/feat/myUserInfo
Browse files Browse the repository at this point in the history
自身のユーザー情報を取得するエンドポイントの実装
rito528 authored Nov 8, 2023
2 parents e04c7d6 + e4f15cb commit ca34d43
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/entrypoint/src/main.rs
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ use presentation::{
update_form_handler,
},
health_check_handler::health_check,
user_handler::get_my_user_info,
};
use resource::{database::connection::ConnectionPool, repository::Repository};
use sentry::integrations::tower::{NewSentryLayer, SentryHttpLayer};
@@ -79,6 +80,7 @@ async fn main() -> anyhow::Result<()> {
.with_state(shared_repository.to_owned())
.route("/forms/questions", post(create_question_handler))
.with_state(shared_repository.to_owned())
.route("/users", get(get_my_user_info))
.route("/health", get(health_check))
.layer(layer)
.route_layer(middleware::from_fn_with_state(
1 change: 1 addition & 0 deletions server/presentation/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod auth;
pub mod form_handler;
pub mod health_check_handler;
pub mod user_handler;
7 changes: 7 additions & 0 deletions server/presentation/src/user_handler.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use axum::{http::StatusCode, response::IntoResponse, Extension, Json};
use domain::user::models::User;
use serde_json::json;

pub async fn get_my_user_info(Extension(user): Extension<User>) -> impl IntoResponse {
(StatusCode::OK, Json(json!(user))).into_response()
}

0 comments on commit ca34d43

Please sign in to comment.