mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-01-11 22:02:39 +00:00
fix bcrypt crashing on v5.1.1
This commit is contained in:
@@ -31,12 +31,14 @@ export class AuthenticationMapper
|
||||
const record: AuthenticationWriteModel = {
|
||||
uuid: copy.id,
|
||||
password: copy.password,
|
||||
usernames: {
|
||||
create: copy.usernames.map((username: UsernameProps) => ({
|
||||
username: username.name,
|
||||
type: username.type,
|
||||
})),
|
||||
},
|
||||
usernames: copy.usernames
|
||||
? {
|
||||
create: copy.usernames.map((username: UsernameProps) => ({
|
||||
username: username.name,
|
||||
type: username.type,
|
||||
})),
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
return record;
|
||||
};
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
AuthenticationAlreadyExistsException,
|
||||
UsernameAlreadyExistsException,
|
||||
} from '@modules/authentication/core/domain/authentication.errors';
|
||||
import { Username } from '../../types/username';
|
||||
|
||||
@CommandHandler(CreateAuthenticationCommand)
|
||||
export class CreateAuthenticationService implements ICommandHandler {
|
||||
@@ -27,11 +26,7 @@ export class CreateAuthenticationService implements ICommandHandler {
|
||||
await AuthenticationEntity.create({
|
||||
userId: command.userId,
|
||||
password: command.password,
|
||||
usernames: command.usernames.map((username: Username) => ({
|
||||
name: username.name,
|
||||
type: username.type,
|
||||
userId: command.userId,
|
||||
})),
|
||||
usernames: command.usernames,
|
||||
});
|
||||
try {
|
||||
await this.authenticationRepository.insert(authentication);
|
||||
|
||||
@@ -23,7 +23,7 @@ export type AuthenticationReadModel = AuthenticationBaseModel & {
|
||||
};
|
||||
|
||||
export type AuthenticationWriteModel = AuthenticationBaseModel & {
|
||||
usernames: {
|
||||
usernames?: {
|
||||
create: UsernameModel[];
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user