feat: cookie maxAge increase & added search param to users fetch

This commit is contained in:
Sergey Yarkov 2021-09-18 18:57:55 +03:00
parent 417d236cbb
commit 8a45389d0d
2 changed files with 9 additions and 2 deletions

View File

@ -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}%`));
}

View File

@ -104,7 +104,7 @@ export const http: ServerConfig = {
cookie: {
domain: '',
path: '/',
maxAge: '2h',
maxAge: '1d',
httpOnly: true,
secure: false,
sameSite: false,