1. alert
2. alert_history
3. weather_data
4. weather_summary
- Start my-sql database on port 3306.
- One way is to start my-sql on docker container.
- Create database name
weather_alertcreate database weather_alert; - Set the admin username, admin password and your-api-key in application.properties.
spring.datasource.username=root spring.datasource.password=password api.key=your_api_key_here - Uncomment the followings.
@Scheduled(fixedRate = 2000) // uncomment this for testingincom.tapas.weather_alert.service.ApiFetchService.java@Scheduled(fixedRate = 3000) // uncomment for testingincom.tapas.weather_alert.service.Aggregate.javaList<Object>[] results = weatherDataRepository.retrieveWeatherSummaryNativeTest(); // uncomment for testingincom.tapas.weather_alert.service.Aggregate.javaInteger UPDATE_TIME = 2000; // uncomment for testinginpackage com.tapas.weather_alert.service.AlertService.java;
- Comment the followings.
-
@Scheduled(fixedRate = 5 * 60 * 1000)incom.tapas.weather_alert.service.ApiFetchService.java@Scheduled(cron = "0 1 0 * * *")incom.tapas.weather_alert.service.Aggregate.javaList<Object[]> results = weatherDataRepository.retrieveWeatherSummaryNative();incom.tapas.weather_alert.service.Aggregate.javaInteger UPDATE_TIME = 5 * 60 * 1000;inpackage com.tapas.weather_alert.service.AlertService.java;
- Run the application on port 8080
- Creating a alert by sending POST reqeust to () using the curl command
curl --location 'http://localhost:8080/alert' \ --header 'Content-Type: application/json' \ --data '{ "field":"TEMPERATURE", "operation":"GT", "value":"250", "numUpdate":2 }' - Retrive all alerts by sending GET request to () using the curl command
curl --location 'http://localhost:8080/alert' - Get the daily update by sending GET request to () using the curl command
curl --location 'http://localhost:8080/weather/daily_update' - Get the historical trend by sending GET reqest to () using the curl command
curl --location 'http://localhost:8080/weather/historical_trend'



