diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/GitApplicationMetadata.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/GitApplicationMetadata.java index 7af808bc4b..0b3f247e69 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/GitApplicationMetadata.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/GitApplicationMetadata.java @@ -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 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 diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/AutoDeployment.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/AutoDeployment.java new file mode 100644 index 0000000000..9a8ada5f69 --- /dev/null +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/domains/ce/AutoDeployment.java @@ -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); + } +}