Skip to content

Instantly share code, notes, and snippets.

@scorredoira
Last active July 17, 2017 09:29
Show Gist options
  • Save scorredoira/a38e80af33c623e6795b8608e673af42 to your computer and use it in GitHub Desktop.
Save scorredoira/a38e80af33c623e6795b8608e673af42 to your computer and use it in GitHub Desktop.
import "lib/std";
import * as web from "lib/web";
import * as orm from "lib/orm";
import * as crud from "lib/crud";
function init() {
initEntities();
web.addRoute("/crm/clients.json", crud.listHandler("client"), [web.adminFilter])
web.addRoute("/crm/clients/:id.json", crud.detailHandler("client"), [web.adminFilter])
web.addRoute("/crm/saveClient.json", crud.saveHandler("client"), [web.adminFilter])
}
function initEntities() {
orm.register({
name: "client",
columns: ["id", "name", "lastName", "barcode"],
properties: [
{ name: "name", type: "string", label: "@@Nombre" },
{ name: "email", type: "email", label: "@@Email", nullable: true }
]
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment