fix: fixed ts types

This commit is contained in:
Sergey Yarkov 2022-06-06 23:24:25 +03:00
parent 303a27089b
commit ff97175fbe
3 changed files with 7 additions and 5 deletions

View File

@ -56,7 +56,6 @@ class RedisSessionStore {
public async getSessions(): Promise<Array<SessionDataType | undefined>> {
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)));
});
}
/**

View File

@ -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({}, [

View File

@ -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(),