CreateCollection and GetCollection returns different Structure Objects
When an api call POST /api/collections triggers the collection that returns has the field 'owners' which is an array of user ids.
So the structure looks like that:
{ "id":"c3d7d89f-edd5-4b0e-9ae3-40320b251603", "type":"collection", "title":"Book review", "owners":[ "1c9e709c-823b-4162-880d-80b46aac14c0" ], "status":"submitted", "created":1526721563306, "fragments":["d129b057-9a87-43bf-8e64-689f09f6d2a7"], "reviewers":[{"id":"446bba1b-df08-41b4-afe0-6044e2b23a1f","user":"573a6bf6-3d22-44c1-983f-7d321a57925c"}] }
In the next requests the same object changes the structure that returns. So if we make a GET /api/collections request,
the structure looks like this:
{ "id":"c3d7d89f-edd5-4b0e-9ae3-40320b251603", "type":"collection", "title":"Book review", "owners":[ { "id": "1c9e709c-823b-4162-880d-80b46aac14c0", "username":"author" } ], "status":"submitted", "created":1526721563306, "fragments":["d129b057-9a87-43bf-8e64-689f09f6d2a7"], "reviewers":[{"id":"446bba1b-df08-41b4-afe0-6044e2b23a1f","user":"573a6bf6-3d22-44c1-983f-7d321a57925c"}] }
Pay attention to the owners field which is where the change happens.
I noticed that trying to check the owner of a collection when i was trying to implement authsome. i don't know if that was on purposed but i think we should keep one structure. And if we want more info about the user of the collection we can get it from the User Model (API call).