ask-and-trust - v1.1.0
    Preparing search index...

    CategoryResolver

    Handles all survey category-related GraphQL mutations and queries.

    Index

    Constructors

    Methods

    • Query to get a specific survey category by ID.

      Parameters

      • id: number

        The ID of the category to fetch.

      Returns Promise<null | Category>

      A Promise that resolves to a Category object if found, or null if no category is found.

      This query retrieves a specific survey category by its ID, along with its associated surveys.

    • Mutation to delete an existing survey category.

      Parameters

      • id: number

        The ID of the category to delete.

      • context: Context

        The context object that contains the currently authenticated user.

      Returns Promise<null | Category>

      A Promise that resolves to the deleted Category object, or null if the category could not be found or deleted.

      This mutation allows an admin user to delete an existing survey category. Only the admin can delete categories. If the user is not an admin, the mutation will not be executed.

    • Mutation to update an existing survey category.

      Parameters

      • id: number

        The ID of the category to update.

      • data: UpdateCategoryInput
      • context: Context

        The context object that contains the currently authenticated user.

      Returns Promise<null | Category>

      A Promise that resolves to the updated Category object, or null if the category could not be found or updated.

      This mutation allows an admin user to update an existing survey category. Only the admin can update categories. If the user is not an admin, the mutation will not be executed.