arduosoft / RawCMS

RawCMS is the headless CMS written in asp.net core build for developers that embraces API first technology. Please give us a feedback!
https://forms.gle/wvu1HF9P52ZdXujv6
GNU General Public License v3.0
173 stars 72 forks source link

Register the CrudService to be available for Lambdas #235

Closed tokarzkj closed 4 years ago

tokarzkj commented 4 years ago

Pull request content

Related task: #209 - Allow Lambdas to interact with internal data

Describe here technical detail omitted on task

The CrudService is now available for users to create Lambdas that interact with their internal data. The registration method is different than previous clients because there is no parameterless constructor available. This means the usage for users will look slightly different than other clients.

Notes for admin

I haven't thoroughly tested, but I wanted to get the code out for review. The first example I have been playing with is incrementing a field based on how many existing records there are. I plan on working on more thorough examples as I have time.

This is simple example using a collection called Books with no filter:

var number = RAWCMSCrudService.Count('Books', '')
item.EntryNumber = number ? number + 1 : 0
zeppaman commented 4 years ago

@tokarzkj great! Could you change your target branches from master to develop? After this, I think we could improve documentation with a page for teaching how to use javascript APIs (I hope other will came in the future), but we will do it in a separate task. I'm opening as a reminder.