fix bcrypt crashing on v5.1.1

This commit is contained in:
sbriat 2023-10-17 16:13:39 +02:00
parent 03f328b922
commit 5e69f1fd18
6 changed files with 927 additions and 1770 deletions

View File

@ -11,5 +11,5 @@ MESSAGE_BROKER_URI=amqp://v3-broker:5672
MESSAGE_BROKER_EXCHANGE=mobicoop
# OPA
OPA_IMAGE=openpolicyagent/opa:0.54.0
OPA_IMAGE=openpolicyagent/opa:0.57.0
OPA_URL=http://v3-auth-opa:8181/v1/data/

2670
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -47,7 +47,7 @@
"@nestjs/terminus": "^10.1.1",
"@prisma/client": "^5.4.2",
"axios": "^1.5.1",
"bcrypt": "^5.1.1",
"bcrypt": "5.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"reflect-metadata": "^0.1.13",

View File

@ -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;
};

View File

@ -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);

View File

@ -23,7 +23,7 @@ export type AuthenticationReadModel = AuthenticationBaseModel & {
};
export type AuthenticationWriteModel = AuthenticationBaseModel & {
usernames: {
usernames?: {
create: UsernameModel[];
};
};