swsnu / swpp2019-team5

WearHouse - Your very own fashion Warehouse
3 stars 4 forks source link

[Setup] Need to add weather field to outfit model #63

Closed haesookim closed 4 years ago

haesookim commented 4 years ago

outfit의 데이터 구조가 현재

outfit = {
    id: 0,
    items : [],
    satisfactionValue: 0,
    date: Date()
}

로 되어 있는데, 여기에 weather 관련 정보가 들어가야 합니다. 현재 Recommendation Component 코드는 아래와 같은 구조를 가정합니다.

outfit = {
    id: 0,
    items : [],
    satisfactionValue: 0,
    date: Date(),
    weather: {
        icon: "clear"
        tempAvg: 0.0
    }
}

/api/weather (혹은 /api/weather/) 으로 콜을 날리면 현재

{
    "summary": "Rain in the afternoon.", 
    "icon": "rain", 
    "temperatureHigh": 11.05, 
    "temperatureLow": -3.09
}

의 형태를 리턴합니다. 이 부분 받아서 icon 과 tempAvg 를 세팅해주면 될 것 같습니다!

dispatch는 getWeather: () => dispatch(actionCreators.getWeather()), 이고, state는 state.weather.todayWeather를 받습니다 :)