Skip to content

Backend: Working Group Management

Christina Ludwig edited this page Feb 28, 2023 · 9 revisions

After a user has registered they can/should join a working group, for which there are three scenarios:

1. The user's working group already exists in the app.

If the user's working group already exist, they can choose it by selecting the country, city, institution (e.g. Heidelberg University) and the working group's name from several dropdown menus. Valid countries, cities and institutions can be queried using the institutions endpoint, existing working groups using the workinggroups endpoint. The selected working can be sent to backend using the requestJoinWorkingGroup endpint.

2. The user's working group does not exist yet in the app

If the user's working group does not exists yet, they can create it by providing

  • the working group's name
  • the institution (incl. country and city) it belongs to (from predefined selection)
  • research field (from predefined selection)
  • number of employees.

API requests

List working groups

query {
  workinggroups {
    id
    name
    field {
      field
      subfield
    }
  }
}

List institutions

query {
  institutions {
    id
    name
    city
    country
  }
}

List research fields

query {
  researchfields {
    id
    field
    subfield
  }
}

Set working group

mutation ($id: String!){
    setWorkingGroup (input: {
       id: $id
    }) {
    user {
        username
      workingGroup {
        name
      }
    }
    }
}

Create Working group

needs user token in header

    mutation {
        mutation ($name: String!, $institution_id: Int!, $research_field_id: Int!, $nemployees: Int!, $is_public: Boolean!){
            createWorkingGroup (input: {
                name: $name
                institutionId: $institution_id
                researchFieldId: $research_field_id
                nEmployees: $nemployees
                isPublic: $is_public
        }) {
            ok
            workinggroup {
                name
                representative {
                    username
                }
        }
        }
    }

Request to join a working group

needs user token in header

mutation ($id: String!){
    requestJoinWorkingGroup (input: {
        workinggroupId: $id
      }
    ) {
      success
      joinRequest {
        status
        id
        workingGroup {
          id
        }
      }
    }
  }

Answer a request by other user to join a working group

needs user token in header

mutation ($requestId: String!, $approve: Boolean!){
    answerJoinRequest (input: {
         approve: $approve
         requestId: $requestId
       }
       ) {
         success
         requestingUser {
            workingGroup {
               id
              }
            }
          }
        }