Specs of Extra Categories

English only

Extra Categories: Technical Specs

In this second part, we dive deeper into the technical structure of extra categories in Pluvo. Here you'll find the specific GraphQL types used to store values, how they connect to entities like users or trainings, and how to manage them using mutations.

Value per type

Text value

type ExtraCategoryStringValue {
  category: ExtraCategory!
  color: Color
  stringValue: String!
  modelId: UUID!
}

Date value

type ExtraCategoryDatetimeValue {
  category: ExtraCategory!
  color: Color
  datetimeValue: DateTime!
  modelId: UUID!
}

Choice option

type ExtraCategoryChoiceValue {
  category: ExtraCategory!
  color: Color
  choiceValue: ExtraCategoryChoiceOption!
  modelId: UUID!
}

Boolean value

type ExtraCategoryBooleanValue {
  category: ExtraCategory!
  color: Color
  booleanValue: Boolean!
  modelId: UUID!
}

Contextual connection

All value types contain:

  • category: the corresponding ExtraCategory
  • modelId: ID of the linked object (e.g., user or training)
  • color: optional color for visualization

Notes

  • These value types are not directly mutated via separate GraphQL mutations, but usually via JSON fields on the target objects (like extraFields on User or Training).
  • ref fields on choice options enable external mapping with other systems.
  • Color is optional and is used for visual indication in interfaces.

GraphQL Definitions

Type: ExtraCategory

type ExtraCategory {
  id: ID!
  title: String!
  extraFields: [ExtraField!]
  archivedAt: DateTime
}

Type: ExtraField

type ExtraField {
  id: ID!
  key: String!
  label: String!
  type: ExtraFieldType!
}

Enum: ExtraFieldType

enum ExtraFieldType {
  TEXT
  NUMBER
  DATE
  SELECT
  MULTISELECT
  BOOLEAN
}

Mutations

createExtraCategory(category: CreateExtraCategoryInput!): CreateExtraCategoryPayload
updateExtraCategory(id: UUID!, category: UpdateExtraCategoryInput!): UpdateExtraCategoryPayload
archiveExtraCategories(archive: Boolean!, ids: [UUID!]!): ArchiveExtraCategoriesPayload

Mutations and updates in detail

Query: extraCategories by content type

query {
  extraCategories(contentType: GROUP) {
    id
    title
  }
}

CreateExtraCategory

mutation {
  createExtraCategory(
    extraCategoryInput: {
      name: "Target Groups"
      color: "#00AAFF"
      filter: true
      showLabel: true
      categoryType: MULTISELECT
      forModelTypes: [GROUP]
      multipleChoices: true
      choiceOptions: [
        { stringValue: "MBO", color: "#F7C100" }
        { stringValue: "HBO", color: "#FF6600" }
      ]
    }
  ) {
    extraCategory {
      id
      title
    }
  }
}

UpdateExtraCategory

mutation {
  updateExtraCategory(
    id: "uuid-here"
    extraCategoryInput: {
      name: "New title"
      showLabel: false
      forModelTypes: [GROUP, OFFER]
    }
  ) {
    extraCategory {
      id
      title
    }
  }
}

UpdateExtraCategoryValues

mutation {
  updateExtraCategoryValues(
    contentType: GROUP
    modelId: "uuid-of-group"
    values: [
      {
        categoryId: "uuid-of-category"
        choiceValues: [{ stringValue: "HBO" }]
      },
      {
        categoryRef: "birthdate"
        datetimeValue: "1990-01-01T00:00:00Z"
      }
    ]
  ) {
    extraCategoryValues {
      ... on ExtraCategoryChoiceValue {
        choiceValue {
          stringValue
        }
      }
      ... on ExtraCategoryDatetimeValue {
        datetimeValue
      }
    }
  }
}

Notes

  • Only the correct field value may be used within ExtraCategoryValuesUpdateInput, depending on the type (stringValue, booleanValue, datetimeValue, choiceValues).
  • Choice options can be controlled via id or ref.
  • The Color value must be provided in hex code, for example #FF9900.
Schließ die Richtung