mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: feedback udaptes
This commit is contained in:
@@ -21,7 +21,7 @@ import { PluginType } from '@/plugins/types';
|
||||
import { Settings } from '@/setting/schemas/types';
|
||||
import { SettingService } from '@/setting/services/setting.service';
|
||||
import { BaseService } from '@/utils/generics/base-service';
|
||||
import { getRadom } from '@/utils/helpers/safeRandom';
|
||||
import { getRandom } from '@/utils/helpers/safeRandom';
|
||||
|
||||
import { BlockRepository } from '../repositories/block.repository';
|
||||
import { Block, BlockFull, BlockPopulate } from '../schemas/block.schema';
|
||||
@@ -395,7 +395,7 @@ export class BlockService extends BaseService<Block, BlockPopulate, BlockFull> {
|
||||
*/
|
||||
getRandom<T>(array: T[]): T {
|
||||
return Array.isArray(array)
|
||||
? array[Math.floor(getRadom() * array.length)]
|
||||
? array[Math.floor(getRandom() * array.length)]
|
||||
: array;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import { LanguageModel } from '@/i18n/schemas/language.schema';
|
||||
import { I18nService } from '@/i18n/services/i18n.service';
|
||||
import { LanguageService } from '@/i18n/services/language.service';
|
||||
import { LoggerService } from '@/logger/logger.service';
|
||||
import { getRadom } from '@/utils/helpers/safeRandom';
|
||||
import { getRandom } from '@/utils/helpers/safeRandom';
|
||||
import { installUserFixtures } from '@/utils/test/fixtures/user';
|
||||
import {
|
||||
closeInMongodConnection,
|
||||
@@ -127,7 +127,7 @@ describe('AuthController', () => {
|
||||
role = await roleService.findOne({});
|
||||
baseUser = {
|
||||
email: 'test@testing.com',
|
||||
password: getRadom().toString(),
|
||||
password: getRandom().toString(),
|
||||
username: 'test',
|
||||
first_name: 'test',
|
||||
last_name: 'test',
|
||||
|
||||
@@ -12,5 +12,5 @@ import crypto from 'crypto';
|
||||
*
|
||||
* @returns A cryptographically secure random value between 0 and 1
|
||||
*/
|
||||
export const getRadom = (): number =>
|
||||
export const getRandom = (): number =>
|
||||
crypto.getRandomValues(new Uint32Array(1))[0] / 2 ** 32;
|
||||
|
||||
Reference in New Issue
Block a user