Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase UID 필드를 사용자 조회 응답에서 제거합니다. #27

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cmd/server/handler/user_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (h *UserHandler) FindUserStatusByEmail(w http.ResponseWriter, r *http.Reque
// @Tags users
// @Produce json
// @Security FirebaseAuth
// @Success 200 {object} user.FindUserResponse
// @Success 200 {object} user.MyProfileResponse
// @Router /users/me [get]
func (h *UserHandler) FindMyProfile(w http.ResponseWriter, r *http.Request) {
res, err := h.authService.VerifyAuthAndGetUser(r.Context(), r.Header.Get("Authorization"))
Expand All @@ -120,7 +120,7 @@ func (h *UserHandler) FindMyProfile(w http.ResponseWriter, r *http.Request) {
return
}

commonviews.OK(w, nil, res)
commonviews.OK(w, nil, res.ToMyProfileResponse())
}

// UpdateMyProfile godoc
Expand Down Expand Up @@ -160,7 +160,6 @@ func (h *UserHandler) UpdateMyProfile(w http.ResponseWriter, r *http.Request) {
Fullname: userModel.Fullname,
ProfileImageURL: userModel.ProfileImageURL,
FirebaseProviderType: userModel.FirebaseProviderType,
FirebaseUID: userModel.FirebaseUID,
})
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

// @title 이웃집멍냥 API 문서
// @version 0.5.0
// @version 0.6.0
// @description 이웃집멍냥 백엔드 API 문서입니다.
// @termsOfService http://swagger.io/terms/

Expand Down
21 changes: 20 additions & 1 deletion internal/domain/user/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ type FindUserResponse struct {
FirebaseUID string `json:"fbUid"`
}

func (r *FindUserResponse) ToMyProfileResponse() *MyProfileResponse {
return &MyProfileResponse{
ID: r.ID,
Email: r.Email,
Nickname: r.Nickname,
Fullname: r.Fullname,
ProfileImageURL: r.ProfileImageURL,
FirebaseProviderType: r.FirebaseProviderType,
}
}

type MyProfileResponse struct {
ID int `json:"id"`
Email string `json:"email"`
Nickname string `json:"nickname"`
Fullname string `json:"fullname"`
ProfileImageURL string `json:"profileImageUrl"`
FirebaseProviderType FirebaseProviderType `json:"fbProviderType"`
}

type CheckNicknameRequest struct {
Nickname string `json:"nickname" validate:"required"`
}
Expand Down Expand Up @@ -65,5 +85,4 @@ type UpdateUserResponse struct {
Fullname string `json:"fullname"`
ProfileImageURL string `json:"profileImageUrl"`
FirebaseProviderType FirebaseProviderType `json:"fbProviderType"`
FirebaseUID string `json:"fbUid"`
}
45 changes: 20 additions & 25 deletions pkg/docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

42 changes: 18 additions & 24 deletions pkg/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "0.5.0"
"version": "0.6.0"
},
"basePath": "/api",
"paths": {
Expand Down Expand Up @@ -401,7 +401,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/user.FindUserResponse"
"$ref": "#/definitions/user.MyProfileResponse"
}
}
}
Expand Down Expand Up @@ -1125,7 +1125,22 @@
}
}
},
"user.FindUserResponse": {
"user.FirebaseProviderType": {
"type": "string",
"enum": [
"email",
"google",
"apple",
"kakao"
],
"x-enum-varnames": [
"FirebaseProviderTypeEmail",
"FirebaseProviderTypeGoogle",
"FirebaseProviderTypeApple",
"FirebaseProviderTypeKakao"
]
},
"user.MyProfileResponse": {
"type": "object",
"properties": {
"email": {
Expand All @@ -1134,9 +1149,6 @@
"fbProviderType": {
"$ref": "#/definitions/user.FirebaseProviderType"
},
"fbUid": {
"type": "string"
},
"fullname": {
"type": "string"
},
Expand All @@ -1151,21 +1163,6 @@
}
}
},
"user.FirebaseProviderType": {
"type": "string",
"enum": [
"email",
"google",
"apple",
"kakao"
],
"x-enum-varnames": [
"FirebaseProviderTypeEmail",
"FirebaseProviderTypeGoogle",
"FirebaseProviderTypeApple",
"FirebaseProviderTypeKakao"
]
},
"user.RegisterUserRequest": {
"type": "object",
"required": [
Expand Down Expand Up @@ -1243,9 +1240,6 @@
"fbProviderType": {
"$ref": "#/definitions/user.FirebaseProviderType"
},
"fbUid": {
"type": "string"
},
"fullname": {
"type": "string"
},
Expand Down
34 changes: 15 additions & 19 deletions pkg/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -387,14 +387,24 @@ definitions:
isAvailable:
type: boolean
type: object
user.FindUserResponse:
user.FirebaseProviderType:
enum:
- email
- google
- apple
- kakao
type: string
x-enum-varnames:
- FirebaseProviderTypeEmail
- FirebaseProviderTypeGoogle
- FirebaseProviderTypeApple
- FirebaseProviderTypeKakao
user.MyProfileResponse:
properties:
email:
type: string
fbProviderType:
$ref: '#/definitions/user.FirebaseProviderType'
fbUid:
type: string
fullname:
type: string
id:
Expand All @@ -404,18 +414,6 @@ definitions:
profileImageUrl:
type: string
type: object
user.FirebaseProviderType:
enum:
- email
- google
- apple
- kakao
type: string
x-enum-varnames:
- FirebaseProviderTypeEmail
- FirebaseProviderTypeGoogle
- FirebaseProviderTypeApple
- FirebaseProviderTypeKakao
user.RegisterUserRequest:
properties:
email:
Expand Down Expand Up @@ -468,8 +466,6 @@ definitions:
type: string
fbProviderType:
$ref: '#/definitions/user.FirebaseProviderType'
fbUid:
type: string
fullname:
type: string
id:
Expand Down Expand Up @@ -511,7 +507,7 @@ info:
url: http://www.apache.org/licenses/LICENSE-2.0.html
termsOfService: http://swagger.io/terms/
title: 이웃집멍냥 API 문서
version: 0.5.0
version: 0.6.0
paths:
/auth/callback/kakao:
get:
Expand Down Expand Up @@ -754,7 +750,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/user.FindUserResponse'
$ref: '#/definitions/user.MyProfileResponse'
security:
- FirebaseAuth: []
summary: 내 프로필 정보를 조회합니다.
Expand Down