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