Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: multi file question #1821

Merged
merged 3 commits into from
Aug 5, 2022
Merged

Conversation

winged
Copy link
Contributor

@winged winged commented Jul 13, 2022

Re-merge the feature from #1809

Change the model to allow multiple files per answer to be stored. Migrate
the existing questions to the new question type, and migrate the existing
answers to the new schema.

Updated the GraphQL schema to allow saving and updating multiple files
on an answer. The answer's value is a list of dicts, each containing
a file name, and optionally an ID. When you're creating new files,
add an entry without ID to the value. Caluma will then save the file,
and return it back WITH and ID.

BREAKING CHANGE: This renames the question type constant for file questions,
and changes the semantics of the answer value for file questions as well:
It is now a list of dicts instead of a single string. The response type
for querying file(s) answers now also is a list instead of a single dict.

For details / RFC see #1780

Dependencies:

Supersedes #1813 which is incomplete

winged added 3 commits July 13, 2022 09:15
The original Graphene API allows adding an `Input` (or, without Relay, a
`Arguments`) class to be added on mutation classes. Caluma derives it's
inputs solely from the attached serializer.

This fails if the required data type is more complex than what can
be represented on the serializer, whose most complex type is a list
of strings.

However, we need a list of well-defined objects, so we check on the
mutation class to see if a more specific field type is declared, and
use that one in the schema.
The reopen case mutation had a "required" ID in the schema, but when
regenerating, the requiredness was removed. Thus, adding an explicit
`required=True` to keep the semantics as has been.

Implicitly, the schema takes on the docstring of the `workItems` parameter
as well
Change the model to allow multiple files per answer to be stored. Migrate
the existing questions to the new question type, and migrate the existing
answers to the new schema.

Updated the GraphQL schema to allow saving and updating multiple files
on an answer. The answer's value is a list of dicts, each containing
a file name, and optionally an ID. When you're creating new files,
add an entry without ID to the value. Caluma will then save the file,
and return it back WITH and ID.

BREAKING CHANGE: This renames the question type constant for file questions,
and changes the semantics of the answer value for file questions as well:
It is now a list of dicts instead of a single string. The response type
for querying file(s) answers now also is a list instead of a single dict.
@winged winged changed the title Feat multi file question Feat: multi file question Jul 13, 2022
caluma/caluma_form/domain_logic.py Show resolved Hide resolved
caluma/caluma_form/domain_logic.py Show resolved Hide resolved
caluma/caluma_form/domain_logic.py Show resolved Hide resolved
caluma/caluma_form/structure.py Show resolved Hide resolved
@winged winged merged commit 469892f into projectcaluma:main Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants