save dev
This commit is contained in:
@@ -16,11 +16,6 @@ export class SearchController {
|
||||
return this.searchService.getHello();
|
||||
}
|
||||
|
||||
// @Get('/all')
|
||||
// findall(): Promise<Song[] | null> {
|
||||
// return this.songService.songs();
|
||||
// }
|
||||
|
||||
@Get()
|
||||
async findAll(
|
||||
@Req() req: Request,
|
||||
@@ -46,10 +41,10 @@ export class SearchController {
|
||||
|
||||
@Get('/title/:name')
|
||||
async findByName(@Param('name') name: string): Promise<Song> {
|
||||
// const ret = await this.searchService.songByTitle({ name })
|
||||
// if (!ret) throw new NotFoundException();
|
||||
const ret = await this.searchService.songByTitle({ name })
|
||||
if (!ret) throw new NotFoundException();
|
||||
throw new NotFoundException();
|
||||
// return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Get('/advanced')
|
||||
|
||||
@@ -5,18 +5,15 @@ import { PrismaService } from 'src/prisma/prisma.service';
|
||||
@Injectable()
|
||||
export class SearchService {
|
||||
constructor(private prisma: PrismaService) {}
|
||||
// async songByTitle(songWhereUniqueInput: Prisma.SongWhereUniqueInput): Promise<Song | null> {
|
||||
// // return this.prisma.song.findUnique({
|
||||
// // where: songWhereUniqueInput,
|
||||
// // });
|
||||
// return this.prisma.song.findMany({
|
||||
// where:
|
||||
// })
|
||||
// }
|
||||
async songByTitle(songWhereUniqueInput: Prisma.SongWhereUniqueInput): Promise<Song | null> {
|
||||
return this.prisma.song.findUnique({
|
||||
where: songWhereUniqueInput,
|
||||
});
|
||||
}
|
||||
|
||||
// async all(): Promise<Song[] | null> {
|
||||
// return this.prisma.song.findMany
|
||||
// }
|
||||
async all(): Promise<Song[] | null> {
|
||||
return this.prisma.song.findMany
|
||||
}
|
||||
|
||||
getHello(): string {
|
||||
return 'Hello World!';
|
||||
|
||||
Reference in New Issue
Block a user