Skip to content

Commit 3aeeebe

Browse files
authored
Merge branch 'main' into feature/custom-testing-base-url
2 parents 28e536b + 3250704 commit 3aeeebe

23 files changed

+576
-83
lines changed

backend/src/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
app = FastAPI()
99

10-
origins = ["http://localhost:5173"]
10+
origins = ["http://localhost:5173", "https://thf-climate-frontend-run-1020174331409.europe-west3.run.app"]
1111

1212
app.add_middleware(
1313
CORSMiddleware,

backend/src/validation/utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,17 @@ def validate_timestamp_start_date_before_end_date(startDate, endDate):
2626
raise HTTPException(
2727
status_code=400, detail="endDate must be after startDate")
2828
return endDate
29+
30+
31+
def validate_temperature_timestamp_in_range(start, end):
32+
min_timestamp = -946771200 # 01/01/1940
33+
max_timestamp = int(time.time()) # now
34+
print(end)
35+
print(max_timestamp)
36+
if (start < min_timestamp or end > max_timestamp):
37+
raise HTTPException(
38+
status_code=400, detail=f"Timestamp must be between {min_timestamp} and {max_timestamp}")
39+
elif end <= start:
40+
raise HTTPException(
41+
status_code=400, detail="endDate must be after startDate")
42+
return end

backend/src/weather/schemas.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from src.constants import AggregationMethod, LocationName, TemporalResolution, Unit
66
from src.validation.utils import (
7-
validate_timestamp_in_range,
7+
validate_temperature_timestamp_in_range,
88
validate_timestamp_start_date_before_end_date,
99
)
1010

@@ -33,14 +33,9 @@ class WeatherDataRequest(BaseModel):
3333
)
3434
aggregation: AggregationMethod = Field(..., description="Aggregation method")
3535

36-
# Custom validator to check if timestamps are valid and in the correct order
37-
@field_validator("startDate")
38-
def validate_timestamp_in_range(cls, v):
39-
return validate_timestamp_in_range(v)
40-
4136
@field_validator("endDate")
42-
def end_date_must_be_after_start_date(cls, v, info: ValidationInfo):
43-
return validate_timestamp_start_date_before_end_date(
37+
def validate_temperature_timestamp_in_range(cls, v, info: ValidationInfo):
38+
return validate_temperature_timestamp_in_range(
4439
info.data.get("startDate"), v
4540
)
4641

frontend/src/App.vue

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
<template>
22
<h1 id="app">
3-
<TestComponent />
4-
<MedianTempGraph />
5-
<MeanSoilTempGraph />
6-
<MeanSoilMoistureGraph />
7-
<AugustMeanSoilTempGraph />
8-
<SelectMonthMeanSoilTempGraph />
3+
<Header />
4+
<IntroSection />
5+
<MainSection />
6+
<Footer />
97
</h1>
108
</template>
119

1210
<script>
13-
import TestComponent from "./components/TestComponent.vue"
14-
import MedianTempGraph from "./components/TestGraphOne.vue"
15-
import MeanSoilTempGraph from "./components/SoilTempGraph.vue"
16-
import MeanSoilMoistureGraph from "./components/SoilMoistureGraph.vue"
17-
import AugustMeanSoilTempGraph from "./components/AugustSoilTempGraph.vue"
18-
import SelectMonthMeanSoilTempGraph from "./components/SelectMonthSoilTempGraph.vue"
11+
import Header from "./components/Header.vue"
12+
import IntroSection from "./components/IntroSection.vue"
13+
import MainSection from "./components/MainSection.vue"
14+
import Footer from "./components/Footer.vue"
1915
2016
export default {
2117
name: 'App',
2218
components: {
23-
//TestComponent,
24-
MedianTempGraph,
25-
MeanSoilTempGraph,
26-
MeanSoilMoistureGraph,
27-
AugustMeanSoilTempGraph,
28-
SelectMonthMeanSoilTempGraph
19+
Header,
20+
IntroSection,
21+
MainSection,
22+
Footer
2923
}
30-
};
24+
}
3125
</script>
3226

3327
<style scoped></style>
7.01 MB
Loading
1010 KB
Loading
1.27 MB
Loading
1.23 MB
Loading
1.21 MB
Loading

frontend/src/components/Footer.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<template>
2+
<v-container class="footer-container" fluid>
3+
<p class="footer-text">CODE University of Applied Sciences, 2024</p>
4+
</v-container>
5+
</template>
6+
7+
<script>
8+
9+
</script>
10+
11+
<style scoped>
12+
.footer-container {
13+
margin: 50px 0 0 0;
14+
text-align: center;
15+
}
16+
17+
.footer-text {
18+
font-size: 0.7rem;
19+
font-weight: 300;
20+
}
21+
</style>

0 commit comments

Comments
 (0)