finale icon indicating copy to clipboard operation
finale copied to clipboard

Non Sequelize Resources

Open mark-lester opened this issue 4 years ago • 0 comments

I'd like a facility to support non sequelize, generally read only, resources. I also wish to provide a dictionary of all the end points registered. It would be useful to be able to manage all these within Finale even if we arent using most of the POST and relational functionality from the ORM. We still get use of milestones and other functionality, and this registry which is of great use in the client,

As background I am re-implementing my stack and revisiting some issues. I have a model loader for sequelize, it uses requireDir to read model definition, including the relations, one per file. As part of my stack I return the list of epillogue resources as a collection of model definitions at the root of the api (/api/), including associations between models, and hence can instantiate a dictionary of model and collection definitions and default instances in the client. I include in that collection some other end points for non sequelize controllers and complex generally purely query only resources. I hacked it up just as an add on array but I will try to submit these functionally limited resources as stubbed out Sequelize model classes to Finale. I will use the same requireDir() and manufacture a class for each of these "special" end points. I subsequently have Backbone.Dictionary, to read and instantiate models defined in this root dictionary, and <ViewPoint>, a Marionette base view extension that allows you to just go something like this anywhere. Essentially ALL the intrface is in templates, I dont need a jQuery anchor naming scheme, and code to instantiate models and views. Just glue the template in where you want the stuff to appear.

<ViewPoint 
    model="MyModel"  
   [cursor="{{value}}"] 
   [template="my template"] 
   [collection=true] 
   [clone=true] 
   [view="your own view (from a named list you have instaitaiated)"]> 
or you can have inline handlebars template code here e.g. {{afield}} in my model
</ViewPoint>

mark-lester avatar Jul 04 '20 19:07 mark-lester