All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ru.foodtechlab.lib.auth.service.domain.confirmationCode.usecases.CheckConfirmationCodeLimitsUseCase Maven / Gradle / Ivy

There is a newer version: 4.1.0
Show newest version
package ru.foodtechlab.lib.auth.service.domain.confirmationCode.usecases;

import com.rcore.domain.commons.usecase.UseCase;
import com.rcore.domain.commons.usecase.model.VoidInputValues;
import com.rcore.domain.commons.usecase.model.VoidOutputValues;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import ru.foodtechlab.lib.auth.service.domain.auth.entity.AuthSessionEntity;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.entity.ConfirmationCodeEntity;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.port.ConfirmationCodeRepository;
import ru.foodtechlab.lib.auth.service.domain.preference.usecase.GetServicePreferenceUseCase;

@RequiredArgsConstructor
public class CheckConfirmationCodeLimitsUseCase extends UseCase {

    //TODO При проверке лимита нужно искать по deviceTOken или только по loginDetails
    private final ConfirmationCodeRepository confirmationCodeRepository;
    private final GetServicePreferenceUseCase getSettings;

    @Override
    public VoidOutputValues execute(InputValues inputValues) {

        var settings = getSettings.execute(new VoidInputValues()).getValue();

        var limit = settings.getConfirmationCodeLimit(inputValues.getConfirmationCodeType(), inputValues.getLoginType());
        return new VoidOutputValues();
    }

    @Value(staticConstructor = "of")
    public static class InputValues implements UseCase.InputValues {
        ConfirmationCodeEntity.Type confirmationCodeType;
        AuthSessionEntity.LoginType loginType;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy