Add parkio
This commit is contained in:
33
src/parkio/parkio.controller.ts
Normal file
33
src/parkio/parkio.controller.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Controller, Get, Param } from '@nestjs/common';
|
||||
import { ParkioService } from './parkio.service';
|
||||
|
||||
@Controller('parkio')
|
||||
export class ParkioController {
|
||||
constructor(
|
||||
private readonly parkioService: ParkioService
|
||||
) {}
|
||||
|
||||
@Get('auctions')
|
||||
async getAuctions () {
|
||||
return this.parkioService.fetchAuctions();
|
||||
}
|
||||
|
||||
@Get('domains')
|
||||
async getDomains () {
|
||||
return this.parkioService.fetchAllDomains();
|
||||
}
|
||||
|
||||
@Get('short/:maxLength')
|
||||
async getShort (@Param('maxLength') maxLength: number) {
|
||||
return {
|
||||
maxLength,
|
||||
domains: (await this.parkioService.fetchAllDomains()).filter(
|
||||
parsedDomain => parsedDomain.domain_length <= maxLength
|
||||
),
|
||||
auctions: (await this.parkioService.fetchAuctions()).filter(
|
||||
parsedAuction => parsedAuction.domain_length <= maxLength
|
||||
),
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user