Implement Django db models for forms, and form management endpoints #4510
Labels
ready
Ready for implementation
restricted: maintainers
Only maintainers can resolve this issue
type: enhancement
work: backend
Related to Python, Django, and simple SQL
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Description
Out of scope of this issue
Details
1. Forms Django DB models and necessary migrations.
Form
andFormField
is left to the implementer.2. Form management RPC methods:
forms.add
FormDefinition
.FormDefinition
should be filled in at the backend service layer:created_at
updated_at
target_table_oid
withinForeignKeyField
(it could be sent from the frontend, if it'll make work easier on the backend).submission.submission_role
- Use if provided by the frontend. If not provided, infer fromownercurrent logged-in user.owner
- Use if provided by the frontend. If not provided, infer from current logged-in user.submission.submission_role
is provided by the user, the backend should validate whether the logged in user has access to the submission_role.Whenowner
is provided by the user, the backend should ensure that:the owner id is the same as that of the current logged-in user, orthe current logged-in user is a Mathesar admin (who could set the owner to anyone).nested_fields
should belong to the table with the oid:target_table_oid
(in case of foreign key parent fields),linked_table_oid
(in case of reverse foreign key parent fields).forms.get
field_source_analysis_map
. This is a map of all field ids with their respective column definitions. This might extend to provide additional information in the future based on frontend needs.null
infield_source_analysis_map[FormField['column_oid']].column
, andfield_source_analysis_map[FormField['column_oid']].error
.forms.get_public
forms.get
minus the following fields in the form definition:owner
submission['submission_role]
// other data insubmission
should be sent in responsesubmission['on_submit']
public_sharing
forms.get
is split into two methods for the form definition & the field_source_analysis_map, same should be done for this method. In that scenario, the method for field_source_analysis_map should be unauthenticated.forms.replace
Only the owner of a form or a Mathesar admin can perform this request to replace the form.forms.add
with an additional form id,id: FormDefinition['id']
.forms.add
should be done informs.replace
.forms.list
forms.delete
Only the owner or a Mathesar admin can perform this request to delete the form.The text was updated successfully, but these errors were encountered: