Mutation to create a new survey question.
The input content for creating the question (title, type, answers, etc.).
The GraphQL context containing the authenticated user.
A Promise that resolves to the newly created Questions object.
This mutation allows an authenticated user ("user" or "admin" role) to create a new question. The created question is optionally linked to a survey and associated with the authenticated user.
Mutation to delete an existing survey question.
The ID of the question to delete.
The context object that contains the currently authenticated user.
A Promise that resolves to the deleted Question object, or null if the question could not be found or deleted.
This mutation allows an admin or user to delete an existing survey question. Only the admin or question owner can delete questions. If the user is not an admin or question owner, the mutation will not be executed.
Query to get a specific survey question by ID.
The ID of the question to retrieve.
A Promise that resolves to the corresponding Questions object, or null if not found.
This query fetches a specific question based on its ID, including its related survey.
Query to get all survey questions.
A Promise that resolves to an array of Questions objects.
This query retrieves all questions, including their associated survey.
Mutation to update an existing survey question.
The ID of the question to update.
The context object that contains the currently authenticated user.
A Promise that resolves to the updated Questions object, or null if the question could not be found or updated.
This mutation allows an admin user to update an existing survey question. Only the admin or the question owner can update questions. If the user is not an admin, the mutation will not be executed.
QuestionsResolver
Description
Handles all GraphQL operations related to survey questions.