V2-4 : placements multi-device (report_bytes, tables 000015, copies UI)
This commit is contained in:
@@ -50,3 +50,25 @@ func LinksList(c *gin.Context) {
|
||||
}
|
||||
api.OK(c, links)
|
||||
}
|
||||
|
||||
// PlacementsList exposes byte presence of a resource the caller OWNS
|
||||
// (server entry + device reports, newest first) : GET /files/:id/placements.
|
||||
// Owner-only (404 otherwise, no enumeration).
|
||||
func PlacementsList(c *gin.Context) {
|
||||
if Store == nil {
|
||||
api.Error(c, http.StatusServiceUnavailable, "SERVICE_UNAVAILABLE", "backend not initialized")
|
||||
return
|
||||
}
|
||||
userID := c.GetString(UserIDKey)
|
||||
id := c.Param("id")
|
||||
if !deviceIDPattern.MatchString(id) {
|
||||
api.Error(c, http.StatusNotFound, "NOT_FOUND", "file not found")
|
||||
return
|
||||
}
|
||||
placements, err := Store.ListPlacements(userID, id)
|
||||
if err != nil {
|
||||
writeError(c, err)
|
||||
return
|
||||
}
|
||||
api.OK(c, placements)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user