Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

story(ccmspui-355) add provider request data to existing endpoint #113

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions data-api/open-api-specification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,11 @@ components:
type: 'string'
file_upload_prompt:
type: 'string'
data_items:
type: 'array'
default: [ ]
items:
$ref: "#/components/schemas/providerRequestDataLookupValueDetail"
providerRequestTypeLookupDetail:
allOf:
- $ref: "#/components/schemas/page"
Expand All @@ -1490,6 +1495,21 @@ components:
default: [ ]
items:
$ref: "#/components/schemas/providerRequestTypeLookupValueDetail"
providerRequestDataLookupValueDetail:
type: 'object'
properties:
code:
type: 'string'
label:
type: 'string'
type:
type: 'string'
mandatory_flag:
type: 'boolean'
sequence:
type: 'string'
lov_lookup_type:
type: 'string'
page:
type: 'object'
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,16 @@ CREATE TABLE XXCCMS_PROVIDER_REQTYPES_V (
FILE_UPLD_PROMPT VARCHAR(255)
);

CREATE TABLE XXCCMS_PROVIDER_REQUEST_DATA_V (
REQUEST_TYPE VARCHAR(255) NOT NULL,
DATA_ITEM_CODE VARCHAR(255) NOT NULL,
DATA_ITEM_LABEL VARCHAR(255),
DATA_ITEM_TYPE VARCHAR(255) NOT NULL,
MANDATORY_FLAG VARCHAR(255) NOT NULL,
DATA_ITEM_SEQ VARCHAR(255) NOT NULL,
LOV_LOOKUP_TYPE VARCHAR(255),
PRIMARY KEY (REQUEST_TYPE, DATA_ITEM_CODE)
);



Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DROP TABLE XXCCMS_EVIDENCE_DOC_TYPE_V;
DROP TABLE XXCCMS_PUI_OPA_ENTITIES_V;
DROP TABLE XXCCMS_PUI_OPA_ATTRIBUTE_V;
DROP TABLE XXCCMS_PROVIDER_REQTYPES_V;
DROP TABLE XXCCMS_PROVIDER_REQUEST_DATA_V;



Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package uk.gov.laa.ccms.data.entity;

import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import jakarta.persistence.Column;
import jakarta.persistence.EmbeddedId;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import java.io.Serializable;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Immutable;

/**
* Entity representing the provider request data.
*/
@Entity
@Table(name = "XXCCMS_PROVIDER_REQUEST_DATA_V")
@Data
@NoArgsConstructor
@Immutable
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
public class ProviderRequestData implements Serializable {

@EmbeddedId
private ProviderRequestDataId id;

@Column(name = "data_item_label")
private String dataItemLabel;

@Column(name = "data_item_type", nullable = false)
private String dataItemType;

@Column(name = "mandatory_flag", nullable = false)
private String mandatoryFlag;

@Column(name = "data_item_seq", nullable = false)
private String dataItemSeq;

@Column(name = "lov_lookup_type")
private String lovLookupType;

@ManyToOne
@JoinColumn(name = "REQUEST_TYPE")
private ProviderRequestType providerRequestType;



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package uk.gov.laa.ccms.data.entity;

import jakarta.persistence.Column;
import java.io.Serializable;
import lombok.Data;
import org.hibernate.annotations.Immutable;

/**
* Composite ID class for provider request data.
*/
@Data
@Immutable
public class ProviderRequestDataId implements Serializable {


@Column(name = "request_type", nullable = false, insertable = false, updatable = false)
private String requestType;

@Column(name = "data_item_code", nullable = false)
private String dataItemCode;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import java.util.List;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.Immutable;
Expand Down Expand Up @@ -49,5 +52,8 @@ public class ProviderRequestType {
@Column(name = "FILE_UPLD_PROMPT")
private String fileUploadPrompt;

@OneToMany(mappedBy = "providerRequestType", fetch = FetchType.EAGER)
private List<ProviderRequestData> providerRequestData;


}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import uk.gov.laa.ccms.data.entity.OutcomeResultLookupValue;
import uk.gov.laa.ccms.data.entity.PersonRelationshipToCaseLookupValue;
import uk.gov.laa.ccms.data.entity.ProceedingClientInvolvementType;
import uk.gov.laa.ccms.data.entity.ProviderRequestData;
import uk.gov.laa.ccms.data.entity.ProviderRequestType;
import uk.gov.laa.ccms.data.entity.StageEndLookupValue;
import uk.gov.laa.ccms.data.model.AmendmentTypeLookupDetail;
Expand All @@ -44,6 +45,7 @@
import uk.gov.laa.ccms.data.model.MatterTypeLookupDetail;
import uk.gov.laa.ccms.data.model.OutcomeResultLookupDetail;
import uk.gov.laa.ccms.data.model.OutcomeResultLookupValueDetail;
import uk.gov.laa.ccms.data.model.ProviderRequestDataLookupValueDetail;
import uk.gov.laa.ccms.data.model.ProviderRequestTypeLookupDetail;
import uk.gov.laa.ccms.data.model.ProviderRequestTypeLookupValueDetail;
import uk.gov.laa.ccms.data.model.RelationshipToCaseLookupDetail;
Expand Down Expand Up @@ -181,9 +183,18 @@ ProviderRequestTypeLookupDetail toProviderRequestTypeLookupDetail(
@Mapping(source = "caseRelated", target = "isCaseRelated")
@Mapping(source = "additionalInformationPrompt", target = "additionalInformationPrompt")
@Mapping(source = "fileUploadEnabled", target = "isFileUploadEnabled")
@Mapping(source = "providerRequestData", target = "dataItems")
ProviderRequestTypeLookupValueDetail toProviderRequestTypeLookupValueDetail(
ProviderRequestType providerRequestType);

@Mapping(source = "id.dataItemCode", target = "code")
@Mapping(source = "dataItemLabel", target = "label")
@Mapping(source = "dataItemType", target = "type")
@Mapping(source = "dataItemSeq", target = "sequence")
ProviderRequestDataLookupValueDetail toProviderRequestDataLookupValueDetail(
ProviderRequestData providerRequestData);




}
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,7 @@ void toProviderRequestTypeLookupValueDetail_returnsCorrectDetail() {
providerRequestType.setTaskTypeId("123");
providerRequestType.setAccessFunctionCode("accessCode");
providerRequestType.setFileUploadPrompt("File upload");
providerRequestType.setProviderRequestData(new ArrayList<>());

ProviderRequestTypeLookupValueDetail expected = new ProviderRequestTypeLookupValueDetail();
expected.setIsCaseRelated(providerRequestType.getCaseRelated());
Expand Down
Loading