Code Monkey home page Code Monkey logo

7th-final-9th-team-api's People

Contributors

junhaesung avatar juyoungyoo avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

7th-final-9th-team-api's Issues

사용자 정보 수정 기능 추가

  • 사용자 이름 추가
  • PUT /members/me, PUT /members/{member-id} API 추가

request

PUT /api/members/{member-id}

{
  "name": "toBeChangedName"
}

response

{
  "data": {
    "member": {
      .. 
    }   
  }
}

spring security 추가

  • 로그인 요청에 대한 응답으로 토큰을 발급합니다
  • 인증이 필요한 요청에 대해서 토큰이 없거나, 유효하지 않으면 401 로 응답합니다

health check 추가

  • actuator 의존성 추가
  • /actuator/health
  • 1분마다 호출하고 응답 없으면 slack 으로 웹훅 보내기

회원가입 후 필수 정보 입력 (유저가 직접 입력해야되는 종류의 값들이 있다면.. )

  • 필수 정보 없이도, oauth user info 만 가지고 일단 member 를 생성합니다.
  • 회원가입에 필요한 필수 정보가 있으면, 입력받아서 member 의 상태를 업데이트 합니다
  • 필수정보 입력받았는지 여부 flag 필요합니다 (회원생성 후, 필수정보 입력 전에 나가는경우 다시 돌아오면 필수 정보 입력 페이지로 보내주기 위함)

api url 변경

  • members 리소스를 접근하는 경우가 아니면, members/me 를 생략합니다
  • 만약에 전체 유저에 대한 rooms 등을 접근하게되면, 다른 방법으로 해결하기-

weather 수정

  • 에러 고치기 전까지 날씨 random 으로 응답하기
  • 문서에 강수형태 종류 추가

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 채우기

  • description
  • README
  • Code of conduct
  • Contributing - write contributing guidelines
  • License
  • Issue template
  • Pull request template

image

기상청 API 로부터 기대하지 않은 응답을 받는 경우 대응

{
  "response": {
    "header": {
      "resultCode": "0000",
      "resultMsg": "OK"
    },
    "body": {
      "items": "",
      "numOfRows": 10,
      "pageNo": 1,
      "totalCount": 0
    }
  }
}
  1. 날씨 API 요청시 위의 응답이 나오는 경우 해결하기.
    (현재 시각의 자료가 준비되지 않았을 때 이렇게 응답하는 것으로 추측. 40분 이후에 조회하라고 문서에써있음)
    (현재시각의 분 값이 40 미만인 경우, 한시간 전을 기준으로 조회하도록 수정하기.. )

  2. 41분쯤 정상 응답을 받으면 캐시해두고
    다음 시간까지 API 를 직접 요청하지 않는 방법도 적용해보기

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"
    }
  }
}

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 스크립트 추가

시도별 실시간 측정정보 조회

  • endpoint: http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getCtprvnRltmMesureDnsty

image

측정소별 실시간 측정정보 조회

  • endpoint: http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getMsrstnAcctoRltmMesureDnsty

image

측정소 정보 조회

  • 대기질 측정소 정보를 조회하기 위한 서비스로 TM 좌표 기반의 가까운 측정소 및 측정소 목록과 측정소의 정보를 조회할 수 있다.
  • endpoint: http://openapi.airkorea.or.kr/openapi/services/rest/MsrstnInfoInqireSvc

image

기타

TM 좌표계 원점

json 응답 받기

※ JSON 방식 호출 방법 : 호출 시 다음의 파라미터(&_returnType=json)를 추가하여 호출

References

session 사용하지 않기

  • 시큐리티에서 @ResourceServer, .jwt 등으로 사용하는거 더 알아보기.
  • cache 때문에 사용해야한다면, session id 라도 숨기고싶당 ㅠ_ㅠ
    • 이게 말이 되는지부터 공부해보기..

지난 할 일 삭제

  • 날짜가 지난 일정은 삭제합니다
  • 자정에 삭제?
  • 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 에도 적용

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.