Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions platforms/pictique-api/src/controllers/UserController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ export class UserController {
}

// Validate search query length
if (q.trim().length < 2) {
if (q.trim().length < 1) {
return res
.status(400)
.json({ error: "Search query must be at least 2 characters long" });
.json({ error: "Search query cannot be empty" });
}

// Parse and validate pagination parameters
Expand Down Expand Up @@ -120,10 +120,10 @@ export class UserController {
}

// Validate search query length
if (q.trim().length < 2) {
if (q.trim().length < 1) {
return res
.status(400)
.json({ error: "Search query must be at least 2 characters long" });
.json({ error: "Search query cannot be empty" });
}

// Parse and validate pagination parameters
Expand Down
18 changes: 9 additions & 9 deletions platforms/pictique-api/src/services/UserService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export class UserService {
// Sanitize and trim the search query
const searchQuery = query.trim();

// Return empty array if query is too short or empty
if (searchQuery.length < 2) {
// Return empty array if query is empty
if (searchQuery.length < 1) {
return [];
}

Expand Down Expand Up @@ -156,8 +156,8 @@ export class UserService {
// Sanitize and trim the search query
const searchQuery = query.trim();

// Return 0 if query is too short or empty
if (searchQuery.length < 2) {
// Return 0 if query is empty
if (searchQuery.length < 1 ) {
return 0;
}

Expand Down Expand Up @@ -188,7 +188,7 @@ export class UserService {
// Sanitize and trim the search query
const searchQuery = query.trim();

// Return empty array if query is too short
// Return empty array if query is empty
if (searchQuery.length < 1) {
return [];
}
Expand Down Expand Up @@ -240,8 +240,8 @@ export class UserService {
// Sanitize and trim the search query
const searchQuery = query.trim();

// Return empty array if query is too short or empty
if (searchQuery.length < 2) {
// Return empty array if query is empty
if (searchQuery.length < 1) {
return [];
}

Expand Down Expand Up @@ -306,8 +306,8 @@ export class UserService {
// Sanitize and trim the search query
const searchQuery = query.trim();

// Return 0 if query is too short or empty
if (searchQuery.length < 2) {
// Return 0 if query is empty
if (searchQuery.length < 1 ) {
return 0;
}

Expand Down