-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class CompetitionOrganiserInfo { | ||
@ApiProperty() | ||
websiteUrl: string; | ||
@ApiProperty() | ||
liveStreamUrl: string; | ||
@ApiProperty() | ||
resultsUrl: string; | ||
@ApiProperty() | ||
events: any[]; | ||
@ApiProperty() | ||
contactPersons: ContactPerson[]; | ||
} | ||
|
||
export class ContactPerson { | ||
@ApiProperty() | ||
email: string; | ||
@ApiProperty() | ||
name: string; | ||
@ApiProperty() | ||
phone: string; | ||
@ApiProperty() | ||
role: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Controller, Get, Param } from '@nestjs/common'; | ||
import { CompetitionsService } from './competitions.service'; | ||
|
||
@Controller('competitions') | ||
export class CompetitionsController { | ||
constructor(private readonly competitionsService: CompetitionsService) {} | ||
|
||
@Get() | ||
findAll() { | ||
return null; | ||
} | ||
|
||
@Get(':id') | ||
findOne(@Param('id') id: string) { | ||
console.log(id); | ||
return null; | ||
} | ||
|
||
@Get(':id/organiser') | ||
findOrganiser(@Param('id') id: string) { | ||
console.log(id); | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { CompetitionsService } from './competitions.service'; | ||
import { CompetitionsController } from './competitions.controller'; | ||
import { GraphqlService } from 'src/graphql/graphql.service'; | ||
|
||
@Module({ | ||
controllers: [CompetitionsController], | ||
providers: [CompetitionsService, GraphqlService], | ||
}) | ||
export class CompetitionsModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
|
||
@Injectable() | ||
export class CompetitionsService { | ||
findAll() { | ||
return `This action returns all competitions`; | ||
} | ||
|
||
findOne(id: number) { | ||
return `This action returns a #${id} competition`; | ||
} | ||
|
||
remove(id: number) { | ||
return `This action removes a #${id} competition`; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Injectable, Logger, NestMiddleware } from '@nestjs/common'; | ||
import { Request, Response, NextFunction } from 'express'; | ||
|
||
@Injectable() | ||
export class LoggerMiddleware implements NestMiddleware { | ||
private logger = new Logger('HTTP'); | ||
|
||
use(request: Request, response: Response, next: NextFunction): void { | ||
const { method, originalUrl } = request; | ||
const userAgent = request.get('user-agent') || ''; | ||
|
||
response.on('finish', () => { | ||
const { statusCode } = response; | ||
const contentLength = response.get('content-length'); | ||
|
||
this.logger.log( | ||
`${method} ${originalUrl} ${statusCode} ${contentLength} - ${userAgent}`, | ||
); | ||
}); | ||
|
||
next(); | ||
} | ||
} |