@@ -88,13 +88,6 @@ public class TariffInitializationService {
|
||||
|
||||
if (existingTariffs.isEmpty()) {
|
||||
createDefaultTariffs();
|
||||
} else {
|
||||
Map<TariffType, Boolean> existingTypes = new HashMap<>();
|
||||
existingTariffs.forEach(tariff -> existingTypes.put(TariffType.valueOf(tariff.getType()), true));
|
||||
|
||||
Arrays.stream(TariffType.values())
|
||||
.filter(type -> !existingTypes.containsKey(type))
|
||||
.forEach(this::createDefaultTariff);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ public class TariffService {
|
||||
|
||||
private final TariffRepository tariffRepository;
|
||||
|
||||
public Tariff addTariff(String tariffName, double price, String type, int tokens, long diskSize, long maxUsers,
|
||||
int maxFilesCount) {
|
||||
public void addTariff(String tariffName, double price, String type, int tokens, long diskSize, long maxUsers,
|
||||
int maxFilesCount) {
|
||||
Tariff tariff = new Tariff();
|
||||
tariff.setName(tariffName);
|
||||
tariff.setPrice(price);
|
||||
@@ -29,7 +29,7 @@ public class TariffService {
|
||||
tariff.setMaxUsers(maxUsers);
|
||||
tariff.setMaxFilesCount(maxFilesCount);
|
||||
|
||||
return tariffRepository.save(tariff);
|
||||
tariffRepository.save(tariff);
|
||||
}
|
||||
|
||||
public List<TariffDTO> getAllTariffs() {
|
||||
|
||||
Reference in New Issue
Block a user