7th-final-9th-team-api's People
7th-final-9th-team-api's Issues
방 만들기 기능 추가
unused property 로 나오는 현상 해결
사용자 정보 수정 기능 추가
- 사용자 이름 추가
PUT /members/me
,PUT /members/{member-id}
API 추가
request
PUT /api/members/{member-id}
{
"name": "toBeChangedName"
}
response
{
"data": {
"member": {
..
}
}
}
위도, 경도 -> 기상청 좌표 변환
- https://gist.github.com/fronteer-kr/14d7f779d52a21ac2f16
- 위 예제를 좀더 예쁘게 다듬은 converter 를 추가합니다
POST /api/furnitures/{furnitureId}/tasks
할 일 등록
가구 생성 기능을 추가합니다
할 일 목록에 완료한 할 일도 추가
spring security 추가
- 로그인 요청에 대한 응답으로 토큰을 발급합니다
- 인증이 필요한 요청에 대해서 토큰이 없거나, 유효하지 않으면 401 로 응답합니다
health check 추가
- actuator 의존성 추가
- /actuator/health
- 1분마다 호출하고 응답 없으면 slack 으로 웹훅 보내기
회원가입 후 필수 정보 입력 (유저가 직접 입력해야되는 종류의 값들이 있다면.. )
- 필수 정보 없이도, oauth user info 만 가지고 일단 member 를 생성합니다.
- 회원가입에 필요한 필수 정보가 있으면, 입력받아서 member 의 상태를 업데이트 합니다
- 필수정보 입력받았는지 여부 flag 필요합니다 (회원생성 후, 필수정보 입력 전에 나가는경우 다시 돌아오면 필수 정보 입력 페이지로 보내주기 위함)
mysql 연동
login 시 member 정보도 같이 응답하기 (from FE)
AS-IS
{
"data": {
"accessToken": ""
}
}
TO-BE
{
"data": {
"accessToken: "",
"member": {
"id": "",
...
}
}
}
profile image upload api 추가
POST /members/me/profile-image
Content-Type: multipart/form-data
file : {}
tomcat access log 설정 추가
- path
- pattern
- 지난 로그 압축 (logrotate, cron, etc..)
호칭 모델 설계 (빨래수호신 ..님 등 )
actuator 관련 endpoint 를 swagger 문서에서 제외합니다
날씨에 따라 안내문 내려주기
api url 변경
- members 리소스를 접근하는 경우가 아니면,
members/me
를 생략합니다 - 만약에 전체 유저에 대한 rooms 등을 접근하게되면, 다른 방법으로 해결하기-
weather 수정
- 에러 고치기 전까지 날씨 random 으로 응답하기
- 문서에 강수형태 종류 추가
개발환경에서 api 요청할 수 있도록 cors 추가
deprecated api 삭제
- 삭제하기 전에 fe 에서 사용하지 않는지 확인하기
actuator/scheduledtasks 사용해보기
/actuator
curl -s http://localhost:8080/actuator | jq
{
"_links": {
"self": {
"href": "http://localhost:8080/actuator",
"templated": false
},
"health": {
"href": "http://localhost:8080/actuator/health",
"templated": false
},
"health-path": {
"href": "http://localhost:8080/actuator/health/{*path}",
"templated": true
},
"info": {
"href": "http://localhost:8080/actuator/info",
"templated": false
},
"env-toMatch": {
"href": "http://localhost:8080/actuator/env/{toMatch}",
"templated": true
},
"env": {
"href": "http://localhost:8080/actuator/env",
"templated": false
},
"scheduledtasks": {
"href": "http://localhost:8080/actuator/scheduledtasks",
"templated": false
}
}
}
/actuator/scheduledTasks
curl -s http://localhost:8080/actuator/scheduledtasks | jq
{
"cron": [
{
"runnable": {
"target": "com.depromeet.todo.presentation.tasks.TaskCleaner.execute"
},
"expression": "3 0 0 * * *"
}
],
"fixedDelay": [],
"fixedRate": [],
"custom": []
}
Community Profile 채우기
기상청 API 로부터 기대하지 않은 응답을 받는 경우 대응
{
"response": {
"header": {
"resultCode": "0000",
"resultMsg": "OK"
},
"body": {
"items": "",
"numOfRows": 10,
"pageNo": 1,
"totalCount": 0
}
}
}
-
날씨 API 요청시 위의 응답이 나오는 경우 해결하기.
(현재 시각의 자료가 준비되지 않았을 때 이렇게 응답하는 것으로 추측. 40분 이후에 조회하라고 문서에써있음)
(현재시각의 분 값이 40 미만인 경우, 한시간 전을 기준으로 조회하도록 수정하기.. ) -
41분쯤 정상 응답을 받으면 캐시해두고
다음 시간까지 API 를 직접 요청하지 않는 방법도 적용해보기
nginx 에서 /api 로 시작하는 요청들은 api 서버(tomcat) 으로 전달하기
- proxy_pass 설정 추가
- swagger 등 tomcat 에서 제공하는 정적파일 어떻게 다룰지
(ex, context-path, swagger 에서 path설정추가? )
application service naming
- ~~ApplicationService 로 변경합니다
task 생성 응답에 contents 필드가 포함되어야 합니다
AS-IS
curl -X POST "http://localhost:13000/api/furnitures/38051869525829361/task" \
-H "accept: */*" -H "Authorization: bearer jibsuniAccessToken" \
-H "Content-Type: application/json" \
-d "{ \"contents\": \"This is contents! \"}"
{
"data": {
"task": {
"id": "1",
"furnitureName": "bed",
"order": 1,
"state": "TODO",
"deadline": "2020-02-15T23:59:59.999999999",
"createdAt": "2020-02-15T21:05:42.388"
}
}
}
기상청 미세먼지 조회 API 연동
unique 인덱스 추가
- memberId, roomType (중복되는 방 생성 방지)
- memberId, roomId, furnitureType (방 안에 중복 가구 생성 방지)
CORS 테스트 케이스 추가
curl -v -L -X OPTIONS 'http://jibsuni.depromeet.com/api/members/me' -H 'Origin: http://localhost:3000' -H 'Access-Control-Request-Headers: Origin, Accept, Content-Type, Authorization' -H 'Access-Control-Request-Method: GET'
* Trying 15.164.234.144...
* TCP_NODELAY set
* Connected to jibsuni.depromeet.com (15.164.234.144) port 80 (#0)
> OPTIONS /api/members/me HTTP/1.1
> Host: jibsuni.depromeet.com
> User-Agent: curl/7.54.0
> Accept: */*
> Origin: http://localhost:3000
> Access-Control-Request-Headers: Origin, Accept, Content-Type, Authorization
> Access-Control-Request-Method: GET
>
< HTTP/1.1 200
< Server: nginx/1.16.1
< Date: Tue, 28 Jan 2020 15:49:56 GMT
< Content-Length: 0
< Connection: keep-alive
< Set-Cookie: SCOUTER=z1v1d5c8s7l39r; Max-Age=2147483647; Expires=Sun, 15-Feb-2088 19:04:03 GMT; Path=/
< Vary: Origin
< Vary: Access-Control-Request-Method
< Vary: Access-Control-Request-Headers
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: OPTIONS,HEAD,GET,POST,PUT,DELETE
< Access-Control-Allow-Headers: Origin, Accept, Content-Type, Authorization
< Access-Control-Max-Age: 3600
< Allow: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< X-Frame-Options: DENY
<
* Connection #0 to host jibsuni.depromeet.com left intact
내 정보 조회 API 추가
GET /api/members/me
access log 에 client ip 기록하기
- nginx 에서 X-Forward-For 헤더 추가
- tomcat access log format 에 xff 추가
날씨 조회 테스트용 스크립트 추가
OAuth 로그인 (카카오)
미세먼지 조회 API 스크립트 추가
시도별 실시간 측정정보 조회
- endpoint:
http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getCtprvnRltmMesureDnsty
측정소별 실시간 측정정보 조회
- endpoint:
http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getMsrstnAcctoRltmMesureDnsty
측정소 정보 조회
- 대기질 측정소 정보를 조회하기 위한 서비스로 TM 좌표 기반의 가까운 측정소 및 측정소 목록과 측정소의 정보를 조회할 수 있다.
- endpoint:
http://openapi.airkorea.or.kr/openapi/services/rest/MsrstnInfoInqireSvc
기타
TM 좌표계 원점
json 응답 받기
※ JSON 방식 호출 방법 : 호출 시 다음의 파라미터(&_returnType=json)를 추가하여 호출
References
- 대기오염 정보 조회 서비스 (https://www.data.go.kr/subMain.jsp?param=T1BFTkFQSUAxNTAwMDU4MQ==#/L3B1YnIvcG90L215cC9Jcm9zTXlQYWdlL29wZW5EZXZHdWlkZVBhZ2UkQF4wMTJtMSRAXnB1YmxpY0RhdGFQaz0xNTAwMDU4MSRAXnB1YmxpY0RhdGFEZXRhaWxQaz11ZGRpOjcwOTExMGU3LWQ3YjEtNDQyMS05MGJhLTg0YTY5Zjk4MGNhYl8yMDE2MDgwODExMTQkQF5vcHJ0aW5TZXFObz0xMzk3NSRAXm1haW5GbGFnPXRydWU=)
- [한국환경공단_측정소정보] 측정소 정보 조회 서비스 (https://www.data.go.kr/dataset/15000660/openapi.do?mypageFlag=Y)
- tm 좌표계 (https://geographiclib.sourceforge.io/2009-03/transversemercator.html)
- [Geocoder 1.0 레퍼런스] 좌표를 주소로 변환, Open API, 일 30,000건 (https://www.vworld.kr/dev/v4dv_geocoderguide_s002.do)
- GEEPS 주소 - 좌표 변환 서비스 (http://geeps.krihs.re.kr/geocoding/service_page)
session 사용하지 않기
- 시큐리티에서
@ResourceServer
,.jwt
등으로 사용하는거 더 알아보기. - cache 때문에 사용해야한다면, session id 라도 숨기고싶당 ㅠ_ㅠ
- 이게 말이 되는지부터 공부해보기..
기상청 날씨 조회 API 연동
지난 할 일 삭제
- 날짜가 지난 일정은 삭제합니다
- 자정에 삭제?
- soft delete 후 나중에 진짜 삭제
- 배치 프로세스가 있어야할듯
어플리케이션 이름 변경
AS-IS
package com.depromeet.todo;
,public class TodoApplication
등 가칭으로 Todo 사용하는 중
TO-BE
- 서비스 이름이 정해지면, 어플리케이션 이름을 적절히 변경해야합니다
PUT /api/members/me 401 응답
- Authorization header 추가했는데도 401 나오면서 실패
- web 에서는 안되고, curl 이나 swagger 는 동작
- 쿠키때문인거같은데.. rememberMe 옵션 제외해보기
https 인증서 추가
domain
- 도메인 생성이 선행되어야함
- {sub-domain}.depromeet.com 서브도메인 추가
nginx
- letsencrypt 인증서 발급
- 80 -> 443 redirect
- 80 포트에서 서비스하는 내용 443 에도 적용
서버 정보 알람 받기 및 운영 준비 ?
- scouter server alert 설정 ( to slack channel )
- 헬스체크 : scouter 에서 해줌
- 자동 재시작
등등.
방 타입이 일치하지 않아도 생성되는 현상
living-room
kitchen
bedroom
bath-room
4가지 경우가 아니면 생성되면 안됨
uri 에서 furnitures 를 사용합니다
AS-IS
DELETE /api/furniture/{furnitureId}
POST /api/rooms/{roomId}/furniture
TO-BE
DELETE /api/furnitures/{furnitureId}
POST /api/rooms/{roomId}/furnitures
swagger 추가
- 문서를 추가합니다
- /api 로 시작하는 url 만 proxy 하고있기때문에, swagger 에서도 적절한 설정이 필요합니다
cors origin * 안넣기
Access to XMLHttpRequest at 'http://jibsuni.depromeet.com/api/members/me' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
Entity 에서 의존하는 클래스들에 @Configurable 적용해보기
IdGenerator, 암복호화, Repository 등에 의존할 때 써보면 좋을거같은데..
직접 써본적은 없어서 장단점은 잘 모릅니다 ㅠ_ㅠ
jwt 토큰 발급 기능 추가
- 인증에 성공하면 jwt 토큰을 발급합니다.
- https://mvnrepository.com/artifact/com.auth0/java-jwt/3.8.3
- refreshToken 은 구현하지 않습니다 (구현하려면 fe 상의필요)
kakao api 에서 성공 아닌 응답 받는 경우 처리
- 카카오에서 401 받는 경우, 400으로 응답 필요
- 아니면 503
멤버 생성시 초기화 로직 추가
- 방만들기
- 가구 만들기
- 기본 할 일 만들기
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.