*_one_of constraints in collections

Open
#540 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
sql
Domain
databases

Research direction

Start by locating the collection files and the model-level constraint triggers mentioned in the issue. Trace how existing collection constraints are defined and validated, then verify support for maximum_one_of, minimum_one_of, and exactly_one_of using the listed field combinations. Done means each trigger type raises an error for its invalid selection cases.

Written by the indexing model from the issue text.

Description

enhancement

In the collection files it should be possible to define a list of fields, that will be checked together in the model-level constraint triggers. Depending on the trigger type, error should be raised if:

  • maximum_one_of: More than one of the fields from the list is selected. Example:
    • motion: [lead_motion_id, diff_version]
  • minimum_one_of: None of the fields from the list is selected. Example:
    • personal_note: [star, note]
  • exactly_one_of: None or more than one of the fields from the list is selected. Examples:
    • poll_option: [meeting_user_id, text]
    • meeting_poll_default: [used_as_assignment_poll_config_in_meeting_id, used_as_motion_poll_config_in_meeting_id, used_as_topic_poll_config_in_meeting_id] (Note: these are view fields).
Dominant language
PLpgSQL
Stars
0
Forks
25
Avg merge
2d 1h
Merged PRs (30d)
16

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenSlides/openslides-meta

All issues in OpenSlides/openslides-meta

Similar issues

More Databases issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.