diff --git a/app/Repositories/UserRepository.ts b/app/Repositories/UserRepository.ts index 8d70a41..8183deb 100644 --- a/app/Repositories/UserRepository.ts +++ b/app/Repositories/UserRepository.ts @@ -64,10 +64,17 @@ export default class UserRepository { * @returns Array of users */ public async getAll(params?: any) { - const { email, login, first_name, last_name, role, page = 1, limit = 10 }: any = params || {}; + const { search, email, login, first_name, last_name, role, page = 1, limit = 10 }: any = params || {}; const query = this.User.query(); + if (search) { + query + .where('first_name', 'ilike', `%${search}%`) + .orWhere('last_name', 'ilike', `%${search}%`) + .orWhere('email', 'ilike', `%${search}%`); + } + if (email) { query.preload('contacts').whereHas('contacts', q => q.where('email', 'like', `%${email}%`)); } diff --git a/config/app.ts b/config/app.ts index 63a2f08..650224d 100644 --- a/config/app.ts +++ b/config/app.ts @@ -104,7 +104,7 @@ export const http: ServerConfig = { cookie: { domain: '', path: '/', - maxAge: '2h', + maxAge: '1d', httpOnly: true, secure: false, sameSite: false,