intersystems / intersystems/isc-rest
REST-ifying existing model layers (ie. %ZEN.DataModel.ObjectDataModel)
- Dominant language
- ObjectScript
- Stars
- 5
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
In our application, we stripped out a model layer for accessing our `%Persistent` classes. The model classes inherit from `%ZEN.DataModel.ObjectDataModel`. They include business logic as triggers on loading or data manipulation, as well as in dedicated methods. We would like to reuse our model layer in a RESTful API. This would enable an _evolutionary_ migration to alternative web frontend frameworks, while the current UI stays fully functional.
`CRUD` operations could work as follows, distinguishing (R)eading one (`R-1`) and querying many (`R-n`) entities. The latter should be realized via `%Persistent` classes, bypassing the model's initialization logic invoked when loading a dedicated entity for viewing and/or editing.
`%ZEN.DataModel.ObjectDataModel `
- `R-1`: HTTP GET, (single ID) via `%OnLoadModel`
- `C, U`: HTTP POST/PUT, via `%OnStoreModel`
- `D`: HTTP DELETE, via `%OnDeleteSource`
`%Persistent`
- `R-n`: HTTP GET, query "`%pkg.isc.rest.model.adaptor` flavour"
With [isc-rest](https://github.com/intersystems/isc-rest) being a brilliant approach for REST-ifying existing `%Persistent` classes, extending its functionality for architectures with model layers could be beneficial for many applications.
Contributor guide
Assessment
This issue has not been assessed yet.