Skip to content

Commit 0fa3c13

Browse files
committed
refactor: dtos
1 parent e35ec27 commit 0fa3c13

File tree

17 files changed

+254
-155
lines changed

17 files changed

+254
-155
lines changed

frontend/src/components/Chart.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ import FormControlLabel from '@mui/material/FormControlLabel';
1818
import FormControl from '@mui/material/FormControl';
1919
import GlobalState, { FuelType } from '../GlobalState';
2020
import { useRecoilState } from 'recoil';
21-
import { GsPoint, TimeSlot } from '../service/dtos';
21+
import { TimeSlot } from '../model/time-slot-response';
22+
import { GsPoint } from '../model/gs-point';
2223

2324
export interface ChartProps {
2425
timeSlots: TimeSlot[];

frontend/src/components/GsMap.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import myStyle from './gsmap.module.scss';
2323
import { Icon, Style } from 'ol/style.js';
2424
import { useEffect } from 'react';
2525
import { nanoid } from 'nanoid';
26-
import { CenterLocation, GsValue } from '../service/dtos';
26+
import { CenterLocation } from '../model/location';
27+
import { GsValue } from '../model/gs-point';
2728

2829
interface InputProps {
2930
center: CenterLocation;

frontend/src/components/LocationModal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ import {UserDataState} from "../GlobalState";
1616
import { useMemo,useEffect,useState,FormEvent,ChangeEvent,SyntheticEvent } from "react";
1717
import {Box,TextField,Button,Dialog,DialogContent, Autocomplete} from '@mui/material';
1818
import styles from './modal.module.scss';
19-
import { PostCodeLocation, UserRequest } from "../service/dtos";
2019
import { fetchLocation, postLocationRadius } from "../service/http-client";
20+
import { PostCodeLocation } from "../model/location";
21+
import { UserRequest } from "../model/user";
2122

2223
const LocationModal = () => {
2324
let controller: AbortController | null = null;

frontend/src/components/LoginModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import { UserDataState } from "../GlobalState";
1717
import { useState, ChangeEventHandler, FormEvent, BaseSyntheticEvent } from "react";
1818
import { Box, TextField, Button, Tab, Tabs, Dialog, DialogContent } from '@mui/material';
1919
import { useNavigate } from "react-router";
20-
import { UserResponse } from "../service/dtos";
2120
import { postLogin, postSignin } from "../service/http-client";
21+
import { UserResponse } from "../model/user";
2222

2323
interface MsgData {
2424
jwtToken?: string;

frontend/src/components/Main.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import GlobalState from '../GlobalState';
1919
//import styles from './main.module.scss';
2020
import Chart from './Chart';
2121
import { useNavigate } from 'react-router';
22-
import { MyDataJson, GsValue, TimeSlot } from '../service/dtos';
2322
import { fetchGasStations, fetchPriceAvgs, fetchTimeSlots, fetchUserNotifications } from '../service/http-client';
24-
23+
import { TimeSlot } from '../model/time-slot-response';
24+
import { GsValue } from '../model/gs-point';
25+
import { MyDataJson } from '../model/my-data-json';
2526

2627
export default function Main() {
2728
const navigate = useNavigate();

frontend/src/components/TargetPriceModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import { useRecoilState, useRecoilValue } from "recoil";
1414
import GlobalState from "../GlobalState";
1515
import { Box, TextField, Button, Dialog, DialogContent } from '@mui/material';
1616
import { useState, useMemo, ChangeEventHandler, FormEvent } from "react";
17-
import { UserRequest } from "../service/dtos";
1817
import { postTargetPrices } from "../service/http-client";
18+
import { UserRequest } from "../model/user";
1919

2020

2121
const TargetPriceModal = () => {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
- Copyright 2022 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
export interface GasPriceAvgs {
14+
Postcode: string
15+
County: string
16+
State: string
17+
CountyAvgDiesel: number
18+
CountyAvgE10: number
19+
CountyAvgE5: number
20+
StateAvgDiesel: number
21+
StateAvgE10: number
22+
StateAvgE5: number
23+
}

frontend/src/model/gas-price.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
- Copyright 2022 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
export interface GasPrice {
14+
E5: number;
15+
E10: number;
16+
Diesel: number;
17+
Date: string;
18+
Changed: number;
19+
}

frontend/src/model/gas-station.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
- Copyright 2022 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
import { GasPrice } from "./gas-price";
14+
15+
export interface GasStation {
16+
StationName: string;
17+
Brand: string;
18+
Street: string;
19+
Place: string;
20+
HouseNumber: string;
21+
PostCode: string;
22+
Latitude: number;
23+
Longitude: number;
24+
PublicHolidayIdentifier: string;
25+
OtJson: string;
26+
FirstActive: Date;
27+
GasPrices: GasPrice[];
28+
}

frontend/src/model/gs-point.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
- Copyright 2022 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
export interface GsPoint {
14+
timestamp: string;
15+
price: number;
16+
}
17+
18+
export interface GsValue {
19+
location: string;
20+
e5: number;
21+
e10: number;
22+
diesel: number;
23+
date: Date;
24+
longitude: number;
25+
latitude: number;
26+
}

0 commit comments

Comments
 (0)