-
Notifications
You must be signed in to change notification settings - Fork 104
Description
Is your feature request related to a problem? Please describe.
Currently, FastCRUD provides support for many-to-many relationships on the read side through get_joined and get_multi_joined. However, there is no built-in mechanism for writing M2M relationships — i.e., automatically syncing association table records when creating or updating entities via EndpointCreator / crud_router.
When you have a many-to-many relationship (For example: project <-> participant through an association table) and want to manage the set of related entities through the API, you need to manually handle the association table. For example, if a client sends an update request with participant_ids: [1, 3, 5], the endpoint needs to:
- Validate that the provided IDs exist in the related table
- Clear existing rows in the association table for this record
- Insert new association rows reflecting the updated set of relationships
For create, the same applies — after inserting the main record, the association rows need to be populated based on the provided list of related IDs.
None of this is handled by EndpointCreator today, so every project with M2M writes has to implement this logic manually.
What do you think? Is there any way to add this?