mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
22 lines
767 B
TypeScript
22 lines
767 B
TypeScript
|
|
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 });
|
||
|
|
}
|
||
|
|
}
|