serlo / api.serlo.org

Public GraphQL API of https://serlo.org/
https://api.serlo.org/___graphql
Apache License 2.0
15 stars 4 forks source link

☂️ Umbrella Issue: Threads #22

Closed inyono closed 3 years ago

inyono commented 4 years ago

Status


We want to add threads to the uuid type. So no additional root query necessary. Something like:

{
  uuid(id: 1855) {
    threads {
      totalCount
      nodes {
        id
        createdAt
        updatedAt
        title
        archived
        trashed
        object # Back link to the uuid the thread is tied to
        comments {
          totalCount
          nodes {
            id
            content
            createdAt
            updatedAt
            author
          }
        }
      }
    }
  }
}

Furthermore, we need mutations for various types of actions:

mutation createThread(
  # ...
}
# createComment
# archiveThread
# ...

Required legacy API endpoints

inyono commented 4 years ago

@anbestCL: There are now helpers to handle the connection stuff (i.e. returning totalCount, nodes, edges etc.). See https://github.com/serlo/api.serlo.org/blob/master/src/graphql/schema/notification/resolvers.ts#L64 for a usage example.

inyono commented 4 years ago

There's a work-in-progress PR https://github.com/serlo/api.serlo.org/pull/24 that might help.

kulla commented 3 years ago

@inyono Comments do only have a date field since they cannot be edited currently. Are the fields createdAt and updatedAt already for the future comment system?

inyono commented 3 years ago

createdAt and updatedAt are the fields we want to have in the long-term. Since we don't want the API to change later, we should already implement those (by setting both to the existing date field).