View Source ExTeal.Api.ManyToMany (ExTeal v0.27.0)
API Responder that manages the many to many relationships via:
GET attachable
- Querying the potentially relatedPOST attach
- Adding a related resourceDELETE detach
- Removing a related resourceGET creation-pivot-fields
- Fetch the pivot fields associated with a relationship
Summary
Functions
Given a request of POST /api/posts/1/attach/tags
that contains a set of params like
Given a request of GET /api/resource_uri/resource_id/attachable/field_name
This function returns a response that contains the attachable schemas associated with the many to many relationship at field_name
Returns a list of fields associated with the pivot table of a many to many relationship. Fields are only for attaching to a many to many
Given a request of DELETE /api/posts/1/attach/tags/2
that contains a set of params like
Batch Updates a pivot schema's fields for reordering a relationship
Returns a list of fields associated with the pivot table of a many to many relationship for an existing relationship.
Returns a list of fields associated with the pivot table of a many to many relationship for an existing relationship.
Functions
Given a request of POST /api/posts/1/attach/tags
that contains a set of params like:
%{
"viaRelationship" => "tags",
"tags" => "2"
}
This function attaches the tag with id 2 to the posts tags relationship.
Given a request of GET /api/resource_uri/resource_id/attachable/field_name
This function returns a response that contains the attachable schemas associated with the many to many relationship at field_name
Returns a list of fields associated with the pivot table of a many to many relationship. Fields are only for attaching to a many to many
Given a request of DELETE /api/posts/1/attach/tags/2
that contains a set of params like:
This function detaches the tag with id 2 from the posts tags relationship.
Batch Updates a pivot schema's fields for reordering a relationship
update_pivot(conn, resource_uri, resource_id, field_name, related_id)
View SourceReturns a list of fields associated with the pivot table of a many to many relationship for an existing relationship.
update_pivot_fields(conn, resource_uri, resource_id, field_name, related_id)
View SourceReturns a list of fields associated with the pivot table of a many to many relationship for an existing relationship.