backend.routers.surveys
Survey router.
Handles CRUD operations for member feedback surveys: creating, releasing and closing surveys, managing individual survey fields and collecting per-user responses.
Requires authentication. Create/update/delete operations additionally
require the editor or admin role.
Prefix: /surveys | Tag: surveys
- backend.routers.surveys.get_surveys_from_db(db, skip=0, limit=20)[Quellcode]
Query the database for surveys ordered by creation date.
- Parameter:
- Rückgabe:
List of survey objects.
- Rückgabetyp:
- backend.routers.surveys.read_surveys(db=Depends(dependency=<function get_db>, use_cache=True, scope=None), skip=0, limit=Query(20), current=Depends(dependency=<function get_current_user>, use_cache=True, scope=None))[Quellcode]
Returns a list of surveys.
- Parameter:
db (sqlalchemy.orm.Session) – Database session (injected automatically)
skip (int) – Number of entries to skip (pagination)
limit (int) – Maximum number of surveys to return (max. 100)
current (User) – Currently authenticated user (injected automatically)
- Rückgabe:
List of surveys, sorted by release date (descending)
- Rückgabetyp:
List[schemas.SurveyList]
- backend.routers.surveys.create_survey(survey, db=Depends(dependency=<function get_db>, use_cache=True, scope=None), current=Depends(dependency=<function get_current_user>, use_cache=True, scope=None))[Quellcode]
Create a new survey. :param survey: Survey data :param db: Database session (injected automatically) :param current: Currently authenticated user (injected automatically) :return: The created survey
- backend.routers.surveys.read_survey(survey_id, db=Depends(dependency=<function get_db>, use_cache=True, scope=None), current=Depends(dependency=<function get_current_user>, use_cache=True, scope=None))[Quellcode]
Returns a single survey by its ID.
- Parameter:
survey_id (int) – The ID of the survey
db (sqlalchemy.orm.Session) – Database session (injected automatically)
current (User) – Currently authenticated user (injected automatically)
- Rückgabe:
The survey with its associated questions
- Rückgabetyp:
- Verursacht:
HTTPException 404 – If no survey with the given ID is found
- backend.routers.surveys.update_survey_feedback(survey_id, feedbacks, db=Depends(dependency=<function get_db>, use_cache=True, scope=None), current=Depends(dependency=<function get_current_user>, use_cache=True, scope=None))[Quellcode]
Update or create feedback entries for survey fields.
- Parameter:
survey_id (int) – The ID of the survey
feedbacks (List[SurveyFeedbackOut]) – List of feedback entries to update or create
db (Session) – Database session (injected automatically)
current – Currently authenticated user (injected automatically)
- Rückgabe:
The updated survey with all fields and feedback
- Verursacht:
HTTPException 404 – If survey or survey field not found
- backend.routers.surveys.delete_survey(survey_id, db=Depends(dependency=<function get_db>, use_cache=True, scope=None), current=Depends(dependency=<function get_current_user>, use_cache=True, scope=None))[Quellcode]
Delete a survey by its ID.
- Parameter:
- Rückgabe:
List of remaining surveys after deletion
- Verursacht:
HTTPException 404 – If no survey with the given ID is found
- backend.routers.surveys.close_survey(survey_id, db=Depends(dependency=<function get_db>, use_cache=True, scope=None), current=Depends(dependency=<function get_current_user>, use_cache=True, scope=None))[Quellcode]
Close a survey by its ID.
- backend.routers.surveys.send_reminder(survey_id, db=Depends(dependency=<function get_db>, use_cache=True, scope=None), current=Depends(dependency=<function get_current_user>, use_cache=True, scope=None))[Quellcode]
Send a reminder for a survey.