Unverified Commit d95f1838 authored by sarojsingh2021's avatar sarojsingh2021 Committed by GitHub
Browse files

Merge pull request #10 from UPHRH-platform/delete-form

Delete form
No related merge requests found
Showing with 5 additions and 3 deletions
+5 -3
......@@ -78,7 +78,7 @@ public class FormsController {
}
return ResponseGenerator.successResponse(formsService.getFormById(formId));
}
@PostMapping(value = PathRoutes.FormServiceApi.CREATE_FORM)
public String createForm(@RequestBody FormDetail form,
@RequestHeader(value = Constants.Parameters.X_USER_INFO, required = false) String xUserInfo)
......
......@@ -4,7 +4,8 @@ import com.fasterxml.jackson.annotation.JsonValue;
public enum Status {
DRAFT("Draft"), NEW("New"), REVIEW("Review"), PUBLISH("Publish"), UNPUBLISH("Unpublish"), INSCOMPLETED(
"INSCOMPLETED"), LEADINSCOMPLETED("LEADINSCOMPLETED"), SENTFORINS("SENTFORINS");
"INSCOMPLETED"), LEADINSCOMPLETED("LEADINSCOMPLETED"), SENTFORINS("SENTFORINS"),
DELETED("Deleted"),DUPLICATE("Duplicate");
private String value;
......
......@@ -286,13 +286,14 @@ public class FormsServiceImpl implements FormsService {
} else {
boolQuery.must(QueryBuilders.matchPhraseQuery(Constants.STATUS, Status.PUBLISH.name()));
}
boolQuery.mustNot(QueryBuilders.matchPhraseQuery(Constants.STATUS, Status.DELETED.name()));
return boolQuery;
}
private SearchRequest buildQueryForGetQueryById(Long id) {
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder().size(0)
.query(QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("id", id)))
.query(QueryBuilders.boolQuery().must(QueryBuilders.matchQuery("id", id)).mustNot(QueryBuilders.matchPhraseQuery(Constants.STATUS, Status.DELETED.name())))
.aggregation(AggregationBuilders.terms("UniqueFormId").field("id").size(100)
.subAggregation(AggregationBuilders.topHits("LatestVersion").from(0).size(1)
.version(Boolean.FALSE).explain(Boolean.FALSE)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment