Closed elbotho closed 3 years ago
Now, thats easy to change in the API.
How to implement it (for the workshop): The code at https://github.com/serlo/api.serlo.org/blob/master/src/graphql/schema/uuid/thread/utils.ts#L11-L25 needs to be changed. First you can have
const threads = await Promise.all(
firstCommentIds.map((id) => toThreadPayload(dataSources.serlo, id))
)
This variable can be sorted. It is of type ThreadData[]
, see https://github.com/serlo/api.serlo.org/blob/master/src/graphql/schema/uuid/thread/types.ts for type definitions
At https://github.com/serlo/api.serlo.org/blob/master/__tests__/schema/uuid/thread.ts the tests need to be updated as well.
~Is it easy to sort the threads in the api? Or should we do the sorting in the frontend. Newest in top probably makes sense most of the time.~