CurryInfo: spicey-4.2.0 / Spicey.ControllerGeneration.generateControllersForEntity

definition: Info
 
generateControllersForEntity :: String -> [Entity] -> Entity -> [Relationship]
                             -> CurryProg
generateControllersForEntity erdname allEntities
                             entity@(Entity ename attrlist) relationships =
 let noKeyAttrs = filter (\a -> notKey a && notPKey a) attrlist
 in
  CurryProg
   (controllerModuleName ename)
   -- imports:
   [ timeModule
   , "HTML.Base", "HTML.Session", "HTML.WUI"
   , model erdname
   , "Config.EntityRoutes", "Config.UserProcesses"
   , sessionInfoModule, authorizationModule, enauthModName, spiceyModule
   , "System.PreludeHelpers"
   , entitiesToHtmlModule erdname
   , viewModuleName ename
   ]
   Nothing -- defaultdecl
   [] -- classdecls
   [] -- instdecls
   [newEntityType erdname entity relationships allEntities] -- typedecls
   -- functions
   (
    [
     -- controller for dispatching to various controllers:
     mainController erdname entity relationships allEntities,
     -- controller for providing a page to enter new entity data:
     --newController erdname entity relationships allEntities,
     newController erdname (Entity ename noKeyAttrs) relationships allEntities,
     newForm  erdname (Entity ename noKeyAttrs) relationships allEntities,
     newStore erdname (Entity ename noKeyAttrs) relationships allEntities,
     -- transaction for saving data in new entity:
     createTransaction erdname entity relationships allEntities,
     -- controller to show an existing record in a form to edit
     editController erdname entity relationships allEntities,
     editForm  erdname (Entity ename noKeyAttrs) relationships allEntities,
     editStore erdname (Entity ename noKeyAttrs) relationships allEntities,
     -- transaction to update a record with the given data
     updateTransaction erdname entity relationships allEntities,
     -- controller to delete an entity with the given data
     deleteController erdname entity relationships allEntities,
     -- controller to destroy an entity with the given data
     destroyController erdname entity relationships allEntities,
     -- transaction to delete an entity with the given data
     deleteTransaction erdname entity relationships allEntities,
     -- controller to list all entities:
     listController erdname entity relationships allEntities,
     -- controller to show entites:
     showController erdname entity relationships allEntities
    ] ++ 
    manyToManyAddOrRemove erdname entity (manyToMany allEntities entity)
                          allEntities ++
    --(getAll erdname entity (manyToOne entity relationships) allEntities) ++
    --(getAll erdname entity (manyToMany allEntities entity) allEntities) ++
    --(manyToManyGetRelated erdname entity (manyToMany allEntities entity) allEntities) ++
     manyToOneGetRelated erdname entity (manyToOne entity relationships)
                         allEntities relationships
   )
   [] -- opdecls
demand: Info
 argument 3
deterministic: Info
 deterministic operation
documentation: Info
 
"main"-function
failfree: Info
 <FAILING>
indeterministic: Info
 referentially transparent operation
infix: Info
 no fixity defined
iotype: Info
 {(_,_,{Entity},_) |-> {CurryProg}}
name: Info
 generateControllersForEntity
precedence: Info
 no precedence defined
result-values: Info
 {CurryProg}
signature: Info
 String -> [Database.ERD.Entity] -> Database.ERD.Entity
-> [Database.ERD.Relationship] -> AbstractCurry.Types.CurryProg
solution-complete: Info
 operation might suspend on free variables
terminating: Info
 possibly non-terminating
totally-defined: Info
 possibly non-reducible on same data term