UNPKG

glutenfree

Version:

A profiler/loganalyzer for nginx/Cetrea Aw.

48 lines (38 loc) 1.72 kB
_ = require("underscore") winston = require("winston") util = require("util") Mapper = require("../Mapper.js").mapper ### /json/genericlists/genericListDataFromHints/{"Organizations":["Organization.Seng","Organization.OP","Organization.Opv"],"Tasks":["PatientLogisticsTask.PatientLogisticsActivity.InternalMove"],"GenericListType":"Activity","States":["NotBegun","Ongoing"]}/Name,MovePatient,SSN,Gender,Specialty,Diagnosis,Start,State,FromOrganization,Advis,ToOrganization,Receiver,Sender ### class GenericListsMapper extends Mapper constructor: -> @identifier = "genericlists" # schema will return a schema of arguments and types (and current values) schema: (method, action, endpoint, fun, args) -> switch fun.toLowerCase() when "genericlistdata", "genericlistdatafromdefinition" @map([{ "Organizations": "Organization.Oid" #"Tasks": "Task.Oid" #"Tasks": { type: "Task", property: "Oid", depth: 1} "Tasks": { type: "Task", property: "Oid", depth: 1, filter: (task, schema) -> task.Oid.length > 0 } }], args) when "listdatabyid" # AKUT.printliste @map(["conf#genericlistid"], args) # will return a usable path based on the function; fun, the given schema and the schema given # (the schema must also contain values) applySchema: (method, action, endpoint, fun, schema) -> switch fun.toLowerCase() when "genericlistdata", "genericlistdatafromdefinition", "listdatabyid" @unmap(schema) else winston.warn "no such fun", fun exports.mapper = new GenericListsMapper()