14.9.2.3 Enforcing More Complex Business Logic
Combine PL/SQL handlers with Duality Views to apply custom logic with much simpler code.
For example, via an AutoREST-enabled ACTION_ITEMS_DV duality view
endpoint, the document below would insert successfully with no team lead, and staff
member Georgia enrolled twice on the team.
{
"name": "New Product Pitch Deck",
"team": [
{"name": "David"},
{"name": "Georgia"},
{"name": "Jane"},
{"name": "Georgia"}
]
}Emerging duality view directives for validation, augmentation, and notification
are designed to extend what a view can enforce declaratively and may cover many common
cases. The example in the next section illustrates the full control approach,
routing REST API changes through a PL/SQL "gatekeeper" package. It uses
ACTION_ITEMS_DV and applies the application's defaulting and
business rules, such as "One Lead per Team", "Team Must Have a Lead", and
"No Duplicates".
Parent topic: Exploring ORDS AutoREST for Duality View