Skip to content

Commit

Permalink
Merge tag 'v1.0.2' into develop
Browse files Browse the repository at this point in the history
k8s Readinessprobe 에 사용될 헬스 체크 API 추가
  • Loading branch information
minkyu97 committed Jul 6, 2024
2 parents ac21bba + a22ee43 commit 91c3fa7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
28 changes: 27 additions & 1 deletion waffledotcom/src/apps/user/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,39 @@ def from_orm(position: Position) -> PositionDto:
)


class SimpleUserResponse(BaseModel):
id: int
username: str | None
first_name: str
last_name: str
image_url: str | None = None
positions: list[PositionDto]
github_id: str | None
slack_id: str | None
introduction: str | None

@staticmethod
def from_orm(user: User) -> SimpleUserResponse:
return SimpleUserResponse(
id=user.id,
username=user.username,
first_name=user.first_name,
last_name=user.last_name,
image_url=user.image_url,
positions=[PositionDto.from_orm(pos) for pos in user.positions],
github_id=user.github_id,
slack_id=user.slack_id,
introduction=user.introduction,
)


class UserDetailResponse(BaseModel):
id: int
sso_id: str | None
username: str | None
first_name: str
image_url: str | None = None
last_name: str
image_url: str | None = None
positions: list[PositionDto]
department: str | None
college: str | None
Expand Down
10 changes: 5 additions & 5 deletions waffledotcom/src/apps/user/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from waffledotcom.src.apps.user.models import User
from waffledotcom.src.apps.user.repositories import UserRepository
from waffledotcom.src.apps.user.schemas import (
SimpleUserResponse,
UserCreateResponse,
UserCreateUpdateRequest,
UserDetailResponse,
)
from waffledotcom.src.batch.slack.schema import SlackMember

Expand Down Expand Up @@ -95,7 +95,7 @@ def create_or_update_user_from_slack(self, slack_member: SlackMember) -> None:

def update_user(
self, user_id: int, request: UserCreateUpdateRequest
) -> UserDetailResponse:
) -> SimpleUserResponse:
user = self.user_repository.get_user_by_id(user_id)
if user is None:
raise UserNotFoundException
Expand All @@ -104,8 +104,8 @@ def update_user(
if user is None:
raise UserNotFoundException

return UserDetailResponse.from_orm(user)
return SimpleUserResponse.from_orm(user)

def list_users(self) -> list[UserDetailResponse]:
def list_users(self) -> list[SimpleUserResponse]:
users = self.user_repository.get_users()
return [UserDetailResponse.from_orm(user) for user in users]
return [SimpleUserResponse.from_orm(user) for user in users]

0 comments on commit 91c3fa7

Please sign in to comment.