Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ env:
PYTHON_VERSION: 3.10.x

jobs:
check-formatting:
name: YAML formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: |
npx prettier --check *.yml collections/
validate-models:
name: CI
runs-on: ubuntu-latest
Expand Down
13 changes: 6 additions & 7 deletions .github/workflows/pick-to-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
types:
- closed
branches:
- 'main'

- "main"

jobs:
create-pr-for-staging:
Expand Down Expand Up @@ -41,20 +40,20 @@ jobs:
fi

- name: Fetch and checkout latest staging branch
if: env.skip_pick != 'true' # Conditional execution
Comment thread
bastianjoel marked this conversation as resolved.
if: env.skip_pick != 'true' # Conditional execution
run: |
branch=$(git ls-remote --heads origin '${{ matrix.label }}/*' | awk 'gsub(".*refs/heads/","")' | sort -V | tail -1)
git fetch origin $branch
git checkout $branch

- name: Set git credentials
if: env.skip_pick != 'true' # Conditional execution
if: env.skip_pick != 'true' # Conditional execution
run: |
git config --global user.name openslides-automation
git config --global user.email openslides-automation@users.noreply.github.com

- name: Cherry-pick new commit
if: env.skip_pick != 'true' # Conditional execution
if: env.skip_pick != 'true' # Conditional execution
id: cherry-pick
run: |
git fetch origin
Expand All @@ -66,15 +65,15 @@ jobs:
}

- name: Generate access token
if: env.skip_pick != 'true' # Conditional execution
if: env.skip_pick != 'true' # Conditional execution
uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.AUTOMATION_APP_ID }}
private_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }}

- name: Create or update PR
if: env.skip_pick != 'true' # Conditional execution
if: env.skip_pick != 'true' # Conditional execution
uses: peter-evans/create-pull-request@v8
with:
token: ${{ steps.generate-token.outputs.token }}
Expand Down
97 changes: 44 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
This shared repository holds all relevant (meta) data. Other services may include
it as a sub-repository to have access to its data.


## Collections

The datastructure of OpenSlides is defined by a list of collections. For each
Expand All @@ -13,62 +12,54 @@ collection, there is a file in the `collections` directory. The file
Each collection-file has the following format:

- Length of names:
- field name: Their length is limited to 25 characters. There are still some
fields with longer names, that has to be shortened
- field name: Their length is limited to 25 characters. There are still some
fields with longer names, that has to be shortened
- Types:
- Nativ datatypes: text, string (text with maxLength=256), number, boolean, JSON
- HTMLStrict: A string with HTML content.
- HTMLPermissive: A string with HTML content (with video tags).
- float: Numbers that are expected to be non-integer. Formatted as in rfc7159.
- decimal(X): Decimal values represented as a string with X decimal places.
At the moment we support only X == 6.
- timestamp: Datetime as a utc datetime object.
- timezone: Text field with the constraint that the content must be a valid timezone string as far as the postgres database is concerned. (i.e. the `name` values from postgres-inbuilt view `pg_timezone_names`)
- <T>[]: This indicates and arbitrary array of the given type. At the moment
we support only some types. You can add JSON Schema properties for items
using the extra property `items`
- color: string that must match ^#[0-9a-f]{6}$
- Nativ datatypes: text, string (text with maxLength=256), number, boolean, JSON
- HTMLStrict: A string with HTML content.
- HTMLPermissive: A string with HTML content (with video tags).
- float: Numbers that are expected to be non-integer. Formatted as in rfc7159.
- decimal(X): Decimal values represented as a string with X decimal places.
At the moment we support only X == 6.
- timestamp: Datetime as a utc datetime object.
- timezone: Text field with the constraint that the content must be a valid timezone string as far as the postgres database is concerned. (i.e. the `name` values from postgres-inbuilt view `pg_timezone_names`)
- <T>[]: This indicates and arbitrary array of the given type. At the moment
we support only some types. You can add JSON Schema properties for items
using the extra property `items`
- color: string that must match ^#[0-9a-f]{6}$
- Relations:
- We have the following types: `relation`, `relation-list`, `generic-relation`
and `generic-relation-list`.
- Non-generic relations: The simple syntax for such a field
`to: <collection>/<field>`. This is a reference to a collection. The reverse
relation field in this collection is <field>. E. g. in a motion the field
`category_id` links to one category where the field `motion_ids` contains the
motion id. The simple notation for the field is `motion_category/motion_ids`.
The reverse field has type `relation-list` and is related back to
`motion/category_id`. The type indicates that there are many
motion ids.
- Generic relations: The difference to non-generic relations is that you have a
list of possible fields, so `to` can either hold multiple collections (if the
field name is the same):
to:
collections:
- agenda_item
- assignment
- ...
field: tag_ids
Or `to` can be a list of collection fields:
to:
- motion/option_ids
- user/option_$_ids
- on_delete: This fields determines what should happen with the foreign model if
this model gets deleted. Possible values are:
- SET_NULL (default): delete the id from the foreign key
- PROTECT: if the foreign key is not empty, throw an error instead of
deleting the object
- CASCADE: also delete all models in this foreign key
- We have the following types: `relation`, `relation-list`, `generic-relation`
and `generic-relation-list`.
- Non-generic relations: The simple syntax for such a field
`to: <collection>/<field>`. This is a reference to a collection. The reverse
relation field in this collection is <field>. E. g. in a motion the field
`category_id` links to one category where the field `motion_ids` contains the
motion id. The simple notation for the field is `motion_category/motion_ids`.
The reverse field has type `relation-list` and is related back to
`motion/category_id`. The type indicates that there are many
motion ids.
- Generic relations: The difference to non-generic relations is that you have a
list of possible fields, so `to` can either hold multiple collections (if the
field name is the same):
to:
collections: - agenda*item - assignment - ...
field: tag_ids
Or `to` can be a list of collection fields:
to: - motion/option_ids - user/option*$\_ids
- on_delete: This fields determines what should happen with the foreign model if
this model gets deleted. Possible values are: - SET_NULL (default): delete the id from the foreign key - PROTECT: if the foreign key is not empty, throw an error instead of
deleting the object - CASCADE: also delete all models in this foreign key
- JSON Schema Properties:
- You can add JSON Schema properties to the fields like `enum`, `description`,
`items`, `maxLength` and `minimum`
- You can add JSON Schema properties to the fields like `enum`, `description`,
`items`, `maxLength` and `minimum`
- Additional properties:
- The property `read_only` describes a field that can not be changed by an action.
- The property `default` describes the default value that is used for new objects.
- The property `required` describes that this field can not be null or an empty
string. If this field is given it must have some content. On relation and generic-relation
fields the value as to be an id of an existing object.
- The property `equal_fields` describes fields that must have the same value in
the instance and the related instance.
- The property `read_only` describes a field that can not be changed by an action.
- The property `default` describes the default value that is used for new objects.
- The property `required` describes that this field can not be null or an empty
string. If this field is given it must have some content. On relation and generic-relation
fields the value as to be an id of an existing object.
- The property `equal_fields` describes fields that must have the same value in
the instance and the related instance.
- Restriction Mode:
The field `restriction_mode` is required for every field. It puts the field into a
restriction group. See https://github.com/OpenSlides/OpenSlides/wiki/Restrictions-Overview
42 changes: 21 additions & 21 deletions collection-meta.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
enum_definitions:
languages:
- en
- de
- it
- es
- ru
- cs
- fr
- en
- de
- it
- es
- ru
- cs
- fr
ballot_paper_selection:
- NUMBER_OF_DELEGATES
- NUMBER_OF_ALL_PARTICIPANTS
- CUSTOM_NUMBER
- NUMBER_OF_DELEGATES
- NUMBER_OF_ALL_PARTICIPANTS
- CUSTOM_NUMBER
poll_backends:
- long
- fast
- long
- fast
onehundred_percent_bases:
- Y
- YN
- YNA
- N
- valid
- cast
- entitled
- entitled_present
- disabled
- Y
- YN
- YNA
- N
- valid
- cast
- entitled
- entitled_present
- disabled
id_field: &id_field
type: number
restriction_mode: A
Expand Down
7 changes: 3 additions & 4 deletions collections/action_worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ fields:
type: string
required: true
enum:
- running
- end
- aborted
- running
- end
- aborted
restriction_mode: A
created:
type: timestamp
Expand All @@ -34,4 +34,3 @@ fields:
required: true
restriction_mode: A
constant: true

19 changes: 9 additions & 10 deletions collections/agenda_item.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ fields:
type:
type: string
enum:
- common
- internal
- hidden
- common
- internal
- hidden
default: common
restriction_mode: A
duration:
Expand Down Expand Up @@ -50,16 +50,16 @@ fields:
content_object_id:
type: generic-relation
reference:
- motion
- motion_block
- assignment
- topic
to:
collections:
- motion
- motion_block
- assignment
- topic
to:
collections:
- motion
- motion_block
- assignment
- topic
field: agenda_item_id
required: true
equal_fields: meeting_id
Expand Down Expand Up @@ -94,4 +94,3 @@ fields:
required: true
restriction_mode: A
constant: true

7 changes: 3 additions & 4 deletions collections/assignment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ fields:
phase:
type: string
enum:
- search
- voting
- finished
- search
- voting
- finished
default: search
restriction_mode: A
default_poll_description:
Expand Down Expand Up @@ -94,4 +94,3 @@ fields:
type: relation-list
to: history_entry/model_id
restriction_mode: A

1 change: 0 additions & 1 deletion collections/assignment_candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ fields:
required: true
restriction_mode: A
constant: true

3 changes: 1 addition & 2 deletions collections/chat_group.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
unique_together:
- meeting_id, name
- meeting_id, name

fields:
id:
Expand Down Expand Up @@ -39,4 +39,3 @@ fields:
required: true
restriction_mode: A
constant: true

1 change: 0 additions & 1 deletion collections/chat_message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ fields:
required: true
restriction_mode: A
constant: true

4 changes: 2 additions & 2 deletions collections/committee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ fields:
type: relation-list
to: committee/parent_id
restriction_mode: A
all_parent_ids: # Calculated: All parents, grandparents, etc. of this motion.
all_parent_ids: # Calculated: All parents, grandparents, etc. of this motion.
type: relation-list
to: committee/all_child_ids
restriction_mode: A
all_child_ids: # Calculated: All children, grandchildren, etc. of this motion.
all_child_ids: # Calculated: All children, grandchildren, etc. of this motion.
type: relation-list
to: committee/all_parent_ids
restriction_mode: A
Expand Down
1 change: 0 additions & 1 deletion collections/gender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,3 @@ fields:
to: user/gender_id
restriction_mode: A
reference: user

Loading