Files
bidding_watcher/src/bids/controllers/bid.controller.ts

44 lines
1.1 KiB
TypeScript
Raw Normal View History

import { Controller, Get, Query, Patch, Param, Body } from '@nestjs/common';
2026-01-09 23:18:52 +08:00
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);
}
2026-01-09 23:18:52 +08:00
}