refactor: modified title search to be a query param
This commit is contained in:
@@ -112,7 +112,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
dockerfile: packages/hoppscotch-backend/Dockerfile
|
dockerfile: packages/hoppscotch-backend/Dockerfile
|
||||||
context: .
|
context: .
|
||||||
target: prod
|
target: dev
|
||||||
env_file:
|
env_file:
|
||||||
- ./.env
|
- ./.env
|
||||||
restart: always
|
restart: always
|
||||||
@@ -122,7 +122,7 @@ services:
|
|||||||
- PORT=3000
|
- PORT=3000
|
||||||
volumes:
|
volumes:
|
||||||
# Uncomment the line below when modifying code. Only applicable when using the "dev" target.
|
# Uncomment the line below when modifying code. Only applicable when using the "dev" target.
|
||||||
# - ./packages/hoppscotch-backend/:/usr/src/app
|
- ./packages/hoppscotch-backend/:/usr/src/app
|
||||||
- /usr/src/app/node_modules/
|
- /usr/src/app/node_modules/
|
||||||
depends_on:
|
depends_on:
|
||||||
hoppscotch-db:
|
hoppscotch-db:
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { throwHTTPErr } from 'src/utils';
|
|||||||
export class TeamCollectionController {
|
export class TeamCollectionController {
|
||||||
constructor(private readonly teamCollectionService: TeamCollectionService) {}
|
constructor(private readonly teamCollectionService: TeamCollectionService) {}
|
||||||
|
|
||||||
@Get('search/:teamID/:searchQuery')
|
@Get('search/:teamID')
|
||||||
@RequiresTeamRole(
|
@RequiresTeamRole(
|
||||||
TeamMemberRole.VIEWER,
|
TeamMemberRole.VIEWER,
|
||||||
TeamMemberRole.EDITOR,
|
TeamMemberRole.EDITOR,
|
||||||
@@ -21,11 +21,12 @@ export class TeamCollectionController {
|
|||||||
)
|
)
|
||||||
@UseGuards(JwtAuthGuard, RESTTeamMemberGuard)
|
@UseGuards(JwtAuthGuard, RESTTeamMemberGuard)
|
||||||
async searchByTitle(
|
async searchByTitle(
|
||||||
@Param('searchQuery') searchQuery: string,
|
@Query('searchQuery') searchQuery: string,
|
||||||
@Param('teamID') teamID: string,
|
@Param('teamID') teamID: string,
|
||||||
@Query('take') take: string,
|
@Query('take') take: string,
|
||||||
@Query('skip') skip: string,
|
@Query('skip') skip: string,
|
||||||
) {
|
) {
|
||||||
|
console.log('searchQuery', searchQuery);
|
||||||
const res = await this.teamCollectionService.searchByTitle(
|
const res = await this.teamCollectionService.searchByTitle(
|
||||||
searchQuery,
|
searchQuery,
|
||||||
teamID,
|
teamID,
|
||||||
|
|||||||
@@ -261,29 +261,28 @@ export function checkEnvironmentAuthProvider(
|
|||||||
* Source: https://stackoverflow.com/a/32648526
|
* Source: https://stackoverflow.com/a/32648526
|
||||||
*/
|
*/
|
||||||
export function escapeSqlLikeString(str: string) {
|
export function escapeSqlLikeString(str: string) {
|
||||||
if (typeof str != 'string')
|
if (typeof str != 'string') return str;
|
||||||
return str;
|
|
||||||
|
|
||||||
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
|
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
|
||||||
switch (char) {
|
switch (char) {
|
||||||
case "\0":
|
case '\0':
|
||||||
return "\\0";
|
return '\\0';
|
||||||
case "\x08":
|
case '\x08':
|
||||||
return "\\b";
|
return '\\b';
|
||||||
case "\x09":
|
case '\x09':
|
||||||
return "\\t";
|
return '\\t';
|
||||||
case "\x1a":
|
case '\x1a':
|
||||||
return "\\z";
|
return '\\z';
|
||||||
case "\n":
|
case '\n':
|
||||||
return "\\n";
|
return '\\n';
|
||||||
case "\r":
|
case '\r':
|
||||||
return "\\r";
|
return '\\r';
|
||||||
case "\"":
|
case '"':
|
||||||
case "'":
|
case "'":
|
||||||
case "\\":
|
case '\\':
|
||||||
case "%":
|
case '%':
|
||||||
return "\\"+char; // prepends a backslash to backslash, percent,
|
return '\\' + char; // prepends a backslash to backslash, percent,
|
||||||
// and double/single quotes
|
// and double/single quotes
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ defineProps<{
|
|||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
const ALLOWED_FILE_SIZE_LIMIT = 10 // 10 MB
|
const ALLOWED_FILE_SIZE_LIMIT = 100 // 10 MB
|
||||||
|
|
||||||
const importFilesCount = ref(0)
|
const importFilesCount = ref(0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user