Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
489789c
create a new vaadin project.
Tanmoy1228 Aug 7, 2023
05d5572
Implement OpenMeteo location API integration.
Tanmoy1228 Aug 7, 2023
a854731
Implement OpenMeteo weather API integration for daily and hourly weat…
Tanmoy1228 Aug 7, 2023
6ed702b
Change class name OpenMeteoWeatherAdapter to OpenMeteoWeatherProvider…
Tanmoy1228 Aug 7, 2023
dee9782
Add search location functionality and location list component.
Tanmoy1228 Aug 8, 2023
b9a89d8
Added pagination functionality to the location search results.
Tanmoy1228 Aug 9, 2023
1fe471d
Added count parameter in LocationProviderService to fetch location data.
Tanmoy1228 Aug 9, 2023
3bd7a77
Added location exception handling and improved error messages.
Tanmoy1228 Aug 9, 2023
a8d4e3c
Implemented navigation to weather details view on location selection.
Tanmoy1228 Aug 9, 2023
c629702
Add CurrentWeatherCard to show current weather information in weather…
Tanmoy1228 Aug 9, 2023
7b5f9b6
Update current weather card.
Tanmoy1228 Aug 9, 2023
16ce676
Add DailyWeatherCard to show daily weather information.
Tanmoy1228 Aug 9, 2023
a529d90
Add HourlyWeatherDialog to show hourly weather data of a day.
Tanmoy1228 Aug 10, 2023
0e24418
Update current weather card view.
Tanmoy1228 Aug 10, 2023
a8a0a03
Add addItemClickListener instead of asSingleSelect().addValueChangeLi…
Tanmoy1228 Aug 10, 2023
67e4e3c
Update hourly weather view.
Tanmoy1228 Aug 10, 2023
38d2acc
Add exception handling for weather view.
Tanmoy1228 Aug 10, 2023
3b2bafb
Update location exception handling.
Tanmoy1228 Aug 10, 2023
6047a3b
Add favorite icon to WeatherView to mark or unmark a location as favo…
Tanmoy1228 Aug 10, 2023
fd56bcd
Implement user login and registration view.
Tanmoy1228 Aug 12, 2023
5e1282c
Implement user login and registration service.
Tanmoy1228 Aug 12, 2023
d29e6b5
Add reference source in location details.
Tanmoy1228 Aug 12, 2023
cd07d13
Implement locations crud operations.
Tanmoy1228 Aug 12, 2023
135f8ac
Update add and delete locations method signature.
Tanmoy1228 Aug 12, 2023
a6fa34d
Implement favourite locations crud operations.
Tanmoy1228 Aug 12, 2023
0d0ecfb
Show favourite locations list in FavouriteLocationsView.
Tanmoy1228 Aug 12, 2023
c9e77fd
Add constructor for LocationDetails, CurrentWeather, DailyWeather, Ho…
Tanmoy1228 Aug 14, 2023
af5863f
Add docker compose file to dockerized the weather app.
Tanmoy1228 Aug 14, 2023
90518f2
Update README with Docker setup and project details.
Tanmoy1228 Aug 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SPRING_DATASOURCE_URL=jdbc:postgresql://database:5432/weatherdb
SPRING_DATASOURCE_USERNAME=weatheruser
SPRING_DATASOURCE_PASSWORD=weatherpassword

POSTGRES_DB=weatherdb
POSTGRES_USER=weatheruser
POSTGRES_PASSWORD=weatherpassword


21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/target/
.idea/
.vscode/
.settings
.project
.classpath

*.iml
.DS_Store

# The following files are generated/updated by vaadin-maven-plugin
node_modules/
frontend/generated/
pnpmfile.js
vite.generated.ts

# Browser drivers for local integration tests
drivers/
# Error screenshots generated by TestBench for failed integration tests
error-screenshots/
webpack.generated.js
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Use a Maven base image for building
FROM maven:3.8.3-openjdk-17 AS build

# Set the working directory inside the container
WORKDIR /app

# Copy the Maven project files for dependency resolution
COPY pom.xml .

# Download the project dependencies
RUN mvn dependency:go-offline

# Copy the application source code
COPY src ./src
COPY frontend ./frontend

# Build the application
RUN mvn clean package -Pproduction

# Use a Tomcat base image for deployment
FROM tomcat:10.0

# Remove the default ROOT application
RUN rm -rf /usr/local/tomcat/webapps/ROOT

# Copy the JAR file (compiled application) into the container
COPY --from=build /app/target/weatherapp-1.0-SNAPSHOT.war /usr/local/tomcat/webapps/ROOT.war

# Expose the port your application will run on
EXPOSE 8080

# Command to run the application
CMD ["catalina.sh", "run"]


24 changes: 24 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org>
64 changes: 37 additions & 27 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
# Weather Application

This is the job interview task for software developer position

## What to do
* Fork the repository
* After work is done, make a pull request and notify me by email

## Task description
You need to use the Weather API provided here https://open-meteo.com/en to make the weather application.
1. Call the API to get the locations by city name. Make the paging available with 10 items per page and a filter to filter by location name.
2. When clicked on the location it should show the weather forecast for the location with the temperature, surface wind and rain hourly. The interface should let you first see the daily forecast and when clicked it then should show the forecast hourly for the day you selected.
3. If you UI contains a chart it is a bonus. The interface should be convenient for user and rely on best usability and design practises
4. Only logged on users should be able to see the weather forecasts.
5. User should be able to mark the location favourite and have the favourite location list for quick access.

All the other specific requirements are up to you

## Technical requirements
* Use Vaadin (https://vaadin.com/) framework for the frontend. For chart you may use some different framework
* For backend use Java EE
* Use any database (Postgres, Oracle, etc.)
* Make a Maven project

## Main points
* Structure your code
* Use best practises
* Use naming conventions
* Show understanding of software development concepts
Welcome to the Weather App! This application provides weather information based on location details.

## Getting Started

Follow these instructions to set up and run the Weather App using Docker.

### Prerequisites

- [Docker](https://www.docker.com/get-started)

### Running the App

1. Clone this repository to your local machine:

```bash
git clone https://github.com/your-username/weather-app.git

2. Navigate to the project directory:
```bash
cd weather-app

3. Run the following command to start the application using Docker Compose:
```bash
docker-compose up

4. Access the application in your browser:
Open your browser and go to http://localhost:8080


## Note

* This application was developed with a focus on backend functionality, and the UI may not have an extensive design or visual appeal.

* The application leverages Vaadin for the user interface, and the UI design might be minimalistic due to the developer's backend-focused expertise.

## Authors
* Tanmoy Ghosh
18 changes: 18 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: '3'

services:
weather-app:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
env_file:
- .env
depends_on:
- database

database:
image: postgres:12.15
env_file:
- .env
23 changes: 23 additions & 0 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<!--
This file is auto-generated by Vaadin.
-->

<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body, #outlet {
height: 100vh;
width: 100%;
margin: 0;
}
</style>
<!-- index.ts is included here automatically (either by the dev server or during the build) -->
</head>
<body>
<!-- This outlet div is where the views are rendered -->
<div id="outlet"></div>
</body>
</html>
16 changes: 16 additions & 0 deletions frontend/themes/weatherapp/main-layout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
vaadin-scroller[slot="drawer"] {
padding: var(--lumo-space-s);
}

[slot="drawer"]:is(header, footer) {
display: flex;
align-items: center;
gap: var(--lumo-space-s);
padding: var(--lumo-space-s) var(--lumo-space-m);
min-height: var(--lumo-size-xl);
box-sizing: border-box;
}

[slot="drawer"]:is(header, footer):is(:empty) {
display: none;
}
86 changes: 86 additions & 0 deletions frontend/themes/weatherapp/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
@import url('./main-layout.css');

.blue-span {
color: #0074D9;
font-size: 25px;
}

.weather-card {
width: 100%;
height: auto;
border-radius: 10px;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
position: relative;
color: white;
}

.info-container {
display: flex;
flex-direction: column; /* Display items vertically */
align-items: flex-start; /* Align items to the left */
}

.data-container {
width: 100%; /* Take up full width */
display: flex;
justify-content: space-between; /* Space out the elements */
align-items: center; /* Center vertically */
}

.location {
font-size: 24px;
font-weight: bold;
border: none !important;
box-shadow: none !important;
background: none !important;
padding: 0 !important;
outline: none !important;
appearance: none;
}

.current-weather {
font-size: 24px;
font-weight: bold;
border: none !important;
box-shadow: none !important;
background: none !important;
padding: 0 !important;
outline: none !important;
appearance: none;
margin-bottom: 50px;
}

.temperature, .wind-speed, .date-time {
font-size: 14px;
flex: 1; /* Distribute available space equally */
margin: 5px;
}


.daily-weather-card {
width: 100%;
height: auto;
border-radius: 10px;
padding: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
display: flex;
justify-content: space-between;
position: relative;
color: black;
margin-top: 10px;
}

.info-layout {
display: flex;
flex-direction: row; /* Display items horizontally */
align-items: center; /* Center items vertically */
gap: 10px; /* Add some space between items */
}

.max-temperature, .min-temperature, .sunrise, .sunset, .rain, max-wind-speed {
font-size: 14px;
flex: 1; /* Distribute available space equally */
}
Empty file.
3 changes: 3 additions & 0 deletions frontend/themes/weatherapp/theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"lumoImports" : [ "typography", "color", "spacing", "badge", "utility" ]
}
Loading