Skip to content

Commit

Permalink
Format with Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
kiwijos committed Sep 27, 2023
1 parent 4e34cd4 commit 7ae2175
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
11 changes: 7 additions & 4 deletions src/controllers/delayed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import ErrorResponse from "../models/ErrorResponse.model";
const API_URL = "https://api.trafikinfo.trafikverket.se/v2/data.json";

const delayed = {
getDelayedTrains: async function getDelayedTrains(req: Request, res: Response): Promise<object | ErrorResponse> {
getDelayedTrains: async function getDelayedTrains(
req: Request,
res: Response
): Promise<object | ErrorResponse> {
const query = `<REQUEST>
<LOGIN authenticationkey="${process.env.TRAFIKVERKET_API_KEY}" />
<QUERY objecttype="TrainAnnouncement" orderby='AdvertisedTimeAtLocation' schemaversion="1.8">
Expand Down Expand Up @@ -40,9 +43,9 @@ const delayed = {
body: query,
headers: { "Content-Type": "text/xml" }
});

const result = await response.json();

return res.json({
data: result.RESPONSE.RESULT[0].TrainAnnouncement
});
Expand All @@ -53,7 +56,7 @@ const delayed = {
errors: {
status: 500,
source: API_URL,
title: 'Server Error',
title: "Server Error",
message: err.message
}
});
Expand Down
12 changes: 6 additions & 6 deletions src/models/ErrorResponse.model.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
interface ErrorResponse {
errors: {
status: number;
source: string;
title: string;
message: string;
status: number;
source: string;
title: string;
message: string;
};
}
}

export default ErrorResponse;
export default ErrorResponse;
2 changes: 1 addition & 1 deletion src/models/TrainPosition.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ interface TrainPosition {
speed: number;
}

export default TrainPosition;
export default TrainPosition;

0 comments on commit 7ae2175

Please sign in to comment.