refactor use cases
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { UseCaseOutputPort, Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type {
|
||||
ILeagueMembershipRepository,
|
||||
} from '@core/racing/domain/repositories/ILeagueMembershipRepository';
|
||||
@@ -29,13 +29,12 @@ export class TransferLeagueOwnershipUseCase {
|
||||
private readonly leagueRepository: ILeagueRepository,
|
||||
private readonly membershipRepository: ILeagueMembershipRepository,
|
||||
private readonly logger: Logger,
|
||||
private readonly output: UseCaseOutputPort<TransferLeagueOwnershipResult>,
|
||||
) {}
|
||||
|
||||
async execute(
|
||||
input: TransferLeagueOwnershipInput,
|
||||
): Promise<
|
||||
Result<void, ApplicationErrorCode<TransferLeagueOwnershipErrorCode, { message: string }>>
|
||||
Result<TransferLeagueOwnershipResult, ApplicationErrorCode<TransferLeagueOwnershipErrorCode, { message: string }>>
|
||||
> {
|
||||
const { leagueId, currentOwnerId, newOwnerId } = input;
|
||||
|
||||
@@ -96,9 +95,7 @@ export class TransferLeagueOwnershipUseCase {
|
||||
newOwnerId,
|
||||
};
|
||||
|
||||
this.output.present(result);
|
||||
|
||||
return Result.ok(undefined);
|
||||
return Result.ok(result);
|
||||
} catch (error) {
|
||||
const message =
|
||||
error instanceof Error && error.message
|
||||
|
||||
Reference in New Issue
Block a user