Skip to content

Commit

Permalink
avniproject/avni-media#134 | Include entityId in media search response
Browse files Browse the repository at this point in the history
  • Loading branch information
Suhas Vishwanath committed Nov 8, 2023
1 parent 636187d commit 233c37f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/avniproject/etl/dto/MediaDTO.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

import java.net.URL;

public record MediaDTO(String uuid, String subjectFirstName, String subjectLastName, String url, String conceptName, URL signedUrl, String thumbnailUrl, URL signedThumbnailUrl, String subjectTypeName, String programEnrolment, String encounterTypeName, String lastModifiedDateTime, String createdDateTime, String syncConcept1Name, String syncConcept2Name, String syncParameterValue1, String syncParameterValue2, Object address){
public record MediaDTO(String uuid, String subjectFirstName, String subjectLastName, String url, String conceptName, URL signedUrl, String thumbnailUrl, URL signedThumbnailUrl, String subjectTypeName, String programEnrolment, String encounterTypeName, String lastModifiedDateTime, String createdDateTime, String syncConcept1Name, String syncConcept2Name, String syncParameterValue1, String syncParameterValue2, Object address, long entityId){
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public MediaDTO setMediaDto(ResultSet rs) {
rs.getString("sync_parameter_key2"),
rs.getString("sync_parameter_value1"),
rs.getString("sync_parameter_value2"),
rs.getString("address")
rs.getString("address"),
rs.getLong("entity_id")
);
} catch (SQLException e) {
throw new Error("Error:" + e.getMessage());
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/sql/api/searchMedia.sql.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ SELECT media.id as id,
media.encounter_type_name as encounter_type_name,
media.program_name as program_name,
media.concept_name as concept_name,
row_to_json(address.*) as address
row_to_json(address.*) as address,
media.entity_id as entity_id
FROM <schemaName>.media media
JOIN <schemaName>.address address ON address.id = media.address_id
<if(joinTablesAndColumns)>
Expand Down

0 comments on commit 233c37f

Please sign in to comment.