This commit is contained in:
Gsk54 2023-01-16 16:21:24 +01:00
parent 6802cd3620
commit d5be05585d
4 changed files with 19 additions and 17 deletions

View File

@ -1,4 +1,4 @@
package user1
package user.me
default allow := false

View File

@ -1,4 +1,4 @@
package user2
package user.list
default allow := false

View File

@ -14,7 +14,7 @@ export class AuthenticationMessagerController {
@RabbitSubscribe({
exchange: 'user',
routingKey: 'update',
queue: 'auth-user-update',
queue: 'authentication-user-update',
})
public async userUpdatedHandler(message: string) {
const updatedUser = JSON.parse(message);
@ -42,15 +42,15 @@ export class AuthenticationMessagerController {
@RabbitSubscribe({
exchange: 'user',
routingKey: 'delete',
queue: 'auth-user-delete',
queue: 'authentication-user-delete',
})
public async userDeletedHandler(message: string) {
const deletedUser = JSON.parse(message);
if (!deletedUser.hasOwnProperty('uuid')) throw new Error();
const deleteAuthRequest = new DeleteAuthenticationRequest();
deleteAuthRequest.uuid = deletedUser.uuid;
const deleteAuthenticationRequest = new DeleteAuthenticationRequest();
deleteAuthenticationRequest.uuid = deletedUser.uuid;
await this._commandBus.execute(
new DeleteAuthenticationCommand(deleteAuthRequest),
new DeleteAuthenticationCommand(deleteAuthenticationRequest),
);
}
}

View File

@ -16,7 +16,7 @@ import { DeleteAuthenticationRequest } from '../../domain/dtos/delete-authentica
import { DeleteUsernameRequest } from '../../domain/dtos/delete-username.request';
import { UpdatePasswordRequest } from '../../domain/dtos/update-password.request';
import { UpdateUsernameRequest } from '../../domain/dtos/update-username.request';
import { ValidateAuthRequest } from '../../domain/dtos/validate-authentication.request';
import { ValidateAuthenticationRequest } from '../../domain/dtos/validate-authentication.request';
import { Authentication } from '../../domain/entities/authentication';
import { Username } from '../../domain/entities/username';
import { ValidateAuthenticationQuery } from '../../queries/validate-authentication.query';
@ -38,8 +38,10 @@ export class AuthenticationController {
@InjectMapper() private readonly _mapper: Mapper,
) {}
@GrpcMethod('AuthService', 'Validate')
async validate(data: ValidateAuthRequest): Promise<AuthenticationPresenter> {
@GrpcMethod('AuthenticationService', 'Validate')
async validate(
data: ValidateAuthenticationRequest,
): Promise<AuthenticationPresenter> {
try {
const auth: Authentication = await this._queryBus.execute(
new ValidateAuthenticationQuery(data.username, data.password),
@ -53,7 +55,7 @@ export class AuthenticationController {
}
}
@GrpcMethod('AuthService', 'Create')
@GrpcMethod('AuthenticationService', 'Create')
async createUser(
data: CreateAuthenticationRequest,
): Promise<AuthenticationPresenter> {
@ -78,7 +80,7 @@ export class AuthenticationController {
}
}
@GrpcMethod('AuthService', 'AddUsername')
@GrpcMethod('AuthenticationService', 'AddUsername')
async addUsername(data: AddUsernameRequest): Promise<UsernamePresenter> {
try {
const username: Username = await this._commandBus.execute(
@ -102,7 +104,7 @@ export class AuthenticationController {
}
}
@GrpcMethod('AuthService', 'UpdateUsername')
@GrpcMethod('AuthenticationService', 'UpdateUsername')
async updateUsername(
data: UpdateUsernameRequest,
): Promise<UsernamePresenter> {
@ -128,7 +130,7 @@ export class AuthenticationController {
}
}
@GrpcMethod('AuthService', 'UpdatePassword')
@GrpcMethod('AuthenticationService', 'UpdatePassword')
async updatePassword(
data: UpdatePasswordRequest,
): Promise<AuthenticationPresenter> {
@ -146,7 +148,7 @@ export class AuthenticationController {
}
}
@GrpcMethod('AuthService', 'DeleteUsername')
@GrpcMethod('AuthenticationService', 'DeleteUsername')
async deleteUsername(data: DeleteUsernameRequest) {
try {
return await this._commandBus.execute(new DeleteUsernameCommand(data));
@ -158,8 +160,8 @@ export class AuthenticationController {
}
}
@GrpcMethod('AuthService', 'Delete')
async deleteAuth(data: DeleteAuthenticationRequest) {
@GrpcMethod('AuthenticationService', 'Delete')
async deleteAuthentication(data: DeleteAuthenticationRequest) {
try {
return await this._commandBus.execute(
new DeleteAuthenticationCommand(data),