-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MOSIP-37875: Created v2 endpoint for ftpChipDetails (#1006)
* MOSIP-37875: Created v2 endpoint for ftpChipDetails Signed-off-by: Swetha K <[email protected]> * MOSIP-37875: Created v2 endpoint for ftpChipDetails Signed-off-by: Swetha K <[email protected]> * MOSIP-37875: Created v2 endpoint for ftpChipDetails Signed-off-by: Swetha K <[email protected]> * MOSIP-37875: Created v2 endpoint for ftpChipDetails Signed-off-by: Swetha K <[email protected]> --------- Signed-off-by: Swetha K <[email protected]> Co-authored-by: Swetha K <[email protected]>
- Loading branch information
1 parent
02f846d
commit caf40db
Showing
10 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
...t-service/src/main/java/io/mosip/pms/device/authdevice/entity/FtmDetailSummaryEntity.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,70 @@ | ||
package io.mosip.pms.device.authdevice.entity; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDateTime; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@ToString | ||
@SqlResultSetMapping( | ||
name = "Mapping.FtmDetailSummaryEntity", | ||
classes = { @ConstructorResult( | ||
targetClass = FtmDetailSummaryEntity.class, | ||
columns = { | ||
@ColumnResult(name = "ftmId", type = String.class), | ||
@ColumnResult(name = "partnerId", type = String.class), | ||
@ColumnResult(name = "orgName", type = String.class), | ||
@ColumnResult(name = "make", type = String.class), | ||
@ColumnResult(name = "model", type = String.class), | ||
@ColumnResult(name = "status", type = String.class), | ||
@ColumnResult(name = "isActive", type = Boolean.class), | ||
@ColumnResult(name = "isCertificateAvailable", type = Boolean.class), | ||
@ColumnResult(name = "createdDateTime", type = LocalDateTime.class) | ||
}) | ||
} | ||
) | ||
public class FtmDetailSummaryEntity { | ||
|
||
public FtmDetailSummaryEntity(String ftmId, String partnerId, String orgName, String make, String model, | ||
String status, Boolean isActive, Boolean isCertificateAvailable, | ||
LocalDateTime createdDateTime) { | ||
this.ftmId = ftmId; | ||
this.partnerId = partnerId; | ||
this.orgName = orgName; | ||
this.make = make; | ||
this.model = model; | ||
this.status = status; | ||
this.isActive = isActive; | ||
this.isCertificateAvailable = isCertificateAvailable; | ||
this.createdDateTime = createdDateTime; | ||
} | ||
|
||
// No-argument constructor | ||
public FtmDetailSummaryEntity() { | ||
super(); | ||
} | ||
|
||
@Id | ||
private String ftmId; | ||
|
||
private String partnerId; | ||
|
||
private String orgName; | ||
|
||
private String make; | ||
|
||
private String model; | ||
|
||
private String status; | ||
|
||
private Boolean isActive; | ||
|
||
private Boolean isCertificateAvailable; | ||
|
||
private LocalDateTime createdDateTime; | ||
} |
44 changes: 44 additions & 0 deletions
44
.../src/main/java/io/mosip/pms/device/authdevice/repository/FtmDetailsSummaryRepository.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,44 @@ | ||
package io.mosip.pms.device.authdevice.repository; | ||
|
||
import io.mosip.kernel.core.dataaccess.spi.repository.BaseRepository; | ||
import io.mosip.pms.device.authdevice.entity.FtmDetailSummaryEntity; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository("FtmDetailsSummaryRepository") | ||
public interface FtmDetailsSummaryRepository extends BaseRepository<FtmDetailSummaryEntity, String> { | ||
|
||
@Query(value = "SELECT new FtmDetailSummaryEntity(" + | ||
"f.ftpChipDetailId, f.ftpProviderId, f.partnerOrganizationName, f.make, f.model, " + | ||
"CASE " + | ||
"WHEN f.approvalStatus = 'approved' AND f.isActive = true THEN 'approved' " + | ||
"WHEN f.approvalStatus = 'approved' AND f.isActive = false THEN 'deactivated' " + | ||
"WHEN f.approvalStatus = 'rejected' THEN 'rejected' " + | ||
"WHEN f.approvalStatus = 'pending_approval' THEN 'pending_approval' " + | ||
"WHEN f.approvalStatus = 'pending_cert_upload' THEN 'pending_cert_upload' " + | ||
"END AS approvalStatus, " + | ||
"f.isActive, CASE WHEN f.certificateAlias IS NULL THEN false ELSE true END, f.crDtimes) " + | ||
"FROM FTPChipDetail f " + | ||
"WHERE (:partnerId IS NULL OR lower(f.ftpProviderId) LIKE %:partnerId%) " + | ||
"AND (:orgName IS NULL OR lower(f.partnerOrganizationName) LIKE %:orgName%) " + | ||
"AND (:make IS NULL OR lower(f.make) LIKE %:make%) " + | ||
"AND (:model IS NULL OR lower(f.model) LIKE %:model%) " + | ||
"AND (:status IS NULL OR " + | ||
"(:status = 'deactivated' AND f.approvalStatus = 'approved' AND f.isActive = false) " + | ||
"OR (:status = 'approved' AND f.approvalStatus = 'approved' AND f.isActive = true) " + | ||
"OR (:status = 'rejected' AND f.approvalStatus = 'rejected') " + | ||
"OR (:status = 'pending_approval' AND f.approvalStatus = 'pending_approval') " + | ||
"OR (:status = 'pending_cert_upload' AND f.approvalStatus = 'pending_cert_upload'))" | ||
) | ||
Page<FtmDetailSummaryEntity> getSummaryOfPartnersFtmDetails( | ||
@Param("partnerId") String partnerId, | ||
@Param("orgName") String orgName, | ||
@Param("make") String make, | ||
@Param("model") String model, | ||
@Param("status") String status, | ||
Pageable pageable | ||
); | ||
} |
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
12 changes: 12 additions & 0 deletions
12
...er/partner-management-service/src/main/java/io/mosip/pms/device/dto/FtmChipFilterDto.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 io.mosip.pms.device.dto; | ||
|
||
import lombok.Data; | ||
|
||
@Data | ||
public class FtmChipFilterDto { | ||
private String partnerId; | ||
private String orgName; | ||
private String make; | ||
private String model; | ||
private String status; | ||
} |
38 changes: 38 additions & 0 deletions
38
...anagement-service/src/main/java/io/mosip/pms/device/response/dto/FtmDetailSummaryDto.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,38 @@ | ||
package io.mosip.pms.device.response.dto; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.Data; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Date; | ||
|
||
@Data | ||
public class FtmDetailSummaryDto { | ||
|
||
@Schema(description = "Unique identifier for the FTM Chip details added by the partner", example = "ftp-001") | ||
private String ftmId; | ||
|
||
@Schema(description = "Unique identifier for the partner", example = "partner123") | ||
private String partnerId; | ||
|
||
@Schema(description = "Name of the organisation", example = "org123") | ||
private String orgName; | ||
|
||
@Schema(description = "Make of the FTM chip", example = "make-123") | ||
private String make; | ||
|
||
@Schema(description = "Model of the FTM chip", example = "model-123") | ||
private String model; | ||
|
||
@Schema(description = "Current status of the FTM chip details added by the partner. Possible values are pending_cert_upload, pending_approval, rejected, approved, deactivated", example = "pending_approval") | ||
private String status; | ||
|
||
@Schema(description = "Indicates whether the FTM chip details is active (true if active, false otherwise)", example = "false") | ||
private Boolean isActive; | ||
|
||
@Schema(description = "Indicates whether the FTM Chip certificate is available (true if available, false otherwise)", example = "true") | ||
private Boolean isCertificateAvailable; | ||
|
||
@Schema(description = "Date and time in ISO format indicating when the FTM Chip details were added by the partner", example = "2024-08-01T14:30:00Z") | ||
private LocalDateTime createdDateTime; | ||
} |
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
Oops, something went wrong.