diff --git a/app/Store/SessionStore.ts b/app/Store/SessionStore.ts index 6510075..37c2c07 100644 --- a/app/Store/SessionStore.ts +++ b/app/Store/SessionStore.ts @@ -56,7 +56,6 @@ class RedisSessionStore { public async getSessions(): Promise> { const keys = await this.scanSessionKeys(); const commands = Array.from(keys).map(key => { - // eslint-disable-next-line @typescript-eslint/no-unused-vars const [, ...id] = key.split('-'); return ['hmget', id.join('-'), 'userId', 'userName', 'connected']; }); @@ -64,7 +63,10 @@ class RedisSessionStore { return this.redisClient .multi(commands) .exec() - .then(results => results.map(([err, session]) => (err ? undefined : this.transform(session)))); + .then(results => { + if (results === null) return []; + return results.map(([err, session]: [Error, (string | null)[]]) => (err ? undefined : this.transform(session))); + }); } /** diff --git a/app/Validators/User/UpdateUserInfoValidator.ts b/app/Validators/User/UpdateUserInfoValidator.ts index 762ad17..adccf78 100644 --- a/app/Validators/User/UpdateUserInfoValidator.ts +++ b/app/Validators/User/UpdateUserInfoValidator.ts @@ -7,7 +7,7 @@ export default class UpdateUserInfoValidator { public schema = schema.create({ about: schema.string.nullableAndOptional(), phone_number: schema.string.nullableAndOptional({}, [ - rules.mobile({ locales: ['ru-RU', 'en-US'], strict: true }), + rules.mobile({ locale: ['ru-RU', 'en-US'], strict: true }), rules.unique({ table: 'contacts', column: 'phone_number' }), ]), vk_id: schema.string.nullableAndOptional({}, [ diff --git a/database/factories/index.ts b/database/factories/index.ts index a602976..e7a965e 100644 --- a/database/factories/index.ts +++ b/database/factories/index.ts @@ -1,4 +1,4 @@ -import Factory from '@ioc:Adonis/Lucid/Factory'; +import Factory, { FactoryContextContract } from '@ioc:Adonis/Lucid/Factory'; import { string } from '@ioc:Adonis/Core/Helpers'; /** @@ -18,7 +18,7 @@ import Role from 'App/Models/Role'; import User from 'App/Models/User'; import { DateTime } from 'luxon'; -const makeFakeUser = (faker: Faker.FakerStatic, loginPrefix?: string) => { +const makeFakeUser = (faker: FactoryContextContract['faker'], loginPrefix?: string) => { return { first_name: faker.name.firstName(), last_name: faker.name.lastName(),