-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added: Search API for Tags and Body (#8)
- Loading branch information
1 parent
c7a28d5
commit d778fd1
Showing
7 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.DS_Store | ||
pgdata | ||
dist | ||
dist | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import { SearchController } from './search.controller'; | ||
|
||
describe('SearchController', () => { | ||
let controller: SearchController; | ||
|
||
beforeEach(async () => { | ||
const module: TestingModule = await Test.createTestingModule({ | ||
controllers: [SearchController], | ||
}).compile(); | ||
|
||
controller = module.get<SearchController>(SearchController); | ||
}); | ||
|
||
it('should be defined', () => { | ||
expect(controller).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable prettier/prettier */ | ||
import { Controller, Get, Query } from '@nestjs/common'; | ||
import { Template } from '@prisma/client'; | ||
import { TemplateService } from '../template/template.service'; | ||
|
||
@Controller('search') | ||
export class SearchController { | ||
constructor( | ||
private readonly templateService: TemplateService, | ||
){} | ||
|
||
@Get('tag') | ||
async searchTag(@Query() queryString: string): Promise<Template[]>{ | ||
return this.templateService.searchTag(queryString); | ||
} | ||
|
||
@Get('body') | ||
async searchTemplateBody(@Query() queryString: string): Promise<Template[]>{ | ||
return this.templateService.searchBody(queryString); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters