Fix partition key ranges endpoint

This commit is contained in:
Pijus Kamandulis
2024-02-27 20:08:48 +02:00
parent d426dc23c0
commit 19f62f8173
2 changed files with 18 additions and 11 deletions

View File

@@ -26,9 +26,14 @@ func GetPartitionKeyRanges(c *gin.Context) {
c.Header("x-ms-global-committed-lsn", "420")
c.Header("x-ms-item-count", fmt.Sprintf("%d", len(partitionKeyRanges)))
collectionRid := collectionId
collection, _ := repositories.GetCollection(databaseId, collectionId)
if collection.ResourceID != "" {
collectionRid = collection.ResourceID
}
c.IndentedJSON(http.StatusOK, gin.H{
"_rid": collection.ResourceID,
"_rid": collectionRid,
"_count": len(partitionKeyRanges),
"PartitionKeyRanges": partitionKeyRanges,
})