mirror of
https://github.com/apricote/Listory.git
synced 2026-02-07 02:07:03 +00:00
feat(api): add listen report endpoint
This commit is contained in:
parent
ddcdfff89b
commit
3828b841c2
9 changed files with 179 additions and 0 deletions
21
src/reports/reports.controller.ts
Normal file
21
src/reports/reports.controller.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import { Controller, Get, Query } from "@nestjs/common";
|
||||
import { Auth } from "src/auth/decorators/auth.decorator";
|
||||
import { ReqUser } from "../auth/decorators/req-user.decorator";
|
||||
import { User } from "../users/user.entity";
|
||||
import { GetListenReportDto } from "./dto/get-listen-report.dto";
|
||||
import { ListenReportDto } from "./dto/listen-report.dto";
|
||||
import { ReportsService } from "./reports.service";
|
||||
|
||||
@Controller("api/v1/reports")
|
||||
export class ReportsController {
|
||||
constructor(private readonly reportsService: ReportsService) {}
|
||||
|
||||
@Get("listens")
|
||||
@Auth()
|
||||
async getListens(
|
||||
@Query() options: Omit<GetListenReportDto, "user">,
|
||||
@ReqUser() user: User
|
||||
): Promise<ListenReportDto> {
|
||||
return this.reportsService.getListens({ ...options, user });
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue