44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { Controller, Get, Query, Patch, Param, Body } from '@nestjs/common';
|
|
import { BidsService } from '../services/bid.service';
|
|
|
|
@Controller('api/bids')
|
|
export class BidsController {
|
|
constructor(private readonly bidsService: BidsService) {}
|
|
|
|
@Get()
|
|
findAll(@Query() query: any) {
|
|
return this.bidsService.findAll(query);
|
|
}
|
|
|
|
@Get('recent')
|
|
getRecent() {
|
|
return this.bidsService.getRecentBids();
|
|
}
|
|
|
|
@Get('pinned')
|
|
getPinned() {
|
|
return this.bidsService.getPinnedBids();
|
|
}
|
|
|
|
@Get('sources')
|
|
getSources() {
|
|
return this.bidsService.getSources();
|
|
}
|
|
|
|
@Get('by-date-range')
|
|
getByDateRange(@Query('startDate') startDate: string, @Query('endDate') endDate?: string, @Query('keywords') keywords?: string) {
|
|
const keywordsArray = keywords ? keywords.split(',') : undefined;
|
|
return this.bidsService.getBidsByDateRange(startDate, endDate, keywordsArray);
|
|
}
|
|
|
|
@Get('crawl-info-stats')
|
|
getCrawlInfoStats() {
|
|
return this.bidsService.getCrawlInfoAddStats();
|
|
}
|
|
|
|
@Patch(':title/pin')
|
|
updatePin(@Param('title') title: string, @Body() body: { pin: boolean }) {
|
|
return this.bidsService.updatePin(title, body.pin);
|
|
}
|
|
}
|