Skip to content

Commit

Permalink
refactor(poster): Restructure the files
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperVK committed Nov 27, 2024
1 parent 3d961f4 commit 353db9f
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 25 deletions.
2 changes: 1 addition & 1 deletion openapi-ts.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({
client: '@hey-api/client-fetch',
input: './build/swagger.json',
output: `../narrowcasting-client/src/api/`,
output: `../aurora-client/src/api/`,
plugins: [
'@hey-api/schemas',
'@hey-api/services',
Expand Down
4 changes: 2 additions & 2 deletions src/modules/handlers/screen/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export { default as CurrentlyPlayingTrackHandler } from './curently-playing-track-handler';
export { default as CenturionScreenHandler } from './centurion-screen-handler';
export { default as GewisPosterScreenHandler } from './poster/gewis-poster-screen-handler';
export { default as HubblePosterScreenHandler } from './poster/hubble-poster-screen-handler';
export { default as GewisPosterScreenHandler } from './poster/gewis/gewis-poster-screen-handler';
export { default as HubblePosterScreenHandler } from './poster/hubble/hubble-poster-screen-handler';
export { default as RoomResponsibleLegacyHandler } from './room-responsible-legacy-handler';
export { default as StageEffectsHandler } from './stage-effects-handler';
export { default as TimeTrailRaceScreenHandler } from './time-trail-race-screen-handler';
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Request as ExpressRequest } from 'express';
import BasePosterScreenHandler from './base-poster-screen-handler';
import { Poster } from './poster';
import logger from '../../../../logger';
import OlympicsService from "./olympics-service";
import NsTrainsService, {TrainResponse} from "./ns-trains-service";

export interface BorrelModeParams {
enabled: boolean;
Expand Down Expand Up @@ -39,4 +41,12 @@ export class BasePosterScreenController extends Controller {
await this.screenHandler.posterManager.fetchPosters();
this.screenHandler.forceUpdate();
}

public async getTrains(): Promise<TrainResponse[]> {
return new NsTrainsService().getTrains();
}

public async getOlympicsMedalTable() {
return new OlympicsService().getMedalTable();
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {BasePosterResponse, BasePosterScreenController, BorrelModeParams} from "./base-poster-screen-controller";
import HandlerManager from "../../../root/handler-manager";
import {Screen} from "../../../root/entities";
import BasePosterScreenHandler from "./base-poster-screen-handler";
import {GewisPosterScreenHandler} from "../index";
import {BasePosterResponse, BasePosterScreenController, BorrelModeParams} from "../base-poster-screen-controller";
import HandlerManager from "../../../../root/handler-manager";
import {Screen} from "../../../../root/entities";
import BasePosterScreenHandler from "../base-poster-screen-handler";
import {GewisPosterScreenHandler} from "../../index";
import {Body, Get, Post, Put, Query, Request, Route, Security, Tags} from "tsoa";
import {SecurityNames} from "../../../../helpers/security";
import {securityGroups} from "../../../../helpers/security-groups";
import logger from "../../../../logger";
import {SecurityNames} from "../../../../../helpers/security";
import {securityGroups} from "../../../../../helpers/security-groups";
import logger from "../../../../../logger";
import {Request as ExpressRequest} from "express";
import NsTrainsService, {TrainResponse} from "./ns-trains-service";
import {TrainResponse} from "../ns-trains-service";
import GEWISPosterService, {GEWISPhotoAlbumParams} from "./gewis-poster-service";
import OlympicsService from "./olympics-service";
import OlympicsService from "../olympics-service";

interface GewisPosterResponse extends BasePosterResponse {
borrelMode: boolean;
Expand Down Expand Up @@ -77,7 +77,7 @@ export class GewisPosterScreenController extends BasePosterScreenController {
@Security(SecurityNames.LOCAL, securityGroups.poster.base)
@Get('train-departures')
public async getTrains(): Promise<TrainResponse[]> {
return new NsTrainsService().getTrains();
return super.getTrains();
}

@Security(SecurityNames.LOCAL, securityGroups.poster.base)
Expand All @@ -89,7 +89,7 @@ export class GewisPosterScreenController extends BasePosterScreenController {
@Security(SecurityNames.LOCAL, securityGroups.poster.base)
@Get('olympics/medal-table')
public async getOlympicsMedalTable() {
return new OlympicsService().getMedalTable();
return super.getOlympicsMedalTable();
}

@Security(SecurityNames.LOCAL, securityGroups.poster.base)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BasePosterScreenHandler from "./base-poster-screen-handler";
import BasePosterScreenHandler from "../base-poster-screen-handler";
import { Namespace } from "socket.io";


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios, { AxiosError } from 'axios';
import { HttpApiException } from '../../../../helpers/custom-error';
import { HttpApiException } from '../../../../../helpers/custom-error';

export interface GEWISPhotoAlbumParams {
albumIds: number[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {BasePosterResponse, BasePosterScreenController} from "./base-poster-screen-controller";
import HandlerManager from "../../../root/handler-manager";
import {Screen} from "../../../root/entities";
import BasePosterScreenHandler from "./base-poster-screen-handler";
import {HubblePosterScreenHandler} from "../index";
import {BasePosterResponse, BasePosterScreenController} from "../base-poster-screen-controller";
import HandlerManager from "../../../../root/handler-manager";
import {Screen} from "../../../../root/entities";
import BasePosterScreenHandler from "../base-poster-screen-handler";
import {HubblePosterScreenHandler} from "../../index";
import {Get, Post, Request, Route, Security, Tags} from "tsoa";
import {SecurityNames} from "../../../../helpers/security";
import {securityGroups} from "../../../../helpers/security-groups";
import {SecurityNames} from "../../../../../helpers/security";
import {securityGroups} from "../../../../../helpers/security-groups";
import {Request as ExpressRequest} from "express";

@Route('handler/screen/hubble-poster')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BasePosterScreenHandler from "./base-poster-screen-handler";
import BasePosterScreenHandler from "../base-poster-screen-handler";
import { Namespace } from "socket.io";

export default class HubblePosterScreenHandler extends BasePosterScreenHandler {
Expand Down

0 comments on commit 353db9f

Please sign in to comment.