Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbiros committed Oct 6, 2024
1 parent 89a2925 commit 9b2fb05
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Custom
database/
data/
temp.json

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
2 changes: 1 addition & 1 deletion backend/routers/report_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def get_report(scene_id: str, db: Session = Depends(get_db)) -> ReportResu
async def get_reports(user: UserResponse = Depends(get_current_user), db: Session = Depends(get_db)):
# todo: return only user reports
reports = (
db.query(models.Report).join(models.User).all()
db.query(models.Report).all()
)

return reports
4 changes: 2 additions & 2 deletions backend/schemas/landsat/landsat_api_by_id_advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def landsat_item_builder(self, item: Item) -> LandsatItem:
datetime=item.datetime,
eo_cloud_cover=item.properties["eo:cloud_cover"] / 100,
wrs_coordinates=WrsCoordinates(
path=item.properties["landsat:wrs_path"],
row=item.properties["landsat:wrs_row"],
wrs_path=item.properties["landsat:wrs_path"],
wrs_row=item.properties["landsat:wrs_row"],
),
rendered_preview=item.assets["rendered_preview"].href,
polygon=polygon_from_nested_list(item.geometry["coordinates"]),
Expand Down
4 changes: 2 additions & 2 deletions backend/schemas/structures/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@


class Coordinates(BaseModel):
latitude: float = Field(alias="lat", ge=-90, le=90)
longitude: float = Field(alias="lon", ge=-180, le=180)
latitude: float = Field(..., alias="lat", ge=-90, le=90)
longitude: float = Field(..., alias="lon", ge=-180, le=180)

def to_list(self):
return [self.latitude, self.longitude]
4 changes: 2 additions & 2 deletions backend/schemas/structures/wrs_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@


class WrsCoordinates(BaseModel):
wrs_path: int = Field(alias="path", ge=1, le=233)
wrs_row: int = Field(alias="row", ge=1, le=248)
wrs_path: int = Field(..., alias="path", ge=1, le=233)
wrs_row: int = Field(..., alias="row", ge=1, le=248)
2 changes: 1 addition & 1 deletion backend/utils/polygon_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

def polygon_from_nested_list(nested_data: list[list[list[float]]]) -> Polygon:
data = nested_data[0]
return Polygon(coordinates=[Coordinates(lat=coord[1], lon=coord[0]) for coord in data])
return Polygon(coordinates=[Coordinates(latitude=coord[1], longitude=coord[0]) for coord in data])
1 change: 1 addition & 0 deletions frontend/pages/panel/report/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<script setup lang="ts">
const route = useRoute();
const { data, error } = useApi("/report/get_report", {
query: {
scene_id: route.params.id.toString()
Expand Down
41 changes: 23 additions & 18 deletions frontend/pages/panel/reports.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@
<Table>
<TableHeader>
<TableRow>
<TableHead>Satelite</TableHead>
<TableHead>Date</TableHead>
<TableHead>Is Processed</TableHead>
<TableHead>Created at</TableHead>
<TableHead>Status</TableHead>
<TableHead>Scene</TableHead>
<TableHead><!-- extends table header to full width --></TableHead>
<TableHead><!-- extends table header to full width --></TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow v-for="(report, index) in reports" :key="report.row">
<TableCell>{{ report.satelite }}</TableCell>
<TableCell>{{ report.date }}</TableCell>
<TableCell>{{ report.status }}</TableCell>
<TableCell><NuxtLink :to="`/panel/report/${report.id}`"><img class="i-material-symbols-light:open-in-new" text-2xl></NuxtLink></TableCell>
<TableRow v-for="(report, index) in reports" :key="index">
<TableCell>{{ report.is_processed }}</TableCell>
<TableCell>{{ report.created_at }}</TableCell>
<TableCell>{{ report.scene_id }}</TableCell>
<TableCell><NuxtLink :to="`/panel/report/${report.scene_id}`"><img class="i-material-symbols-light:open-in-new" text-2xl></NuxtLink></TableCell>
<TableCell>
<button class="text-red-500 hover:text-red-700" @click="deleteReport(index)">
<button class="text-red-500 hover:text-red-700">
DELETE
</button>
</TableCell>
Expand All @@ -35,16 +36,20 @@
</template>

<script setup lang="ts">
const reports = ref([
{
satelite: "Landsat 9",
date: "11.9.2024",
status: "Finished",
id: "1"
const reports = ref<{
scene_id: string
is_processed: boolean
created_at: string
raw_data: string | null
}[]>();
const { data, error } = useApi("/report/get_reports", {
headers: {
Authorization: `Bearer ${useSupabaseSession().value?.access_token}`
}
]);
});
const deleteReport = (rowIndex: number) => {
reports.value.splice(rowIndex, 1);
};
if (data.value) {
reports.value = data.value;
}
</script>
Loading

0 comments on commit 9b2fb05

Please sign in to comment.