Skip to content

[GET] 유저 마이페이지 #12

@epitone

Description

@epitone
  • API 명세서 작성하기
  • 로직 구현

URL

GET /user/profile

Request

//HEADER
{
	x-access-token: "dafsafsadfdsafdsadsf"
}

Response

단 history는 최근 7일치만 주고,

day 기준으로 정렬되어 있다.

총 시간의 단위는 sec(초) 단위로 보낼 예정이다.

{
	status: 200,
	data: {
		user: {
			name: "헬린이",
			level: 1,
		},
		totalExerciseTime: 3600,
		history: [
			{
				runtime: 121,
				day: '2020-11-21'
			},
			{
				runtime: 240,
				day: '2020-11-22'
			},
			...
		]
	},
	msg: "정상적으로 가져오기 성공!"
}
			

Flow

유저 이름

  • USER_TB에서 이름 가져옴

총 운동 시간

  • Front에서 user_id(jwt access token의 payload에서 확인 가능하긴 함)를 받음
  • WATCHING_HISTORY_TB에서 user_id로 조건을 걸어서,
    findAll 한다.
  • 해당 객체들의 video_id를 가지고 runtime을 VIDEO_TB에서 가져온다.
  • runtime들을 합쳐서 프론트에 보내준다.

주간 운동 시간

  • WATCHING_HISTORY_TB에서 user_id로 다 가져옴
  • 오늘 날짜로부터 7일 전 내용만 filter하거나,
  • 배열 형태로 보내줌(video의 runtime하고, 데이터가 언제 쌓였는지)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions