From 7b03ddbb28ebf7d38eeb079223228f31f860b1ea Mon Sep 17 00:00:00 2001
From: Eliot Berriot <contact@eliotberriot.com>
Date: Tue, 22 May 2018 22:57:20 +0200
Subject: [PATCH] Fix #224 and #226: changelog and documentation

---
 changes/changelog.d/224.enhancement | 30 +++++++++++++++++++++++++++++
 changes/changelog.d/226.bugfix      |  1 +
 dev.yml                             |  2 +-
 docs/swagger.yml                    | 16 +++++++--------
 4 files changed, 40 insertions(+), 9 deletions(-)
 create mode 100644 changes/changelog.d/224.enhancement
 create mode 100644 changes/changelog.d/226.bugfix

diff --git a/changes/changelog.d/224.enhancement b/changes/changelog.d/224.enhancement
new file mode 100644
index 00000000..43c2e88c
--- /dev/null
+++ b/changes/changelog.d/224.enhancement
@@ -0,0 +1,30 @@
+Retructured music API to increase performance and remove useless endpoints (#224)
+
+Music API changes
+^^^^^^^^^^^^^^^^^
+
+This release includes an API break. Even though the API is advertised
+as unstable, and not documented, here is a brief explanation of the change in
+case you are using the API in a client or in a script. Summary of the changes:
+
+- ``/api/v1/artists`` does not includes a list of tracks anymore. It was to heavy
+  to return all of this data all the time. You can get all tracks for an
+  artist using ``/api/v1/tracks?artist=artist_id``
+- Additionally, ``/api/v1/tracks`` now support an ``album`` filter to filter
+  tracks matching an album
+- ``/api/v1/artists/search``, ``/api/v1/albums/search`` and ``/api/v1/tracks/search``
+  endpoints are removed. Use ``/api/v1/{artists|albums|tracks}/?q=yourquery``
+  instead. It's also more powerful, since you can combine search with other
+  filters and ordering options.
+- ``/api/v1/requests/import-requests/search`` endpoint is removed as well.
+  Use ``/api/v1/requests/import-requests/?q=yourquery``
+  instead. It's also more powerful, since you can combine search with other
+  filters and ordering options.
+
+Of course, the front-end was updated to work with the new API, so this should
+not impact end-users in any way, apart from slight performance gains.
+
+.. note::
+
+    The API is still not stable and may evolve again in the future. API freeze
+    will come at a later point.
diff --git a/changes/changelog.d/226.bugfix b/changes/changelog.d/226.bugfix
new file mode 100644
index 00000000..18d448c2
--- /dev/null
+++ b/changes/changelog.d/226.bugfix
@@ -0,0 +1 @@
+Empty save button in radio builder (#226)
diff --git a/dev.yml b/dev.yml
index e85ce3b9..5dccfeca 100644
--- a/dev.yml
+++ b/dev.yml
@@ -130,7 +130,7 @@ services:
     ports:
       - '8002:8080'
     volumes:
-      - "./api/docs/swagger.yml:/usr/share/nginx/html/swagger.yml"
+      - "./docs/swagger.yml:/usr/share/nginx/html/swagger.yml"
 
 networks:
   internal:
diff --git a/docs/swagger.yml b/docs/swagger.yml
index 7735a8f2..71c74e44 100644
--- a/docs/swagger.yml
+++ b/docs/swagger.yml
@@ -78,7 +78,7 @@ paths:
                   results:
                     type: "array"
                     items:
-                      $ref: "#/definitions/ArtistNested"
+                      $ref: "#/definitions/ArtistWithAlbums"
 
 properties:
   resultsCount:
@@ -106,7 +106,7 @@ definitions:
       creation_date:
         type: "string"
         format: "date-time"
-  ArtistNested:
+  ArtistWithAlbums:
     type: "object"
     allOf:
       - $ref: "#/definitions/Artist"
@@ -115,7 +115,7 @@ definitions:
           albums:
             type: "array"
             items:
-              $ref: "#/definitions/AlbumNested"
+              $ref: "#/definitions/ArtistAlbum"
 
   Album:
     type: "object"
@@ -143,16 +143,16 @@ definitions:
         format: "date"
         example: "2001-01-01"
 
-  AlbumNested:
+  ArtistAlbum:
     type: "object"
     allOf:
       - $ref: "#/definitions/Album"
       - type: "object"
         properties:
-          tracks:
-            type: "array"
-            items:
-              $ref: "#/definitions/Track"
+          tracks_count:
+            type: "integer"
+            format: "int64"
+            example: 16
 
   Track:
     type: "object"
-- 
GitLab