feat: Added model fields for auto deployment configuration (#30297)

## Description
Adds the model fields for auto deployment configuration. 

#### PR fixes following issue(s)
Partially Fixes #30068
This commit is contained in:
Nayan 2024-01-16 19:21:14 +06:00 committed by GitHub
parent 4d9264444e
commit 7b977abe4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.appsmith.server.domains;
import com.appsmith.external.models.AppsmithDomain;
import com.appsmith.external.views.Views;
import com.appsmith.server.domains.ce.AutoDeployment;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.Data;
@ -10,6 +11,7 @@ import org.springframework.data.annotation.Transient;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.util.Set;
// This class will be used for one-to-one mapping for the DB application and the application present in the git repo.
@Data
@ -79,6 +81,16 @@ public class GitApplicationMetadata implements AppsmithDomain {
@JsonView(Views.Metadata.class)
AutoCommitConfig autoCommitConfig;
/**
* autoDeploymentConfigs field will hold the list of branches that are enabled for auto deployment.
* It'll also show the latest deployedAt date for the corresponding branch.
* If auto deployment is enabled for 2 branches - main and develop, autoDeploymentConfigs will have two entries
* each for one branch. This attribute will be present inside the root application only. The branched applications
* will not have this field set.
*/
@JsonView(Views.Metadata.class)
Set<AutoDeployment> autoDeploymentConfigs;
public AutoCommitConfig getAutoCommitConfig() {
// by default, the auto commit should be enabled.
// new AutoCommitConfig will have enabled=true so we're returning a new object when field is null

View File

@ -0,0 +1,25 @@
package com.appsmith.server.domains.ce;
import lombok.Data;
import java.time.Instant;
import java.util.Objects;
@Data
public class AutoDeployment {
private Instant lastDeployedAt;
private String branchName;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AutoDeployment that = (AutoDeployment) o;
return branchName.equals(that.branchName);
}
@Override
public int hashCode() {
return Objects.hash(branchName);
}
}