Expose library_type_name in API and remove redundant empty fields
- Add library_type_name to GetMediaItem handler response in media.go - Remove empty LibraryName and LibraryTypeName fields from: - ListMediaItemsRow in collections.go handler - ListMediaItemsRow in dashboard_service.go - These fields are now populated at the database level via trigger The library_type_name is now automatically populated in the database when a media item is created, so we remove the manual empty string assignments and expose the actual value in the API response.
This commit is contained in:
@@ -1007,7 +1007,5 @@ func mediaItemsToListMediaItemsRow(item database.MediaItems) database.ListMediaI
|
|||||||
OpfIdentifier: item.OpfIdentifier,
|
OpfIdentifier: item.OpfIdentifier,
|
||||||
OpfUuid: item.OpfUuid,
|
OpfUuid: item.OpfUuid,
|
||||||
HashConfidence: item.HashConfidence,
|
HashConfidence: item.HashConfidence,
|
||||||
LibraryName: "",
|
|
||||||
LibraryTypeName: "",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -777,6 +777,7 @@ func (mh *MediaHandler) GetMediaItem(c *echo.Context) error {
|
|||||||
"alternate_info": jsonBytesToMap(item.AlternateInfo),
|
"alternate_info": jsonBytesToMap(item.AlternateInfo),
|
||||||
"scan_information": textToString(item.ScanInformation),
|
"scan_information": textToString(item.ScanInformation),
|
||||||
"summary": textToString(item.Summary),
|
"summary": textToString(item.Summary),
|
||||||
|
"library_type_name": textPtrToString(item.LibraryTypeName),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,8 +57,6 @@ func mediaItemsToListMediaItemsRow(item database.MediaItems) database.ListMediaI
|
|||||||
OpfIdentifier: item.OpfIdentifier,
|
OpfIdentifier: item.OpfIdentifier,
|
||||||
OpfUuid: item.OpfUuid,
|
OpfUuid: item.OpfUuid,
|
||||||
HashConfidence: item.HashConfidence,
|
HashConfidence: item.HashConfidence,
|
||||||
LibraryName: "",
|
|
||||||
LibraryTypeName: "",
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user