API: Refactor /batch/photos/edit endpoint to return "models" #271

The "photos" array in the response has been renamed to "models". This
data is now always returned, so using the "return" flag in the request
is no longer necessary.

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2025-05-13 10:22:35 +02:00
parent bdaab4b412
commit 9a39adebae
4 changed files with 11 additions and 23 deletions

View File

@@ -27,12 +27,12 @@ func TestBatchPhotosEdit(t *testing.T) {
body := response.Body.String()
assert.NotEmpty(t, body)
assert.True(t, strings.HasPrefix(body, `{"values":{"`), "unexpected response")
assert.True(t, strings.HasPrefix(body, `{"models":[{"ID"`), "unexpected response")
// fmt.Println(body)
/* photos := gjson.Get(body, "photos")
/* models := gjson.Get(body, "models")
values := gjson.Get(body, "values")
t.Logf("photos: %#v", photos)
t.Logf("models: %#v", models)
t.Logf("values: %#v", values) */
assert.Equal(t, http.StatusOK, response.Code)
@@ -52,12 +52,12 @@ func TestBatchPhotosEdit(t *testing.T) {
body := response.Body.String()
assert.NotEmpty(t, body)
assert.True(t, strings.HasPrefix(body, `{"photos":[{"ID"`), "unexpected response")
assert.True(t, strings.HasPrefix(body, `{"models":[{"ID"`), "unexpected response")
fmt.Println(body)
/* photos := gjson.Get(body, "photos")
/* models := gjson.Get(body, "models")
values := gjson.Get(body, "values")
t.Logf("photos: %#v", photos)
t.Logf("models: %#v", models)
t.Logf("values: %#v", values) */
assert.Equal(t, http.StatusOK, response.Code)
@@ -95,7 +95,7 @@ func TestBatchPhotosEdit(t *testing.T) {
body := response.Body.String()
assert.NotEmpty(t, body)
assert.True(t, strings.HasPrefix(body, `{"values":{"`), "unexpected response")
assert.True(t, strings.HasPrefix(body, `{"models":[{"ID"`), "unexpected response")
assert.Equal(t, http.StatusOK, response.Code)
})