This commit is contained in:
@@ -17,4 +17,5 @@ public class TariffDTO {
|
||||
private Long diskSize;
|
||||
private Long maxUsers;
|
||||
private String tariffTerm;
|
||||
private String description;
|
||||
}
|
||||
|
||||
@@ -52,4 +52,7 @@ public class TariffRequest {
|
||||
|
||||
@JsonProperty("tariff_term")
|
||||
private String tariffTerm;
|
||||
|
||||
@JsonProperty("description")
|
||||
private String description;
|
||||
}
|
||||
@@ -41,6 +41,9 @@ public class Tariff {
|
||||
@Column(name = "tariffAccountType")
|
||||
private String tariffAccountType;
|
||||
|
||||
@Column(name = "description", columnDefinition = "TEXT")
|
||||
private String description;
|
||||
|
||||
@Column(name = "tariff_term")
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TariffTimeTerm tariffTerm;
|
||||
|
||||
@@ -65,7 +65,7 @@ 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.getMaxFilesCount(), tariffRequest.getTariffTerm(), tariffRequest.getDescription());
|
||||
|
||||
TariffResponse tariffResponse = TariffResponse.builder()
|
||||
.tariffName(tariffRequest.getName())
|
||||
|
||||
@@ -21,7 +21,7 @@ public class TariffService {
|
||||
private final TariffRepository tariffRepository;
|
||||
|
||||
public void addTariff(String tariffName, double price, String type, int tokens, long diskSize, long maxUsers,
|
||||
int maxFilesCount, String tariffTerm) {
|
||||
int maxFilesCount, String tariffTerm, String description) {
|
||||
Tariff tariff = new Tariff();
|
||||
tariff.setName(tariffName);
|
||||
tariff.setPrice(price);
|
||||
@@ -31,6 +31,7 @@ public class TariffService {
|
||||
tariff.setMaxUsers(maxUsers);
|
||||
tariff.setMaxFilesCount(maxFilesCount);
|
||||
tariff.setTariffTerm(TariffTimeTerm.valueOf(tariffTerm.toUpperCase()));
|
||||
tariff.setDescription(description);
|
||||
|
||||
tariffRepository.save(tariff);
|
||||
}
|
||||
@@ -113,7 +114,8 @@ public class TariffService {
|
||||
tariff.getMaxFilesCount(),
|
||||
tariff.getDiskSize(),
|
||||
tariff.getMaxUsers(),
|
||||
tariffTerm == null ? "" : tariffTerm.name()
|
||||
tariffTerm == null ? "" : tariffTerm.name(),
|
||||
tariff.getDescription() == null ? "" : tariff.getDescription()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,6 +127,7 @@ public class TariffService {
|
||||
tariff.setMaxFilesCount(dto.getMaxFilesCount());
|
||||
tariff.setDiskSize(dto.getDiskSize());
|
||||
tariff.setMaxUsers(dto.getMaxUsers());
|
||||
tariff.setDescription(dto.getDescription());
|
||||
tariff.setTariffTerm(TariffTimeTerm.valueOf(dto.getTariffTerm().toUpperCase()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user