dlab-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From of...@apache.org
Subject [incubator-dlab] branch develop updated: monthly budget fix
Date Mon, 06 Jul 2020 10:10:58 GMT
This is an automated email from the ASF dual-hosted git repository.

ofuks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/develop by this push:
     new 934173e  monthly budget fix
934173e is described below

commit 934173e94e44459045c1817c3d8c7a0655b18c40
Author: Oleh Fuks <olegfuks98@gmail.com>
AuthorDate: Mon Jul 6 13:10:45 2020 +0300

    monthly budget fix
---
 .../main/java/com/epam/dlab/backendapi/dao/ProjectDAOImpl.java    | 6 +++---
 .../src/main/java/com/epam/dlab/backendapi/domain/BudgetDTO.java  | 8 +++++---
 .../java/com/epam/dlab/backendapi/domain/CreateProjectDTO.java    | 3 ++-
 .../com/epam/dlab/backendapi/domain/UpdateProjectBudgetDTO.java   | 4 +---
 .../java/com/epam/dlab/backendapi/resources/ProjectResource.java  | 3 ++-
 .../com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java | 2 +-
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/ProjectDAOImpl.java
b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/ProjectDAOImpl.java
index 98f0841..d438eb5 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/ProjectDAOImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/dao/ProjectDAOImpl.java
@@ -33,7 +33,7 @@ public class ProjectDAOImpl extends BaseDAO implements ProjectDAO {
 	private static final String STATUS_FIELD = "status";
 	private static final String BUDGET_FIELD = "budget";
 	private static final String VALUE_FIELD = "value";
-	private static final String IS_MONTHLY_BUDGET_FIELD = "isMonthlyBudget";
+	private static final String MONTHLY_BUDGET_FIELD = "monthlyBudget";
 	private static final String SHARED_IMAGE_FIELD = "sharedImageEnabled";
 	private static final String ENDPOINT_STATUS_FIELD = "endpoints." + STATUS_FIELD;
 	private static final String EDGE_INFO_FIELD = "edgeInfo";
@@ -131,10 +131,10 @@ public class ProjectDAOImpl extends BaseDAO implements ProjectDAO {
 	}
 
 	@Override
-	public void updateBudget(String project, Integer budget, boolean isMonthlyBudget) {
+	public void updateBudget(String project, Integer budget, boolean monthlyBudget) {
 		BasicDBObject updateBudget = new BasicDBObject();
 		updateBudget.put(VALUE_FIELD, budget);
-		updateBudget.put(IS_MONTHLY_BUDGET_FIELD, isMonthlyBudget);
+		updateBudget.put(MONTHLY_BUDGET_FIELD, monthlyBudget);
 		updateOne(PROJECTS_COLLECTION, projectCondition(project), new Document(SET, new Document(BUDGET_FIELD,
updateBudget)));
 	}
 
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/BudgetDTO.java
b/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/BudgetDTO.java
index 69a540f..801cf9b 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/BudgetDTO.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/BudgetDTO.java
@@ -20,15 +20,17 @@
 package com.epam.dlab.backendapi.domain;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 @Data
 @JsonIgnoreProperties(ignoreUnknown = true)
 @Builder
+@NoArgsConstructor
+@AllArgsConstructor
 public class BudgetDTO {
     private Integer value;
-    @JsonProperty("is_monthly_budget")
-    private boolean isMonthlyBudget;
+    private boolean monthlyBudget;
 }
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/CreateProjectDTO.java
b/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/CreateProjectDTO.java
index bfee5b3..dafb21f 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/CreateProjectDTO.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/CreateProjectDTO.java
@@ -13,7 +13,8 @@ public class CreateProjectDTO {
 	private final String name;
 	@NotNull
 	private final Set<String> groups;
-	@NotNull final Set<String> endpoints;
+	@NotNull
+	final Set<String> endpoints;
 	@NotNull
 	@Pattern(regexp = "^ssh-.*\\n?", message = "format is incorrect. Please use the openSSH
format")
 	private final String key;
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/UpdateProjectBudgetDTO.java
b/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/UpdateProjectBudgetDTO.java
index 8e6831f..bf94438 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/UpdateProjectBudgetDTO.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/domain/UpdateProjectBudgetDTO.java
@@ -1,7 +1,6 @@
 package com.epam.dlab.backendapi.domain;
 
 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Data;
 
 import javax.validation.constraints.NotNull;
@@ -13,6 +12,5 @@ public class UpdateProjectBudgetDTO {
 	private final String project;
 	@NotNull
 	private final Integer budget;
-	@JsonProperty("is_monthly_budget")
-	private final boolean isMonthlyBudget;
+	private final boolean monthlyBudget;
 }
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ProjectResource.java
b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ProjectResource.java
index f4a18c6..3d6a394 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ProjectResource.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/resources/ProjectResource.java
@@ -1,6 +1,7 @@
 package com.epam.dlab.backendapi.resources;
 
 import com.epam.dlab.auth.UserInfo;
+import com.epam.dlab.backendapi.domain.BudgetDTO;
 import com.epam.dlab.backendapi.domain.CreateProjectDTO;
 import com.epam.dlab.backendapi.domain.ProjectDTO;
 import com.epam.dlab.backendapi.domain.ProjectEndpointDTO;
@@ -78,7 +79,7 @@ public class ProjectResource {
 				.map(e -> new ProjectEndpointDTO(e, UserInstanceStatus.CREATING, null))
 				.collect(Collectors.toList());
 		ProjectDTO project = new ProjectDTO(projectDTO.getName(), projectDTO.getGroups(), projectDTO.getKey(),
projectDTO.getTag(),
-				null, projectEndpointDTOS, projectDTO.isSharedImageEnabled());
+				new BudgetDTO(), projectEndpointDTOS, projectDTO.isSharedImageEnabled());
 		projectService.create(userInfo, project, projectDTO.getName());
 		final URI uri = uriInfo.getRequestUriBuilder().path(projectDTO.getName()).build();
 		return Response
diff --git a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java
b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java
index f750960..76fa48d 100644
--- a/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java
+++ b/services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/ProjectServiceImpl.java
@@ -340,7 +340,7 @@ public class ProjectServiceImpl implements ProjectService {
 	private ProjectDTO getUpdateProjectDTO(UpdateProjectBudgetDTO dto) {
 		BudgetDTO budgetDTO = BudgetDTO.builder()
 				.value(dto.getBudget())
-				.isMonthlyBudget(dto.isMonthlyBudget())
+				.monthlyBudget(dto.isMonthlyBudget())
 				.build();
 		return ProjectDTO.builder()
 				.name(dto.getProject())


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org


Mime
View raw message