Skip to content

Commit 93d3068

Browse files
refactor(services/providers): standardization
1 parent eb1cae7 commit 93d3068

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

src/data/flights.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lastUpdatedAt": 1766390878596,
2+
"lastUpdatedAt": 1766392018585,
33
"flights": [
44
{
55
"id": "9724320d-7c38-4e65-9d14-5df975d7c820",
@@ -5861,4 +5861,4 @@
58615861
"arrGate": null
58625862
}
58635863
]
5864-
}
5864+
}

src/pages/about/traveling.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { NextSeo as Metadata } from 'next-seo';
33

44
import { Routes, siteMetadata } from 'config/constants';
55

6-
import FlightsContentService from 'services/content/flights';
6+
import FlightyService from 'services/providers/flighty';
77

88
import { MetadataConfig, generateOpenGraphImage } from 'utils/open-graph';
99

@@ -35,11 +35,11 @@ export type PageProps = InferGetStaticPropsType<typeof getStaticProps>;
3535
// NEXT
3636
// ---------------------------------------------------------------------------
3737

38-
const flightsService = FlightsContentService.getInstance();
38+
const flightsService = FlightyService.getInstance();
3939

4040
export async function getStaticProps() {
4141
flightsService.init();
42-
await flightsService.generateFlightsData();
42+
await flightsService.bootstrapLocalData();
4343

4444
const flights = flightsService.getFlights();
4545
const airlines = flightsService.getAirlines();

src/pages/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { siteMetadata, socialNetworks } from 'config/constants';
22

3-
import ForbesCurrencyConverter from 'services/providers/forbes-currency-converter';
3+
import ForbesService from 'services/providers/forbes';
44

55
import Badge from 'components/shared/badge';
66
import ButtonLink from 'components/shared/button-link';
@@ -13,10 +13,10 @@ import Layout from 'components/layouts/page';
1313
// NEXT
1414
// ---------------------------------------------------------------------------
1515

16-
const currencyServiceInstance = ForbesCurrencyConverter.getInstance();
16+
const currencyServiceInstance = ForbesService.getInstance();
1717

1818
export async function getStaticProps() {
19-
await currencyServiceInstance.generateCurrencyTable();
19+
await currencyServiceInstance.bootstrapLocalData();
2020
return {
2121
props: {},
2222
};
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,20 @@ export type AirportCode = string;
7373
// CORE
7474
// ---------------------------------------------------------------------------
7575

76-
export default class FlightsContentService {
77-
private static instance: FlightsContentService;
76+
export default class FlightyService {
77+
private static instance: FlightyService;
7878
private flights: Flight[] = [];
7979

8080
private constructor() {}
8181

82-
public static getInstance(): FlightsContentService {
83-
if (!FlightsContentService.instance) {
84-
FlightsContentService.instance = new FlightsContentService();
82+
public static getInstance(): FlightyService {
83+
if (!FlightyService.instance) {
84+
FlightyService.instance = new FlightyService();
8585
}
86-
return FlightsContentService.instance;
86+
return FlightyService.instance;
8787
}
8888

89-
public async generateFlightsData() {
89+
public async bootstrapLocalData() {
9090
if (isInCi) {
9191
console.info('Running in CI - skipping flights data generation');
9292
return null;

src/services/providers/forbes-currency-converter.ts renamed to src/services/providers/forbes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export default class ForbesCurrencyConverter {
8686
};
8787
}
8888

89-
async generateCurrencyTable() {
89+
async bootstrapLocalData() {
9090
if (isInCi) {
9191
console.info('Running in a CI environment');
9292
console.warn('Skipping currency table generation');

0 commit comments

Comments
 (0)