diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml index a08cbf88..90a2f427 100644 --- a/.github/workflows/continuous_integration.yml +++ b/.github/workflows/continuous_integration.yml @@ -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 diff --git a/.github/workflows/pick-to-staging.yml b/.github/workflows/pick-to-staging.yml index b8226dab..be26efe6 100644 --- a/.github/workflows/pick-to-staging.yml +++ b/.github/workflows/pick-to-staging.yml @@ -5,8 +5,7 @@ on: types: - closed branches: - - 'main' - + - "main" jobs: create-pr-for-staging: @@ -41,20 +40,20 @@ jobs: fi - name: Fetch and checkout latest staging branch - if: env.skip_pick != 'true' # Conditional execution + 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 @@ -66,7 +65,7 @@ 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: @@ -74,7 +73,7 @@ jobs: 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 }} diff --git a/README.md b/README.md index d8c3d68e..e5fa96bf 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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`) - - []: 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`) + - []: 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: /`. This is a reference to a collection. The reverse - relation field in this collection is . 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: /`. This is a reference to a collection. The reverse + relation field in this collection is . 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 diff --git a/collection-meta.yml b/collection-meta.yml index 6ca75919..d8e05c7a 100644 --- a/collection-meta.yml +++ b/collection-meta.yml @@ -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 diff --git a/collections/action_worker.yml b/collections/action_worker.yml index f79a11b9..99c0a15e 100644 --- a/collections/action_worker.yml +++ b/collections/action_worker.yml @@ -13,9 +13,9 @@ fields: type: string required: true enum: - - running - - end - - aborted + - running + - end + - aborted restriction_mode: A created: type: timestamp @@ -34,4 +34,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/agenda_item.yml b/collections/agenda_item.yml index ec06485a..ce07e2ab 100644 --- a/collections/agenda_item.yml +++ b/collections/agenda_item.yml @@ -18,9 +18,9 @@ fields: type: type: string enum: - - common - - internal - - hidden + - common + - internal + - hidden default: common restriction_mode: A duration: @@ -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 @@ -94,4 +94,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/assignment.yml b/collections/assignment.yml index 911ad1e2..78d26856 100644 --- a/collections/assignment.yml +++ b/collections/assignment.yml @@ -20,9 +20,9 @@ fields: phase: type: string enum: - - search - - voting - - finished + - search + - voting + - finished default: search restriction_mode: A default_poll_description: @@ -94,4 +94,3 @@ fields: type: relation-list to: history_entry/model_id restriction_mode: A - diff --git a/collections/assignment_candidate.yml b/collections/assignment_candidate.yml index ac922462..f4cb1654 100644 --- a/collections/assignment_candidate.yml +++ b/collections/assignment_candidate.yml @@ -31,4 +31,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/chat_group.yml b/collections/chat_group.yml index f29a71d2..8e453fbc 100644 --- a/collections/chat_group.yml +++ b/collections/chat_group.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_id, name + - meeting_id, name fields: id: @@ -39,4 +39,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/chat_message.yml b/collections/chat_message.yml index ad8c4820..0137e4c3 100644 --- a/collections/chat_message.yml +++ b/collections/chat_message.yml @@ -33,4 +33,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/committee.yml b/collections/committee.yml index 8e2d695e..451c5ad5 100644 --- a/collections/committee.yml +++ b/collections/committee.yml @@ -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 diff --git a/collections/gender.yml b/collections/gender.yml index de70c0a5..c07087ea 100644 --- a/collections/gender.yml +++ b/collections/gender.yml @@ -22,4 +22,3 @@ fields: to: user/gender_id restriction_mode: A reference: user - diff --git a/collections/group.yml b/collections/group.yml index 34e30f08..a3e98b39 100644 --- a/collections/group.yml +++ b/collections/group.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_id, external_id + - meeting_id, external_id fields: id: @@ -19,49 +19,49 @@ fields: type: string[] items: enum: - - agenda_item.can_manage - - agenda_item.can_see - - agenda_item.can_see_internal - - assignment.can_manage - - assignment.can_manage_polls - - assignment.can_nominate_other - - assignment.can_nominate_self - - assignment.can_see - - chat.can_manage - - list_of_speakers.can_be_speaker - - list_of_speakers.can_manage - - list_of_speakers.can_see - - list_of_speakers.can_manage_moderator_notes - - list_of_speakers.can_see_moderator_notes - - mediafile.can_manage - - mediafile.can_see - - meeting.can_manage_logos_and_fonts - - meeting.can_manage_settings - - meeting.can_see_autopilot - - meeting.can_see_frontpage - - meeting.can_see_history - - meeting.can_see_livestream - - motion.can_create - - motion.can_create_amendments - - motion.can_forward - - motion.can_manage - - motion.can_manage_metadata - - motion.can_manage_polls - - motion.can_see - - motion.can_see_internal - - motion.can_see_origin - - motion.can_support - - poll.can_manage - - poll.can_see_progress - - projector.can_manage - - projector.can_see - - tag.can_manage - - user.can_manage - - user.can_manage_presence - - user.can_see_sensitive_data - - user.can_see - - user.can_update - - user.can_edit_own_delegation + - agenda_item.can_manage + - agenda_item.can_see + - agenda_item.can_see_internal + - assignment.can_manage + - assignment.can_manage_polls + - assignment.can_nominate_other + - assignment.can_nominate_self + - assignment.can_see + - chat.can_manage + - list_of_speakers.can_be_speaker + - list_of_speakers.can_manage + - list_of_speakers.can_see + - list_of_speakers.can_manage_moderator_notes + - list_of_speakers.can_see_moderator_notes + - mediafile.can_manage + - mediafile.can_see + - meeting.can_manage_logos_and_fonts + - meeting.can_manage_settings + - meeting.can_see_autopilot + - meeting.can_see_frontpage + - meeting.can_see_history + - meeting.can_see_livestream + - motion.can_create + - motion.can_create_amendments + - motion.can_forward + - motion.can_manage + - motion.can_manage_metadata + - motion.can_manage_polls + - motion.can_see + - motion.can_see_internal + - motion.can_see_origin + - motion.can_support + - poll.can_manage + - poll.can_see_progress + - projector.can_manage + - projector.can_see + - tag.can_manage + - user.can_manage + - user.can_manage_presence + - user.can_see_sensitive_data + - user.can_see + - user.can_update + - user.can_edit_own_delegation restriction_mode: A weight: type: number @@ -150,4 +150,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/history_entry.yml b/collections/history_entry.yml index 2bed1640..cb55e395 100644 --- a/collections/history_entry.yml +++ b/collections/history_entry.yml @@ -16,15 +16,15 @@ fields: type: generic-relation to: collections: - - user - - motion - - assignment + - user + - motion + - assignment field: history_entry_ids restriction_mode: A reference: - - user - - motion - - assignment + - user + - motion + - assignment position_id: type: relation to: history_position/entry_ids diff --git a/collections/history_position.yml b/collections/history_position.yml index 387b10c1..3487eefa 100644 --- a/collections/history_position.yml +++ b/collections/history_position.yml @@ -23,4 +23,3 @@ fields: to: history_entry/position_id restriction_mode: A on_delete: CASCADE - diff --git a/collections/import_preview.yml b/collections/import_preview.yml index b1f23796..a25a9fe8 100644 --- a/collections/import_preview.yml +++ b/collections/import_preview.yml @@ -9,19 +9,19 @@ fields: type: string required: true enum: - - account - - participant - - topic - - committee - - motion + - account + - participant + - topic + - committee + - motion restriction_mode: A state: type: string required: true enum: - - warning - - error - - done + - warning + - error + - done restriction_mode: A created: type: timestamp @@ -30,4 +30,3 @@ fields: result: type: JSON restriction_mode: A - diff --git a/collections/list_of_speakers.yml b/collections/list_of_speakers.yml index 8150ca40..bc74d405 100644 --- a/collections/list_of_speakers.yml +++ b/collections/list_of_speakers.yml @@ -24,18 +24,18 @@ fields: content_object_id: type: generic-relation reference: - - motion - - motion_block - - assignment - - topic - - meeting_mediafile - to: - collections: - motion - motion_block - assignment - topic - meeting_mediafile + to: + collections: + - motion + - motion_block + - assignment + - topic + - meeting_mediafile field: list_of_speakers_id required: true equal_fields: meeting_id @@ -66,4 +66,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/mediafile.yml b/collections/mediafile.yml index bb20db73..6f856774 100644 --- a/collections/mediafile.yml +++ b/collections/mediafile.yml @@ -1,5 +1,5 @@ unique_together_strict: -- title, parent_id, owner_id + - title, parent_id, owner_id fields: id: @@ -57,11 +57,11 @@ fields: owner_id: type: generic-relation to: - - meeting/mediafile_ids - - organization/mediafile_ids + - meeting/mediafile_ids + - organization/mediafile_ids reference: - - meeting - - organization + - meeting + - organization restriction_mode: A required: true constant: true diff --git a/collections/meeting.yml b/collections/meeting.yml index 964f9e66..0f7e3596 100644 --- a/collections/meeting.yml +++ b/collections/meeting.yml @@ -133,8 +133,8 @@ fields: applause_type: type: string enum: - - applause-type-bar - - applause-type-particles + - applause-type-bar + - applause-type-particles default: applause-type-bar restriction_mode: C applause_show_level: @@ -177,8 +177,8 @@ fields: export_csv_encoding: type: string enum: - - utf-8 - - iso-8859-15 + - utf-8 + - iso-8859-15 default: utf-8 restriction_mode: B export_csv_separator: @@ -188,9 +188,9 @@ fields: export_pdf_pagenumber_alignment: type: string enum: - - left - - right - - center + - left + - right + - center default: center restriction_mode: B export_pdf_fontsize: @@ -227,8 +227,8 @@ fields: export_pdf_pagesize: type: string enum: - - A4 - - A5 + - A4 + - A5 default: A4 restriction_mode: B @@ -248,25 +248,25 @@ fields: agenda_numeral_system: type: string enum: - - arabic - - roman + - arabic + - roman default: arabic restriction_mode: B agenda_item_creation: type: string enum: - - always - - never - - default_yes - - default_no + - always + - never + - default_yes + - default_no default: default_no restriction_mode: B agenda_new_items_default_visibility: type: string enum: - - common - - internal - - hidden + - common + - internal + - hidden default: internal restriction_mode: B agenda_show_internal_items_on_projector: @@ -378,9 +378,9 @@ fields: motions_default_line_numbering: type: string enum: - - outside - - inline - - none + - outside + - inline + - none default: outside restriction_mode: A motions_line_length: @@ -441,25 +441,25 @@ fields: motions_recommendation_text_mode: type: string enum: - - original - - changed - - diff - - agreed + - original + - changed + - diff + - agreed default: diff restriction_mode: B motions_default_sorting: type: string enum: - - number - - weight + - number + - weight default: number restriction_mode: B motions_number_type: type: string enum: - - per_category - - serially_numbered - - manually + - per_category + - serially_numbered + - manually default: per_category restriction_mode: B motions_number_min_digits: @@ -489,9 +489,9 @@ fields: motions_amendments_text_mode: type: string enum: - - freestyle - - fulltext - - paragraph + - freestyle + - fulltext + - paragraph default: paragraph restriction_mode: B motions_amendments_multiple_paragraphs: @@ -566,8 +566,8 @@ fields: motion_poll_projection_name_order_first: type: string enum: - - first_name - - last_name + - first_name + - last_name default: last_name required: true restriction_mode: B @@ -625,10 +625,10 @@ fields: type: string default: WPA enum: - - "" - - WEP - - WPA - - nopass + - "" + - WEP + - WPA + - nopass restriction_mode: B users_email_sender: type: string @@ -1188,4 +1188,3 @@ fields: type: relation-list to: history_entry/meeting_id restriction_mode: A - diff --git a/collections/meeting_mediafile.yml b/collections/meeting_mediafile.yml index faf7461a..6a81fdaa 100644 --- a/collections/meeting_mediafile.yml +++ b/collections/meeting_mediafile.yml @@ -1,5 +1,5 @@ unique_together: -- mediafile_id, meeting_id + - mediafile_id, meeting_id fields: id: @@ -48,9 +48,9 @@ fields: type: generic-relation-list to: collections: - - motion - - topic - - assignment + - motion + - topic + - assignment field: attachment_meeting_mediafile_ids restriction_mode: A @@ -119,4 +119,3 @@ fields: type: relation to: meeting/font_projector_h2_id restriction_mode: A - diff --git a/collections/meeting_user.yml b/collections/meeting_user.yml index 7e24ee78..34193ec8 100644 --- a/collections/meeting_user.yml +++ b/collections/meeting_user.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_id, user_id + - meeting_id, user_id fields: id: @@ -103,4 +103,3 @@ fields: equal_fields: meeting_id restriction_mode: A to: structure_level/meeting_user_ids - diff --git a/collections/motion.yml b/collections/motion.yml index 91884b9a..aafcbaeb 100644 --- a/collections/motion.yml +++ b/collections/motion.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_id, number + - meeting_id, number fields: id: @@ -113,22 +113,22 @@ fields: origin_id: type: relation reference: motion - to: motion/derived_motion_ids # Note: The related motions may not be in the same meeting + to: motion/derived_motion_ids # Note: The related motions may not be in the same meeting restriction_mode: A - origin_meeting_id: # The meeting of the motion in origin_id, if any + origin_meeting_id: # The meeting of the motion in origin_id, if any type: relation reference: meeting to: meeting/forwarded_motion_ids restriction_mode: A derived_motion_ids: type: relation-list - to: motion/origin_id # Note: The related motions may not be in the same meeting + to: motion/origin_id # Note: The related motions may not be in the same meeting restriction_mode: A - all_origin_ids: # Calculated: All parents (origin_id), grandparents, etc. of this motion. + all_origin_ids: # Calculated: All parents (origin_id), grandparents, etc. of this motion. type: relation-list to: motion/all_derived_motion_ids restriction_mode: A - all_derived_motion_ids: # Calculated: All children (derived_motion_ids), grandchildren, etc. of this motion. + all_derived_motion_ids: # Calculated: All children (derived_motion_ids), grandchildren, etc. of this motion. type: relation-list to: motion/all_origin_ids restriction_mode: A @@ -153,7 +153,7 @@ fields: type: generic-relation-list to: collections: - - motion + - motion field: referenced_in_motion_state_extension_ids equal_fields: meeting_id restriction_mode: C @@ -166,7 +166,7 @@ fields: type: generic-relation-list to: collections: - - motion + - motion field: referenced_in_motion_recommendation_extension_ids equal_fields: meeting_id restriction_mode: C @@ -284,4 +284,3 @@ fields: type: relation-list to: history_entry/model_id restriction_mode: A - diff --git a/collections/motion_block.yml b/collections/motion_block.yml index 0b8b8526..29abb42a 100644 --- a/collections/motion_block.yml +++ b/collections/motion_block.yml @@ -52,4 +52,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_category.yml b/collections/motion_category.yml index c47488df..9a24ae88 100644 --- a/collections/motion_category.yml +++ b/collections/motion_category.yml @@ -53,4 +53,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_change_recommendation.yml b/collections/motion_change_recommendation.yml index a1d14eed..4146b6eb 100644 --- a/collections/motion_change_recommendation.yml +++ b/collections/motion_change_recommendation.yml @@ -16,10 +16,10 @@ fields: type: type: string enum: - - replacement - - insertion - - deletion - - other + - replacement + - insertion + - deletion + - other default: replacement restriction_mode: A other_description: @@ -58,4 +58,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_comment.yml b/collections/motion_comment.yml index c8958ccc..f5acf31d 100644 --- a/collections/motion_comment.yml +++ b/collections/motion_comment.yml @@ -1,5 +1,5 @@ unique_together: -- motion_id, section_id + - motion_id, section_id fields: id: @@ -36,4 +36,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_comment_section.yml b/collections/motion_comment_section.yml index 9ca6729b..ee90da5a 100644 --- a/collections/motion_comment_section.yml +++ b/collections/motion_comment_section.yml @@ -48,4 +48,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_editor.yml b/collections/motion_editor.yml index c3e3029e..7fdb7524 100644 --- a/collections/motion_editor.yml +++ b/collections/motion_editor.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_user_id, motion_id + - meeting_user_id, motion_id fields: id: @@ -31,4 +31,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_state.yml b/collections/motion_state.yml index 23d8b7a7..c4a15d7b 100644 --- a/collections/motion_state.yml +++ b/collections/motion_state.yml @@ -1,5 +1,5 @@ unique_together: -- name, workflow_id + - name, workflow_id fields: id: @@ -25,11 +25,11 @@ fields: css_class: type: string enum: - - grey - - red - - green - - lightblue - - yellow + - grey + - red + - green + - lightblue + - yellow default: lightblue required: true restriction_mode: A @@ -37,10 +37,10 @@ fields: type: string[] items: enum: - - motion.can_see_internal - - motion.can_manage_metadata - - motion.can_manage - - is_submitter + - motion.can_see_internal + - motion.can_manage_metadata + - motion.can_manage + - is_submitter default: [] restriction_mode: A allow_support: @@ -70,9 +70,9 @@ fields: merge_amendment_into_final: type: string enum: - - do_not_merge - - undefined - - do_merge + - do_not_merge + - undefined + - do_merge default: undefined restriction_mode: A allow_motion_forwarding: @@ -94,30 +94,30 @@ fields: reference: motion_state to: motion_state/submitter_withdraw_back_ids equal_fields: - - meeting_id - - workflow_id + - meeting_id + - workflow_id restriction_mode: A submitter_withdraw_back_ids: type: relation-list to: motion_state/submitter_withdraw_state_id equal_fields: - - meeting_id - - workflow_id + - meeting_id + - workflow_id restriction_mode: A next_state_ids: type: relation-list to: motion_state/previous_state_ids equal_fields: - - meeting_id - - workflow_id + - meeting_id + - workflow_id restriction_mode: A previous_state_ids: type: relation-list to: motion_state/next_state_ids equal_fields: - - meeting_id - - workflow_id + - meeting_id + - workflow_id restriction_mode: A motion_ids: type: relation-list @@ -151,4 +151,3 @@ fields: restriction_mode: A constant: true deferred: true - diff --git a/collections/motion_submitter.yml b/collections/motion_submitter.yml index e95fe490..34f5bf8b 100644 --- a/collections/motion_submitter.yml +++ b/collections/motion_submitter.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_user_id, motion_id + - meeting_user_id, motion_id fields: id: @@ -31,4 +31,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_supporter.yml b/collections/motion_supporter.yml index 65dc1b83..4b50c195 100644 --- a/collections/motion_supporter.yml +++ b/collections/motion_supporter.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_user_id, motion_id + - meeting_user_id, motion_id fields: id: @@ -28,4 +28,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_workflow.yml b/collections/motion_workflow.yml index 1e2d63d1..15970c11 100644 --- a/collections/motion_workflow.yml +++ b/collections/motion_workflow.yml @@ -46,4 +46,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/motion_working_group_speaker.yml b/collections/motion_working_group_speaker.yml index aa133811..2cc942d8 100644 --- a/collections/motion_working_group_speaker.yml +++ b/collections/motion_working_group_speaker.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_user_id, motion_id + - meeting_user_id, motion_id fields: id: @@ -31,4 +31,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/option.yml b/collections/option.yml index a1c81a34..5bc57753 100644 --- a/collections/option.yml +++ b/collections/option.yml @@ -1,5 +1,5 @@ unique_together: -- content_object_id, poll_id + - content_object_id, poll_id fields: id: @@ -48,13 +48,13 @@ fields: content_object_id: type: generic-relation to: - - motion/option_ids - - user/option_ids - - poll_candidate_list/option_id + - motion/option_ids + - user/option_ids + - poll_candidate_list/option_id reference: - - motion - - user - - poll_candidate_list + - motion + - user + - poll_candidate_list equal_fields: meeting_id restriction_mode: A constant: true @@ -65,4 +65,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/organization.yml b/collections/organization.yml index 72f1758f..dd091ac6 100644 --- a/collections/organization.yml +++ b/collections/organization.yml @@ -175,4 +175,3 @@ fields: type: string default: https://example.com restriction_mode: A - diff --git a/collections/organization_tag.yml b/collections/organization_tag.yml index 21889a51..47018c55 100644 --- a/collections/organization_tag.yml +++ b/collections/organization_tag.yml @@ -18,8 +18,8 @@ fields: type: generic-relation-list to: collections: - - committee - - meeting + - committee + - meeting field: organization_tag_ids restriction_mode: A organization_id: @@ -29,4 +29,3 @@ fields: to: organization/organization_tag_ids restriction_mode: A required: true - diff --git a/collections/personal_note.yml b/collections/personal_note.yml index b4eee8da..9f1ecc36 100644 --- a/collections/personal_note.yml +++ b/collections/personal_note.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_user_id, content_object_id + - meeting_user_id, content_object_id fields: id: @@ -26,10 +26,10 @@ fields: content_object_id: type: generic-relation reference: - - motion + - motion to: collections: - - motion + - motion field: personal_note_ids equal_fields: meeting_id required: true @@ -42,4 +42,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/point_of_order_category.yml b/collections/point_of_order_category.yml index 8157046f..266eeb9d 100644 --- a/collections/point_of_order_category.yml +++ b/collections/point_of_order_category.yml @@ -25,4 +25,3 @@ fields: to: speaker/point_of_order_category_id equal_fields: meeting_id restriction_mode: A - diff --git a/collections/poll.yml b/collections/poll.yml index 7d4e86e8..cf3c56aa 100644 --- a/collections/poll.yml +++ b/collections/poll.yml @@ -16,10 +16,10 @@ fields: type: string required: true enum: - - analog - - named - - pseudoanonymous - - cryptographic + - analog + - named + - pseudoanonymous + - cryptographic restriction_mode: A backend: type: string @@ -34,18 +34,18 @@ fields: type: string required: true enum: - - "Y" - - "YN" - - "YNA" - - "N" + - "Y" + - "YN" + - "YNA" + - "N" restriction_mode: A state: type: string enum: - - created - - started - - finished - - published + - created + - started + - finished + - published default: created restriction_mode: A min_votes_amount: @@ -114,14 +114,14 @@ fields: content_object_id: type: generic-relation reference: - - motion - - assignment - - topic - to: - collections: - motion - assignment - topic + to: + collections: + - motion + - assignment + - topic field: poll_ids equal_fields: meeting_id restriction_mode: A @@ -164,4 +164,3 @@ fields: restriction_mode: A required: true constant: true - diff --git a/collections/poll_candidate.yml b/collections/poll_candidate.yml index 5a89216a..4bff56e6 100644 --- a/collections/poll_candidate.yml +++ b/collections/poll_candidate.yml @@ -30,4 +30,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/poll_candidate_list.yml b/collections/poll_candidate_list.yml index 0d48b3c6..ea37b8d0 100644 --- a/collections/poll_candidate_list.yml +++ b/collections/poll_candidate_list.yml @@ -26,4 +26,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/projection.yml b/collections/projection.yml index ee1cd191..719191d8 100644 --- a/collections/projection.yml +++ b/collections/projection.yml @@ -45,29 +45,29 @@ fields: content_object_id: type: generic-relation reference: - - meeting - - motion - - meeting_mediafile - - list_of_speakers - - motion_block - - assignment - - agenda_item - - topic - - poll - - projector_message - - projector_countdown + - meeting + - motion + - meeting_mediafile + - list_of_speakers + - motion_block + - assignment + - agenda_item + - topic + - poll + - projector_message + - projector_countdown to: - - meeting/projection_ids - - motion/projection_ids - - meeting_mediafile/projection_ids - - list_of_speakers/projection_ids - - motion_block/projection_ids - - assignment/projection_ids - - agenda_item/projection_ids - - topic/projection_ids - - poll/projection_ids - - projector_message/projection_ids - - projector_countdown/projection_ids + - meeting/projection_ids + - motion/projection_ids + - meeting_mediafile/projection_ids + - list_of_speakers/projection_ids + - motion_block/projection_ids + - assignment/projection_ids + - agenda_item/projection_ids + - topic/projection_ids + - poll/projection_ids + - projector_message/projection_ids + - projector_countdown/projection_ids equal_fields: meeting_id restriction_mode: A required: true diff --git a/collections/projector.yml b/collections/projector.yml index 872ba716..d46e551e 100644 --- a/collections/projector.yml +++ b/collections/projector.yml @@ -197,4 +197,3 @@ fields: restriction_mode: A required: true constant: true - diff --git a/collections/projector_countdown.yml b/collections/projector_countdown.yml index 10594c34..43b19d5d 100644 --- a/collections/projector_countdown.yml +++ b/collections/projector_countdown.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_id, title + - meeting_id, title fields: id: @@ -49,4 +49,3 @@ fields: restriction_mode: A required: true constant: true - diff --git a/collections/projector_message.yml b/collections/projector_message.yml index 5d63de33..5d140fd0 100644 --- a/collections/projector_message.yml +++ b/collections/projector_message.yml @@ -23,4 +23,3 @@ fields: restriction_mode: A required: true constant: true - diff --git a/collections/speaker.yml b/collections/speaker.yml index ff14e031..4228164e 100644 --- a/collections/speaker.yml +++ b/collections/speaker.yml @@ -28,11 +28,11 @@ fields: speech_state: type: string enum: - - contribution - - pro - - contra - - intervention - - interposed_question + - contribution + - pro + - contra + - intervention + - interposed_question restriction_mode: A answer: type: boolean @@ -79,4 +79,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/structure_level.yml b/collections/structure_level.yml index 6e203558..e7fffe12 100644 --- a/collections/structure_level.yml +++ b/collections/structure_level.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_id, name + - meeting_id, name fields: id: @@ -35,4 +35,3 @@ fields: reference: meeting to: meeting/structure_level_ids restriction_mode: A - diff --git a/collections/structure_level_list_of_speakers.yml b/collections/structure_level_list_of_speakers.yml index 88f195fa..e4357839 100644 --- a/collections/structure_level_list_of_speakers.yml +++ b/collections/structure_level_list_of_speakers.yml @@ -1,5 +1,5 @@ unique_together: -- meeting_id, structure_level_id, list_of_speakers_id + - meeting_id, structure_level_id, list_of_speakers_id fields: id: @@ -52,4 +52,3 @@ fields: to: meeting/structure_level_list_of_speakers_ids required: true restriction_mode: A - diff --git a/collections/tag.yml b/collections/tag.yml index 4e7512fa..9fabfbee 100644 --- a/collections/tag.yml +++ b/collections/tag.yml @@ -14,9 +14,9 @@ fields: type: generic-relation-list to: collections: - - agenda_item - - assignment - - motion + - agenda_item + - assignment + - motion field: tag_ids equal_fields: meeting_id restriction_mode: A @@ -27,4 +27,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/theme.yml b/collections/theme.yml index fe25ee05..f3e1b7e9 100644 --- a/collections/theme.yml +++ b/collections/theme.yml @@ -164,4 +164,3 @@ fields: to: organization/theme_ids restriction_mode: A required: true - diff --git a/collections/topic.yml b/collections/topic.yml index 60cdec83..c0eb92a8 100644 --- a/collections/topic.yml +++ b/collections/topic.yml @@ -61,4 +61,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/collections/user.yml b/collections/user.yml index 48a48336..cf43e566 100644 --- a/collections/user.yml +++ b/collections/user.yml @@ -83,9 +83,9 @@ fields: type: string description: Hierarchical permission level for the whole organization. enum: - - superadmin - - can_manage_organization - - can_manage_users + - superadmin + - can_manage_organization + - can_manage_users restriction_mode: B is_present_in_meeting_ids: type: relation-list @@ -197,4 +197,3 @@ fields: restriction_mode: F constant: true default: 1 - diff --git a/collections/vote.yml b/collections/vote.yml index 86ff57db..e68d4630 100644 --- a/collections/vote.yml +++ b/collections/vote.yml @@ -46,4 +46,3 @@ fields: required: true restriction_mode: A constant: true - diff --git a/dev/Dockerfile-prettier b/dev/Dockerfile-prettier new file mode 100644 index 00000000..f10b797a --- /dev/null +++ b/dev/Dockerfile-prettier @@ -0,0 +1,10 @@ +FROM node:24.14-alpine AS base + +# Setup +WORKDIR /app/ + +# Install prettier +RUN npm install -g prettier + +# Command +CMD ["sleep", "infinity"] diff --git a/dev/Makefile b/dev/Makefile index 699283a5..09720865 100644 --- a/dev/Makefile +++ b/dev/Makefile @@ -1,7 +1,7 @@ # Commands inside the container paths = src/ tests/ -all: pyupgrade black autoflake isort flake8 mypy sqlfluff +lint: pyupgrade black autoflake isort flake8 mypy sqlfluff pyupgrade: pyupgrade --py310-plus --exit-zero-even-if-changed $$(find . -name '*.py') @@ -9,6 +9,12 @@ pyupgrade: check-pyupgrade: pyupgrade --py310-plus $$(find . -name '*.py') +cleanup-yaml: + docker build -t meta-prettier-image -f Dockerfile-prettier . + docker run --rm -d --name meta-prettier-container -v ..:/app/ meta-prettier-image + docker exec meta-prettier-container prettier --write *.yml collections/ || true + docker stop meta-prettier-container + black: black $(paths) diff --git a/dev/doc/generate_sql_schema.md b/dev/doc/generate_sql_schema.md index 58183ac0..34d67571 100644 --- a/dev/doc/generate_sql_schema.md +++ b/dev/doc/generate_sql_schema.md @@ -15,8 +15,7 @@ As convinience property there is the collectionfield as combination of table_nam To get the table name use method **get_table_name** with the parameter of the collection name from the models.yml. The resulting name has a **T** for table to distinguish it from the view. -To get the view name use the method **get_view_name** with the parameter of the collection name from the models.yml. The view name is identical with that from models.yml, except for **group and user**, which are reserved names in sql. They will get an appended **_** to their name. - +To get the view name use the method **get_view_name** with the parameter of the collection name from the models.yml. The view name is identical with that from models.yml, except for **group and user**, which are reserved names in sql. They will get an appended **\_** to their name. ## Naming conventions for intermediate tables and views @@ -24,20 +23,20 @@ To get the view name use the method **get_view_name** with the parameter of the Because the base tables of these intermediate files are symmetric, the parts of the tables name are taken in an alphabetical order of their **collectionfields**. The name is build from parts -* nm_ Constant part to mark a n:m intermediate table -* table_name of the smaller **collectionfield** -* _ Constant divider -* field name of the smaller **collectionfield** -* _ Constant divider -* table name of the greater **collectionfield** +- nm\_ Constant part to mark a n:m intermediate table +- table_name of the smaller **collectionfield** +- \_ Constant divider +- field name of the smaller **collectionfield** +- \_ Constant divider +- table name of the greater **collectionfield** ### generic-relation-list versus relation-list The name of the intermediate table for **generic-relation-list** versus **relation-list** is always build from the generic-relation-lists side. -* gm_ Constant part to mark a genericc-list:m intermediate table -* table name of the generic-relation-list field -* _ Constant divider -* field name of the generic-relation-list field +- gm\_ Constant part to mark a genericc-list:m intermediate table +- table name of the generic-relation-list field +- \_ Constant divider +- field name of the generic-relation-list field -## Attributes and rules \ No newline at end of file +## Attributes and rules diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml index f7d0cd87..f978c1d8 100644 --- a/dev/docker-compose.yml +++ b/dev/docker-compose.yml @@ -1,32 +1,32 @@ version: "3" services: - models: - build: . - user: $USER_ID:$GROUP_ID - ports: - - 5678:5678 - volumes: - - ..:/app - environment: - - DATABASE_HOST=postgres - - DATABASE_PORT=5432 - - DATABASE_USER=openslides - - DATABASE_NAME=openslides - - PGPASSWORD=openslides + models: + build: . + user: $USER_ID:$GROUP_ID + ports: + - 5678:5678 + volumes: + - ..:/app + environment: + - DATABASE_HOST=postgres + - DATABASE_PORT=5432 + - DATABASE_USER=openslides + - DATABASE_NAME=openslides + - PGPASSWORD=openslides - depends_on: - - postgres - networks: - - postgres - postgres: - build: - context: . - dockerfile: Dockerfile-postgres - environment: - - POSTGRES_USER=openslides - - POSTGRES_PASSWORD=openslides - - POSTGRES_DB=openslides - networks: - - postgres + depends_on: + - postgres + networks: + - postgres + postgres: + build: + context: . + dockerfile: Dockerfile-postgres + environment: + - POSTGRES_USER=openslides + - POSTGRES_PASSWORD=openslides + - POSTGRES_DB=openslides + networks: + - postgres networks: - postgres: + postgres: diff --git a/permission.yml b/permission.yml index e6f05f38..3d696d7c 100644 --- a/permission.yml +++ b/permission.yml @@ -7,67 +7,67 @@ # implicitly agenda_item.can_see_internal and agenda_item.can_see. agenda_item: - can_manage: - can_see_internal: - can_see: + can_manage: + can_see_internal: + can_see: assignment: - can_manage: - can_nominate_other: - can_see: - can_manage_polls: - can_see: - can_nominate_self: - can_see: + can_manage: + can_nominate_other: + can_see: + can_manage_polls: + can_see: + can_nominate_self: + can_see: chat: - can_manage: + can_manage: list_of_speakers: - can_manage: - can_see: - can_be_speaker: - can_manage_moderator_notes: - can_see_moderator_notes: + can_manage: + can_see: + can_be_speaker: + can_manage_moderator_notes: + can_see_moderator_notes: mediafile: - can_manage: - can_see: + can_manage: + can_see: meeting: - can_manage_settings: - can_manage_logos_and_fonts: - can_see_frontpage: - can_see_autopilot: - can_see_livestream: - can_see_history: + can_manage_settings: + can_manage_logos_and_fonts: + can_see_frontpage: + can_see_autopilot: + can_see_livestream: + can_see_history: motion: - can_manage: - can_manage_metadata: - can_see: - can_see_internal: - can_see: - can_create: - can_see: - can_create_amendments: - can_see: - can_forward: - can_see: - can_manage_polls: - can_see: - can_support: - can_see: - can_see_origin: - can_see: + can_manage: + can_manage_metadata: + can_see: + can_see_internal: + can_see: + can_create: + can_see: + can_create_amendments: + can_see: + can_forward: + can_see: + can_manage_polls: + can_see: + can_support: + can_see: + can_see_origin: + can_see: poll: - can_manage: - can_see_progress: + can_manage: + can_see_progress: projector: - can_manage: - can_see: + can_manage: + can_see: tag: - can_manage: + can_manage: user: - can_manage: - can_manage_presence: - can_see: - can_update: - can_see_sensitive_data: - can_see: - can_edit_own_delegation: + can_manage: + can_manage_presence: + can_see: + can_update: + can_see_sensitive_data: can_see: + can_edit_own_delegation: + can_see: diff --git a/search.yml b/search.yml index aab29ff7..07026cda 100644 --- a/search.yml +++ b/search.yml @@ -135,7 +135,7 @@ motion: gender_id: type: relation collection: gender - fields: + fields: id: null name: null motion_change_recommendation: @@ -285,6 +285,6 @@ user: gender_id: type: relation collection: gender - fields: + fields: id: null - name: null \ No newline at end of file + name: null