This commit is contained in:
@@ -51,6 +51,9 @@ public class TariffRequest {
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
|
||||
@JsonProperty("account_type")
|
||||
private String accountType;
|
||||
|
||||
@JsonProperty("page")
|
||||
private Integer page;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import ru.soune.nocopy.dto.tarriff.TariffRequest;
|
||||
import ru.soune.nocopy.dto.tarriff.TariffResponse;
|
||||
import ru.soune.nocopy.service.tariff.TariffService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@@ -52,7 +53,8 @@ public class TariffControlHandler implements RequestHandler {
|
||||
private BaseResponse handleAddTariff(BaseRequest request, TariffRequest tariffRequest) {
|
||||
tariffService.addTariff(tariffRequest.getName(), tariffRequest.getPrice(), tariffRequest.getType(),
|
||||
tariffRequest.getTokens(), tariffRequest.getDiskSize(), tariffRequest.getMaxUsers(),
|
||||
tariffRequest.getMaxFilesCount(), tariffRequest.getTariffTerm(), tariffRequest.getDescription());
|
||||
tariffRequest.getMaxFilesCount(), tariffRequest.getTariffTerm(), tariffRequest.getDescription(),
|
||||
tariffRequest.getAccountType());
|
||||
|
||||
TariffResponse tariffResponse = TariffResponse.builder()
|
||||
.tariffName(tariffRequest.getName())
|
||||
@@ -103,11 +105,9 @@ public class TariffControlHandler implements RequestHandler {
|
||||
TariffDTO tariffDTO = tariffService.updateTariff(tariffRequest.getId(), tariff, tariffRequest);
|
||||
|
||||
TariffResponse tariffResponse = TariffResponse.builder()
|
||||
.tariffName(tariffDTO.getName())
|
||||
.tariffType(tariffDTO.getType())
|
||||
.tariffs(List.of(tariffDTO))
|
||||
.build();
|
||||
|
||||
|
||||
return new BaseResponse(request.getMsgId(), MessageCode.TARIFF_IS_UPDATED.getCode(),
|
||||
MessageCode.TARIFF_IS_UPDATED.getDescription(),
|
||||
tariffResponse);
|
||||
|
||||
@@ -65,7 +65,8 @@ public class TariffHandler implements RequestHandler {
|
||||
private BaseResponse handleAddTariff(BaseRequest request, TariffRequest tariffRequest) {
|
||||
tariffService.addTariff(tariffRequest.getName(), tariffRequest.getPrice(), tariffRequest.getType(),
|
||||
tariffRequest.getTokens(), tariffRequest.getDiskSize(), tariffRequest.getMaxUsers(),
|
||||
tariffRequest.getMaxFilesCount(), tariffRequest.getTariffTerm(), tariffRequest.getDescription());
|
||||
tariffRequest.getMaxFilesCount(), tariffRequest.getTariffTerm(), tariffRequest.getDescription(),
|
||||
tariffRequest.getAccountType());
|
||||
|
||||
TariffResponse tariffResponse = TariffResponse.builder()
|
||||
.tariffName(tariffRequest.getName())
|
||||
|
||||
@@ -27,7 +27,7 @@ public class TariffService {
|
||||
private final TariffInfoRepository tariffInfoRepository;
|
||||
|
||||
public void addTariff(String tariffName, double price, String type, int tokens, long diskSize, long maxUsers,
|
||||
int maxFilesCount, String tariffTerm, String description) {
|
||||
int maxFilesCount, String tariffTerm, String description, String accountType) {
|
||||
Tariff tariff = new Tariff();
|
||||
tariff.setName(tariffName);
|
||||
tariff.setPrice(price);
|
||||
@@ -38,6 +38,7 @@ public class TariffService {
|
||||
tariff.setMaxFilesCount(maxFilesCount);
|
||||
tariff.setTariffTerm(TariffTimeTerm.valueOf(tariffTerm.toUpperCase()));
|
||||
tariff.setDescription(description);
|
||||
tariff.setTariffAccountType(accountType);
|
||||
|
||||
tariffRepository.save(tariff);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user