diff --git a/src/main/java/com/movelog/MoveLogApplication.java b/src/main/java/com/movelog/MoveLogApplication.java index 0de2db1..2fb815b 100644 --- a/src/main/java/com/movelog/MoveLogApplication.java +++ b/src/main/java/com/movelog/MoveLogApplication.java @@ -8,8 +8,8 @@ @SpringBootApplication @EnableJpaAuditing -//@PropertySource(value = { "classpath:oauth2/application-oauth2.yml" }, factory = YamlPropertySourceFactory.class) -//@PropertySource(value = { "classpath:database/application-database.yml" }, factory = YamlPropertySourceFactory.class) +@PropertySource(value = { "classpath:oauth2/application-oauth2.yml" }, factory = YamlPropertySourceFactory.class) +@PropertySource(value = { "classpath:database/application-database.yml" }, factory = YamlPropertySourceFactory.class) //@PropertySource(value = { "classpath:s3/application-s3.yml" }, factory = YamlPropertySourceFactory.class) public class MoveLogApplication { diff --git a/src/main/resources/static/openapi.json b/src/main/resources/static/openapi.json index 1d11519..08cb673 100644 --- a/src/main/resources/static/openapi.json +++ b/src/main/resources/static/openapi.json @@ -13,11 +13,31 @@ ], "tags": [ { - "name" : "Auth", + "name": "Auth", "description": "로그인, 회원가입, 로그아웃과 관련된 API" + }, + { + "name": "Write", + "description": "기록 생성과 관련된 API" + }, + { + "name": "personalstat", + "description": "사용자 통계와 관련된 API" + }, + { + "name": "allstat", + "description": "전체 사용자 통계와 관련된 API" + }, + { + "name" : "News", + "description": "사용자가 기록을 통해 생성하는 뉴스 컨텐츠와 관련된 API" + }, + { + "name" : "Word Stat", + "description": "개인 사용자 및 전체 사용자의 단어 통계와 관련된 API" } - ], + ], "paths": { "/auth": { "post": { @@ -56,24 +76,1135 @@ } } } - } - }, - "components": { - "schemas": { - "SignInReq": { - "type": "object", - "properties": { - "email": { - "type": "string", - "description": "이메일" - }, - "providerId": { + }, + "/write": { + "post": { + "tags": ["Write"], + "summary": "기록 생성", + "description": "기록 생성을 수행합니다.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateWriteReq" + } + } + } + }, + "responses": { + "200": { + "description": "기록 생성 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Message" + } + } + } + }, + "400": { + "description": "기록 생성 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/personalstat": { + "get": { + "tags": ["personalstat"], + "summary": "사용자 개인 기록 통계 조회", + "description": "사용자의 개인 기록에 대한 통계 정보를 조회합니다.", + "responses": { + "200": { + "description": "개인 통계 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveMyRecordRes" + } + } + } + }, + "400": { + "description": "개인 통계 조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/personalstat/calendar/{date}": { + "get": { + "tags": ["personalstat"], + "summary": "사용자 개인 기록 캘린더 조회", + "description": "사용자의 운동 기록에 대한 통계 정보를 조회합니다.", + "parameters": [ + { + "name": "date", + "in": "path", + "required": true, + "description": "조회할 날짜 (YYYY-MM 형식)", + "schema": { "type": "string", - "description": "구글 로그인 시 제공되는 providerId" + "format": "date", + "example": "2024-11" + } + } + ], + "responses": { + "200": { + "description": "통계 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveMyCalendarRes" + } + } + } + }, + "400": { + "description": "조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/allstat/totalTop5/{verb}": { + "get": { + "tags": ["allstat"], + "summary": "누적 top5 단어별 기록 생성 건수 조회", + "description": "전체 기간 동안의 상위 5개 단어와 각각의 기록 건수를 조회합니다.", + "parameters": [ + { + "name": "verb", + "in": "path", + "required": true, + "description": "했어요 0, 갔어요 1, 먹었어요 2", + "schema": { + "type": "integer", + "format": "integer", + "example": "1" + } + } + ], + "responses": { + "200": { + "description": "조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveTotalTop5ListRes" + } + } + } + } + } + } + }, + "/allstat/dailyTop5": { + "get": { + "tags": ["allstat"], + "summary": "일간 top5 단어별 기록 생성 건수 조회", + "description": "오늘 하루 동안의 상위 5개 단어와 각각의 기록 건수를 조회합니다.", + "parameters": [ + { + "name": "verb", + "in": "path", + "required": true, + "description": "했어요 0, 갔어요 1, 먹었어요 2", + "schema": { + "type": "integer", + "format": "integer", + "example": "1" + } + } + ], + "responses": { + "200": { + "description": "조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveDailyTop5ListRes" + } + } + } + } + } + } + }, + "/allstat/weeklyTop5": { + "get": { + "tags": ["allstat"], + "summary": "주간 top5 단어별 기록 생성 건수 조회", + "description": "이번 주의 상위 5개 단어와 각각의 기록 건수를 조회합니다.", + "parameters": [ + { + "name": "verb", + "in": "path", + "required": true, + "description": "했어요 0, 갔어요 1, 먹었어요 2", + "schema": { + "type": "integer", + "format": "integer", + "example": "1" + } + } + ], + "responses": { + "200": { + "description": "조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveWeeklyTop5ListRes" + } + } + } + } + } + } + }, + "/allstat/monthlyTop5": { + "get": { + "tags": ["allstat"], + "summary": "월간 top5 단어별 기록 생성 건수 조회", + "description": "이번 달의 상위 5개 단어와 각각의 기록 건수를 조회합니다.", + "parameters": [ + { + "name": "verb", + "in": "path", + "required": true, + "description": "했어요 0, 갔어요 1, 먹었어요 2", + "schema": { + "type": "integer", + "format": "integer", + "example": "1" + } + } + ], + "responses": { + "200": { + "description": "조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveMonthlyTop5ListRes" + } + } + } + } + } + } + }, + "/allstat/record": { + "get": { + "tags": ["allstat"], + "summary": "전체 기록 통계 조회", + "description": "전체 기록 통계 조회를 합니다.", + "responses": { + "200": { + "description": "조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveAllRecordRes" + } + } + } + } + } + } + }, + "/allstat/calendar": { + "get": { + "tags": ["allstat"], + "summary": "전체 사용자 기록 캘린더 조회", + "description": "사용자의 운동 기록에 대한 통계 정보를 조회합니다.", + "responses": { + "200": { + "description": "통계 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RetrieveAllCalendarRes" + } + } + } + }, + "400": { + "description": "조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/news/{imageId}": { + "post": { + "tags": [ + "News" + ], + "summary": "뉴스 생성 및 저장 API (기존 이미지 기록 기반)", + "description": "사용자의 기존 기록 이미지로 뉴스를 생성합니다.", + "parameters": [ + { + "name": "imageId", + "in": "path", + "description": "이미지 아이디", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateNewsReq" + } } + } + }, + "responses": { + "200": { + "description": "뉴스 생성 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Message" + } + } + } + }, + "400": { + "description": "뉴스 생성 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/news/new": { + "post": { + "tags": [ + "News" + ], + "summary": "뉴스 생성 및 저장 API (새로운 사진 등록)", + "description": "사용자가 새로 등록한 이미지를 바탕으로 동사-명사, 헤드라인 고정/생성 내용으로 뉴스를 생성합니다.", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "image": { + "type": "string", + "format": "binary" + }, + "NewsHeadLineReq": { + "$ref": "#/components/schemas/CreateNewsReq" + } + }, + "required": [ + "image", + "NewsHeadLineReq" + ] + } + } + } + }, + "responses": { + "200": { + "description": "뉴스 생성 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Message" + } + } + } + }, + "400": { + "description": "뉴스 생성 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/news/recommend": { + "post": { + "tags": [ + "News" + ], + "summary": "뉴스 생성을 위한 추천 기록 조회 API", + "description": "사용자가 뉴스 헤드라인 생성 시 참고할 수 있는 기록을 추천합니다.", + "responses": { + "200": { + "description": "추천 기록 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RecommendRecordRes" + } + } + } + }, + "400": { + "description": "추천 기록 조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/news/search": { + "post": { + "tags": [ + "News" + ], + "summary": "뉴스 콘텐츠 검색", + "description": "뉴스 생성에 사용될 동사-명사를 검색합니다.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchVerbNounReq" + } + } + } + }, + "responses": { + "200": { + "description": "뉴스 콘텐츠 검색 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchVerbNounRes" + } + } + } + }, + "400": { + "description": "뉴스 콘텐츠 검색 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/news/list": { + "get": { + "tags": [ + "News" + ], + "summary": "생성된 뉴스 리스트 조회 APi", + "description": "사용자가 생성한 뉴스 목록을 조회합니다.", + "responses": { + "200": { + "description": "뉴스 목록 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewsListRes" + } + } + } + }, + "400": { + "description": "뉴스 목록 조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/news/images": { + "get": { + "tags": [ + "News" + ], + "summary": "뉴스 생성을 위한 기록 이미지 조회 API", + "description": "뉴스 생성에 사용될 기록 이미지를 조회합니다.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewsImageReq" + } + } + } + }, + "responses": { + "200": { + "description": "기록 이미지 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewsImageRes" + } + } + } + }, + "400": { + "description": "기록 이미지 조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/news/headline": { + "post": { + "tags": [ + "News" + ], + "summary": "뉴스 헤드라인 추천 API", + "description": "ChatGPT를 사용하여 뉴스 헤드라인을 추천합니다.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NewsHeadLineReq" + } + } + } + }, + "responses": { + "200": { + "description": "뉴스 헤드라인 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Message" + } + } + } + }, + "400": { + "description": "뉴스 헤드라인 조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/stat/word/recommend": { + "post": { + "tags": [ + "Word Stat" + ], + "summary": "단어 추천 목록 조회 API", + "description": "전체 사용자의 단어 기록을 통해 15개의 추천 단어 목록을 조회합니다.", + "responses": { + "200": { + "description": "단어 추천 목록 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WordRecommendRes" + } + } + } + }, + "400": { + "description": "단어 추천 목록 조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/stat/word/search": { + "post": { + "tags": [ + "Word Stat" + ], + "summary": "단어 통계 내 단어 검색 API", + "description": "전체 단어 통계 내에서 사용자가 입력한 단어를 검색합니다.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchWordReq" + } + } + } + }, + "responses": { + "200": { + "description": "단어 검색 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SearchWordRes" + } + } + } + }, + "400": { + "description": "단어 검색 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/stat/word/my": { + "get": { + "tags": [ + "Word Stat" + ], + "summary": "개인 단어 통계 조회 API", + "description": "특정 단어에 대한 사용자의 단어 통계를 조회합니다.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WordStatReq" + } + } + } + }, + "responses": { + "200": { + "description": "사용자 단어 통계 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MyWordStatRes" + } + } + } + }, + "400": { + "description": "사용자 통계 조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/stat/word": { + "get": { + "tags": ["Word Stat"], + "summary": "전체 단어 통계 조회 API", + "description": "전체 사용자의 단어 통계를 조회합니다.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorldWordStatReq" + } + } + } + }, + "responses": { + "200": { + "description": "전체 단어 통계 조회 성공", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorldWordStatRes" + } + } + } + }, + "400": { + "description": "전체 단어 통계 조회 실패", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "SignInReq": { + "type": "object", + "properties": { + "email": { + "type": "string", + "description": "이메일" + }, + "providerId": { + "type": "string", + "description": "구글 로그인 시 제공되는 providerId" + } + }, + "required": ["token"] + }, + "CreateWriteReq": { + "type": "object", + "properties": { + "verbType": { + "type": "integer", + "description": "했어요 0, 먹었어요 1, 갔어요 2", + "example": 0 + }, + "noun": { + "type": "string", + "description": "명사", + "example": "헬스" + }, + "record_image": { + "type": "string", + "description": "기록 이미지", + "example": "#$!~@#!@#!@213123" + } + } + }, + "RetrieveMyRecordRes": { + "properties": { + "recordNum": { + "type": "integer", + "description": "기록 생성 건수", + "example": 2 + }, + "bestRecord": { + "type": "string", + "description": "최고 연속 기록", + "example": 30 + }, + "averageRecord": { + "type": "number", + "description": "평균 일간 기록", + "example": 3.3 + }, + "dailyRecord": { + "type": "integer", + "description": "일일 최다 기록", + "example": 2 + } + } + }, + "RetrieveMyCalendarRes": { + "properties": { + "myRecordDate": { + "type": "string", + "description": "기록 생성 날짜", + "example": "2024-11-23" + }, + "numRecord": { + "type": "integer", + "description": "일자별 기록 개수", + "example": 5 + } + } + }, + "RetrieveAllRecordRes": { + "properties": { + "recordNum": { + "type": "integer", + "description": "총 기록 생성 건수", + "example": 2 + }, + "bestRecord": { + "type": "string", + "description": "최고 연속 기록", + "example": 30 + }, + "averageRecord": { + "type": "number", + "description": "평균 일간 기록", + "example": 3.3 + }, + "dailyRecord": { + "type": "integer", + "description": "일일 최다 기록", + "example": 2 + } + } + }, + "RetrieveTotalTop5ListRes": { + "properties": { + "word": { + "type": "string", + "description": "단어", + "example": "공부" + }, + "recordNum": { + "type": "integer", + "description": "기록 생성 건수", + "example": 15 + } + } + }, + "RetrieveDailyTop5ListRes": { + "properties": { + "word": { + "type": "string", + "description": "단어", + "example": "공부" + }, + "recordNum": { + "type": "integer", + "description": "기록 생성 건수", + "example": 15 + } + } + }, + "RetrieveWeeklyTop5ListRes": { + "properties": { + "word": { + "type": "string", + "description": "단어", + "example": "공부" + }, + "recordNum": { + "type": "integer", + "description": "기록 생성 건수", + "example": 15 + } + } + }, + "RetrieveMonthlyTop5ListRes": { + "properties": { + "word": { + "type": "string", + "description": "단어", + "example": "공부" + }, + "recordNum": { + "type": "integer", + "description": "기록 생성 건수", + "example": 15 + } + } + }, + "RetrieveAllCalendarRes": { + "properties": { + "myRecordDate": { + "type": "string", + "description": "기록 생성 날짜", + "example": "2024-11-23" + }, + "numRecord": { + "type": "integer", + "description": "일자별 기록 개수", + "example": 5 + } + } + }, + "CreateNewsReq": { + "type": "object", + "properties": { + "RecordOption": { + "type": "string", + "description": "뉴스 헤드라인 고정 옵션" + }, + "headline": { + "type": "string", + "description": "사용자가 정한 뉴스 헤드라인" + }, + "verb": { + "type": "string", + "description": "사용자가 선택한 동사" + }, + "noun": { + "type": "string", + "description": "사용자가 선택한 명사" + } + }, + "required": ["RecordOption", "verb", "noun"] + }, + "RecommendRecordRes": { + "type": "object", + "properties": { + "RecommendRecords": { + "type": "array", + "description": "뉴스 생성을 위한 추천 기록 리스트", + "properties": { + "recordId": { + "type": "integer", + "description": "기록 아이디" + }, + "verb": { + "type": "string", + "description": "기록 동사" + }, + "noun": { + "type": "string", + "description": "기록 명사" + } + } + } + } + }, + "SearchVerbNounReq": { + "type": "object", + "properties": { + "searchWord": { + "type": "string", + "description": "검색어" + } + } + }, + "SearchVerbNounRes": { + "type": "object", + "properties": { + "VerbNounList": { + "type": "array", + "description": "검색 결과 동사-명사 리스트", + "properties": { + "recordId": { + "type": "integer", + "description": "기록 아이디" + }, + "verb": { + "type": "string", + "description": "검색 결과 동사" + }, + "noun": { + "type": "string", + "description": "검색 결과 명사" + } + } + } + } + }, + "NewsListRes": { + "type": "object", + "properties": { + "NewsList": { + "type": "array", + "description": "생성된 뉴스 리스트", + "properties": { + "newsId": { + "type": "integer", + "description": "뉴스 아이디" + }, + "newsImage": { + "type": "string", + "description": "뉴스 이미지" + } + } + } + } + }, + "NewsImageReq": { + "type": "object", + "properties": { + "verb": { + "type": "string", + "description": "동사" + }, + "noun": { + "type": "string", + "description": "명사" + } + } + }, + "NewsImageRes": { + "type": "object", + "properties": { + "NewsImageList": { + "type": "array", + "description": "뉴스 생성을 위한 기록 이미지 리스트", + "properties": { + "recordId": { + "type": "integer", + "description": "이미지 아이디" + }, + "recordImage": { + "type": "string", + "description": "기록 이미지 url" + } + } + } + } + }, + "NewsHeadLineReq": { + "type": "object", + "properties": { + "Option": { + "type": "string", + "description": "뉴스 헤드라인 고정 옵션" + }, + "verb": { + "type": "string", + "description": "동사" + }, + "noun": { + "type": "string", + "description": "명사" + } + } + }, + "WordRecommendRes": { + "type": "object", + "properties": { + "WordRecommendList": { + "type": "array", + "description": "단어 추천 리스트", + "properties": { + "word": { + "type": "string", + "description": "추천 단어" + } + } + } + } + }, + "SearchWordReq": { + "type": "object", + "properties": { + "searchWord": { + "type": "string", + "description": "검색어" + } + } + }, + "SearchWordRes": { + "type": "object", + "properties": { + "WordList": { + "type": "array", + "description": "검색 결과 단어 리스트", + "properties": { + "word": { + "type": "string", + "description": "검색 결과 단어" + } + } + } + } + }, + "WordStatReq": { + "type": "object", + "properties": { + "word": { + "type": "string", + "description": "단어" + } + } + }, + "MyWordStatRes": { + "type": "object", + "properties": { + "wordCount": { + "type": "integer", + "description": "단어 등장 횟수" + }, + "lastRecord": { + "type": "string", + "example": "2021-09-01 00:00:00", + "description": "마지막 기록 일시" + } + } + }, + "WorldWordStatReq": + { + "type": "object", + "properties": { + "word": { + "type": "string", + "description": "단어" + } + } + }, + "WorldWordStatRes": { + "type": "object", + "properties": { + "recordCount": { + "type": "integer", + "description": "단어 기록 횟수" + }, + "lastRecord": { + "type": "string", + "example": "2021-09-01 00:00:00", + "description": "마지막 기록 일시" + }, + "DayRecordAvg": { + "type": "integer", + "description": "일 평균 기록 횟수" + }, + "WeekRecordAvg": { + "type": "integer", + "description": "주 평균 기록 횟수" + } + } }, - "required": ["token"] - }, "Message": { "type": "object", "properties": {