ru.foodtechlab.lib.auth.service.domain.confirmationCode.config.ConfirmationCodeConfig Maven / Gradle / Ivy
package ru.foodtechlab.lib.auth.service.domain.confirmationCode.config;
import com.rcore.event.driven.EventDispatcher;
import lombok.Getter;
import lombok.experimental.Accessors;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.event.ConfirmationCodeCreatedEvent;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.event.handler.ConfirmationCodeCreatedEventHandler;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.port.ConfirmationCodeGenerator;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.port.ConfirmationCodeIdGenerator;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.port.ConfirmationCodeMessageBuilder;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.port.ConfirmationCodeRepository;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.usecases.*;
import ru.foodtechlab.lib.auth.service.domain.confirmationCodeSendingTask.usecases.CreateTaskUseCase;
import ru.foodtechlab.lib.auth.service.domain.preference.service.DefaultConfirmationCodeTypeResolver;
import ru.foodtechlab.lib.auth.service.domain.preference.usecase.GetServicePreferenceUseCase;
@Accessors(fluent = true)
@Getter
public class ConfirmationCodeConfig {
private final CreateConfirmationCodeUseCase createConfirmationCode;
private final FindConfirmationCodeByIdUseCase findConfirmationCodeById;
private final FindConfirmationCodesUseCase findConfirmationCodesUseCase;
private final ConfirmConfirmationCodeUseCase confirmConfirmationCode;
private final ExpireConfirmationCodeUseCase expireConfirmationCode;
private final InvalidateConfirmationCodeUseCase invalidateConfirmationCode;
private final CheckConfirmationCodeLimitsUseCase checkConfirmationCodeLimits;
private final FindCodeBySessionUseCase findCodeBySession;
private final ForceFindConfirmationCodeByIdUseCase forceFindConfirmationCodeByIdUseCase;
public ConfirmationCodeConfig(
ConfirmationCodeRepository confirmationCodeRepository,
ConfirmationCodeIdGenerator> confirmationCodeIdGenerator,
ConfirmationCodeGenerator confirmationCodeGenerator,
ConfirmationCodeMessageBuilder confirmationCodeMessageBuilder,
EventDispatcher eventDispatcher,
GetServicePreferenceUseCase getSettings,
DefaultConfirmationCodeTypeResolver defaultConfirmationCodeTypeResolver,
CreateTaskUseCase createTask
) {
this.checkConfirmationCodeLimits = new CheckConfirmationCodeLimitsUseCase(confirmationCodeRepository, getSettings);
this.createConfirmationCode = new CreateConfirmationCodeUseCase(
confirmationCodeRepository,
confirmationCodeIdGenerator,
confirmationCodeGenerator,
confirmationCodeMessageBuilder,
eventDispatcher,
checkConfirmationCodeLimits,
defaultConfirmationCodeTypeResolver,
getSettings
);
this.findConfirmationCodeById = new FindConfirmationCodeByIdUseCase(confirmationCodeRepository);
this.findConfirmationCodesUseCase = new FindConfirmationCodesUseCase(confirmationCodeRepository);
this.confirmConfirmationCode = new ConfirmConfirmationCodeUseCase(confirmationCodeRepository);
this.expireConfirmationCode = new ExpireConfirmationCodeUseCase(confirmationCodeRepository);
this.invalidateConfirmationCode = new InvalidateConfirmationCodeUseCase(confirmationCodeRepository);
this.findCodeBySession = new FindCodeBySessionUseCase(confirmationCodeRepository);
this.forceFindConfirmationCodeByIdUseCase = new ForceFindConfirmationCodeByIdUseCase(confirmationCodeRepository);
eventDispatcher.registerHandler(ConfirmationCodeCreatedEvent.class, new ConfirmationCodeCreatedEventHandler(createTask));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy