-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support publish reviewers settings (#31)
- Loading branch information
1 parent
47e038a
commit cfcb5d8
Showing
50 changed files
with
1,705 additions
and
84 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/main/java/com/featureprobe/api/base/enums/ApprovalStatusEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.featureprobe.api.base.enums; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public enum ApprovalStatusEnum { | ||
PENDING, | ||
PASS, | ||
REJECT, | ||
JUMP, | ||
REVOKE; | ||
|
||
private static final Map<String, ApprovalStatusEnum> namesMap = Arrays.stream(ApprovalStatusEnum.values()) | ||
.collect(Collectors.toMap(pt -> pt.name(), pt -> pt)); | ||
|
||
@JsonCreator | ||
public static ApprovalStatusEnum forValue(String value) { | ||
return namesMap.get(value); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/featureprobe/api/base/enums/ApprovalTypeEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.featureprobe.api.base.enums; | ||
|
||
public enum ApprovalTypeEnum { | ||
APPROVAL,APPLY | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/main/java/com/featureprobe/api/base/enums/SketchStatusEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.featureprobe.api.base.enums; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
|
||
public enum SketchStatusEnum { | ||
|
||
PENDING,REVOKE,RELEASE,CANCEL; | ||
|
||
private static final Map<String, SketchStatusEnum> namesMap = Arrays.stream(SketchStatusEnum.values()) | ||
.collect(Collectors.toMap(pt -> pt.name(), pt -> pt)); | ||
|
||
@JsonCreator | ||
public static SketchStatusEnum forValue(String value) { | ||
return namesMap.get(value); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/featureprobe/api/controller/ApprovalRecordController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.featureprobe.api.controller; | ||
|
||
import com.featureprobe.api.base.doc.DefaultApiResponses; | ||
import com.featureprobe.api.dto.ApprovalRecordQueryRequest; | ||
import com.featureprobe.api.dto.ApprovalRecordResponse; | ||
import com.featureprobe.api.service.ApprovalRecordService; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.AllArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
|
||
@Slf4j | ||
@DefaultApiResponses | ||
@Tag(name = "Approval record", description = "Using the approval API, you can query approval record") | ||
@RequestMapping("/approvalRecords") | ||
@AllArgsConstructor | ||
@RestController | ||
public class ApprovalRecordController { | ||
|
||
private ApprovalRecordService approvalRecordService; | ||
|
||
@GetMapping | ||
public Page<ApprovalRecordResponse> list(@Validated ApprovalRecordQueryRequest queryRequest) { | ||
return approvalRecordService.list(queryRequest); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/java/com/featureprobe/api/dto/ApprovalRecordQueryRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.featureprobe.api.dto; | ||
|
||
import com.featureprobe.api.base.enums.ApprovalTypeEnum; | ||
import lombok.Data; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
@Data | ||
public class ApprovalRecordQueryRequest extends PaginationRequest{ | ||
|
||
private String keyword; | ||
|
||
@NotNull | ||
private String status; | ||
|
||
@NotNull | ||
private ApprovalTypeEnum type; | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/com/featureprobe/api/dto/ApprovalRecordResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.featureprobe.api.dto; | ||
|
||
import com.featureprobe.api.base.enums.ApprovalStatusEnum; | ||
import lombok.Data; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
@Data | ||
public class ApprovalRecordResponse { | ||
|
||
private String title; | ||
|
||
private String projectName; | ||
|
||
private String projectKey; | ||
|
||
private String toggleName; | ||
|
||
private String toggleKey; | ||
|
||
private String environmentName; | ||
|
||
private String environmentKey; | ||
|
||
private ApprovalStatusEnum status; | ||
|
||
private String submitBy; | ||
|
||
private boolean locked; | ||
|
||
private Date lockedTime; | ||
|
||
private List<String> reviewers; | ||
|
||
private String approvedBy; | ||
|
||
private String comment; | ||
|
||
private Date approvalTime; | ||
|
||
private Date sketchTime; | ||
|
||
private Date cancelTime; | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/featureprobe/api/dto/ApprovalSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.featureprobe.api.dto; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
public class ApprovalSettings { | ||
|
||
private String environmentKey; | ||
|
||
private Boolean enable; | ||
|
||
private List<String> reviewers; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/main/java/com/featureprobe/api/dto/PreferenceCreateRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.featureprobe.api.dto; | ||
|
||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
public class PreferenceCreateRequest { | ||
|
||
List<ApprovalSettings> approvalSettings; | ||
|
||
} | ||
|
12 changes: 12 additions & 0 deletions
12
src/main/java/com/featureprobe/api/dto/TargetingDiffRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.featureprobe.api.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class TargetingDiffRequest { | ||
|
||
private Long currentVersion; | ||
|
||
private Long targetVersion; | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/featureprobe/api/dto/TargetingDiffResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.featureprobe.api.dto; | ||
|
||
import com.featureprobe.api.model.TargetingContent; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class TargetingDiffResponse { | ||
|
||
private Boolean currentDisabled; | ||
private TargetingContent currentContent; | ||
|
||
private Boolean oldDisabled; | ||
private TargetingContent oldContent; | ||
|
||
} |
10 changes: 8 additions & 2 deletions
10
src/main/java/com/featureprobe/api/dto/TargetingRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
package com.featureprobe.api.dto; | ||
|
||
import com.featureprobe.api.model.TargetingContent; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class TargetingRequest { | ||
|
||
private TargetingContent content; | ||
|
||
private String comment; | ||
|
||
private Boolean disabled; | ||
} | ||
|
||
private List<String> reviewers; | ||
} |
Oops, something went wrong.