Compare commits

...

3 Commits

Author SHA1 Message Date
Balu Babu
ab495177da chore: changed file import size limit to 10mb 2024-03-19 17:09:35 +05:30
Balu Babu
a3e6bae032 chore: changed target of hopp-old-backend service to prod 2024-03-19 17:09:35 +05:30
Balu Babu
1b19b8aed5 refactor: modified title search to be a query param 2024-03-19 17:09:35 +05:30
2 changed files with 25 additions and 26 deletions

View File

@@ -13,7 +13,7 @@ import { throwHTTPErr } from 'src/utils';
export class TeamCollectionController {
constructor(private readonly teamCollectionService: TeamCollectionService) {}
@Get('search/:teamID/:searchQuery')
@Get('search/:teamID')
@RequiresTeamRole(
TeamMemberRole.VIEWER,
TeamMemberRole.EDITOR,
@@ -21,7 +21,7 @@ export class TeamCollectionController {
)
@UseGuards(JwtAuthGuard, RESTTeamMemberGuard)
async searchByTitle(
@Param('searchQuery') searchQuery: string,
@Query('searchQuery') searchQuery: string,
@Param('teamID') teamID: string,
@Query('take') take: string,
@Query('skip') skip: string,

View File

@@ -261,29 +261,28 @@ export function checkEnvironmentAuthProvider(
* Source: https://stackoverflow.com/a/32648526
*/
export function escapeSqlLikeString(str: string) {
if (typeof str != 'string')
return str;
if (typeof str != 'string') return str;
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
switch (char) {
case "\0":
return "\\0";
case "\x08":
return "\\b";
case "\x09":
return "\\t";
case "\x1a":
return "\\z";
case "\n":
return "\\n";
case "\r":
return "\\r";
case "\"":
case "'":
case "\\":
case "%":
return "\\"+char; // prepends a backslash to backslash, percent,
// and double/single quotes
}
});
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, function (char) {
switch (char) {
case '\0':
return '\\0';
case '\x08':
return '\\b';
case '\x09':
return '\\t';
case '\x1a':
return '\\z';
case '\n':
return '\\n';
case '\r':
return '\\r';
case '"':
case "'":
case '\\':
case '%':
return '\\' + char; // prepends a backslash to backslash, percent,
// and double/single quotes
}
});
}