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

MODDCB-81 Optional DCBTransaction fields fields should be nullable #61

Merged
merged 6 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@ public class TransactionEntity extends AuditableEntity {
private String servicePointId;
private String servicePointName;
private String materialType;
private String pickupLibraryName;
private String pickupLibraryCode;
private String lendingLibraryCode;
@Convert(converter = UUIDConverter.class)
private String patronId;
private String patronGroup;
private String patronBarcode;
private String borrowingLibraryCode;
private UUID requestId;
@Enumerated(EnumType.STRING)
private StatusEnum status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ public TransactionEntity mapToEntity(String transactionId, DcbTransaction dcbTra
.servicePointId(pickup.getServicePointId())
.servicePointName(pickup.getServicePointName())
.pickupLibraryCode(pickup.getLibraryCode())
.pickupLibraryName(pickup.getLibraryName())
.patronBarcode(patron.getBarcode())
.patronId(patron.getId())
.patronGroup(patron.getGroup())
.borrowingLibraryCode(patron.getBorrowingLibraryCode())

.role(dcbTransaction.getRole())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public ServicePointRequest createServicePoint(DcbPickup pickupServicePoint) {

ServicePointRequest servicePointRequest = createServicePointRequest(
pickupServicePoint.getServicePointId(),
getServicePointName(pickupServicePoint.getLibraryName(), pickupServicePoint.getServicePointName()),
getServicePointCode(pickupServicePoint.getLibraryName(), pickupServicePoint.getServicePointName())
getServicePointName(pickupServicePoint.getLibraryCode(), pickupServicePoint.getServicePointName()),
getServicePointCode(pickupServicePoint.getLibraryCode(), pickupServicePoint.getServicePointName())
);

try{
Expand All @@ -52,11 +52,11 @@ private ServicePointRequest createServicePointRequest(String id, String name, St
.build();
}

private String getServicePointName(String libraryName, String servicePointName){
return String.format("DCB_%s_%s", libraryName, servicePointName);
private String getServicePointName(String libraryCode, String servicePointName){
return String.format("DCB_%s_%s", libraryCode, servicePointName);
}

private String getServicePointCode(String libraryName, String servicePointName){
return String.format("DCB_%s_%s", libraryName, servicePointName).replaceAll("\\s+","").toUpperCase();
private String getServicePointCode(String libraryCode, String servicePointName){
return String.format("DCB_%s_%s", libraryCode, servicePointName).replaceAll("\\s+","").toUpperCase();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<constraints nullable="false"/>
</column>
<column name="item_title" type="text">
<constraints nullable="false"/>
<constraints nullable="true"/>
MagzhanArtykov marked this conversation as resolved.
Show resolved Hide resolved
</column>
<column name="item_barcode" type="text">
<constraints nullable="false"/>
Expand All @@ -58,32 +58,26 @@
<constraints nullable="false"/>
</column>
<column name="service_point_name" type="text">
<constraints nullable="false"/>
</column>
<column name="pickup_library_name" type="text">
<constraints nullable="false"/>
<constraints nullable="true"/>
</column>
<column name="pickup_library_code" type="text">
<constraints nullable="false"/>
<constraints nullable="true"/>
</column>
<column name="material_type" type="text">
<constraints nullable="false"/>
<constraints nullable="true"/>
</column>
<column name="lending_library_code" type="text">
<constraints nullable="false"/>
<constraints nullable="true"/>
</column>
<column name="patron_id" type="UUID">
<constraints nullable="false"/>
</column>
<column name="patron_group" type="text">
<constraints nullable="false"/>
<constraints nullable="true"/>
</column>
<column name="patron_barcode" type="text">
<constraints nullable="false"/>
</column>
<column name="borrowing_library_code" type="text">
<constraints nullable="false"/>
</column>
<column name="status" type="StatusEnum"/>
<column name="role" type="RoleEnum"/>
<column name="created_by" type="uuid"/>
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/swagger.api/schemas/dcbPatron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ DcbPatron:
barcode:
description: The barcode of the patron
type: string
borrowingLibraryCode:
description: The code which identifies the borrowing library
type: string
3 changes: 0 additions & 3 deletions src/main/resources/swagger.api/schemas/dcbPickup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ DcbPickup:
description: Pickup Location metadata required for the pickup service point
type: object
properties:
libraryName:
description: The name of the pickup library
type: string
libraryCode:
description: The code which identifies the pickup library
type: string
Expand Down
10 changes: 3 additions & 7 deletions src/test/java/org/folio/dcb/utils/EntityUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public static DcbTransaction createDcbTransactionByRole(DcbTransaction.RoleEnum
public static org.folio.dcb.domain.dto.ServicePointRequest createServicePointRequest() {
return org.folio.dcb.domain.dto.ServicePointRequest.builder()
.id(PICKUP_SERVICE_POINT_ID)
.name("DCB_TestLibraryName_TestServicePointCode")
.code("DCB_TESTLIBRARYNAME_TESTSERVICEPOINTCODE")
.discoveryDisplayName("DCB_TestLibraryName_TestServicePointCode")
.name("DCB_TestLibraryCode_TestServicePointCode")
.code("DCB_TESTLIBRARYCODE_TESTSERVICEPOINTCODE")
.discoveryDisplayName("DCB_TestLibraryCode_TestServicePointCode")
.pickupLocation(true)
.holdShelfExpiryPeriod(org.folio.dcb.domain.dto.HoldShelfExpiryPeriod.builder().duration(3).intervalId(org.folio.dcb.domain.dto.HoldShelfExpiryPeriod.IntervalIdEnum.DAYS).build())
.holdShelfClosedLibraryDateManagement(HOLD_SHELF_CLOSED_LIBRARY_DATE_MANAGEMENT)
Expand Down Expand Up @@ -112,7 +112,6 @@ public static DcbPatron createDcbPatronWithExactPatronId(String patronId) {
.id(patronId)
.barcode("DCB_PATRON")
.group("staff")
.borrowingLibraryCode("E")
.build();
}
public static DcbPatron createDefaultDcbPatron() {
Expand All @@ -124,7 +123,6 @@ public static org.folio.dcb.domain.dto.DcbPickup createDcbPickup() {
.servicePointId(PICKUP_SERVICE_POINT_ID)
.servicePointName("TestServicePointCode")
.libraryCode("TestLibraryCode")
.libraryName("TestLibraryName")
.build();
}

Expand Down Expand Up @@ -163,10 +161,8 @@ public static TransactionEntity createTransactionEntity() {
.servicePointId(PICKUP_SERVICE_POINT_ID)
.servicePointName("TestServicePointCode")
.pickupLibraryCode("TestLibraryCode")
.pickupLibraryName("TestLibraryName")
.materialType("book")
.lendingLibraryCode("LEN")
.borrowingLibraryCode("BOR")
.requestId(UUID.fromString(CIRCULATION_REQUEST_ID))
.build();
}
Expand Down