Skip to content

Commit

Permalink
initial test
Browse files Browse the repository at this point in the history
  • Loading branch information
newtack committed Apr 2, 2022
1 parent f009953 commit 4860c1e
Show file tree
Hide file tree
Showing 10 changed files with 278 additions and 1 deletion.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# examples
Nuvanti example applications
This repository contains official Nuvanti example applications.

- northwind: The customer/products/vendor sample database application implemented in Nuvanti
- simple_crm: A simple CRM (customer relationship management) that leverages Nuvanti's higher level CRM model
- starter: Empty RAD model based application
60 changes: 60 additions & 0 deletions northwind/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { createBasicUiModel } from "@nuvanti/basic-ui-model";
import { createRadModel } from "@nuvanti/rad-model";
import {} from "@nuvanti/ui";
import { modify } from "@nuvanti/ts-style";

const { radModel, addTable, generateFromRad } = createRadModel({
name: "Nuvanti",
id: "AMacekin",
defaultFieldDisplay: () => {
throw "";
},
defaultFormField: () => {
throw "";
},
});

addTable("User", (table) => {
table.nuvaId("globalId").nonNull().unique();
table.bool("disabled").nonNull();
});

addTable("Category", (table) => {
table.string("name", 15);
table.string("description", 500);
table.selectFormControl();
});

const { addPage, generateUi } = createBasicUiModel();

// addPage({
// path: "/",
// content: simpleEditableGridPage({ table: "Category", radModel }),
// });

// const shell = simpleNavbar({
// links: [
// { label: "Home", path: "/" },
// { label: "Categories", path: "/categories" },
// { label: "Contacts", path: "/contacts" },
// { label: "Peeps", path: "/peeps" },
// ],
// });

/** @type {import("@nuvanti/runtime-model").RuntimeModel} */
export const app = {
...generateFromRad(),
ui: generateUi(shell, createUiModel),
runProfile: [
{
asUser: `AMacekin`,
name: "default",
procedure: [
modify(
`insert into db.User (globalId, disabled) values (cast('AMacekin' as NuvaId), false)`
),
],
time: `2021-11-11T16:37:49.715Z`,
},
],
};
15 changes: 15 additions & 0 deletions northwind/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es2020",
"module": "esnext",
"checkJs": true,
"lib": ["ESNext"],
"esModuleInterop": true, // force import
"moduleResolution": "node",

"allowSyntheticDefaultImports": true // force import
},

"include": ["app.js"],
"exclude": ["dist", "build", "node_modules"]
}
16 changes: 16 additions & 0 deletions northwind/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@nuvanti/example-northwind",
"version": "0.0.0",
"type": "module",
"license": "NUVANTI",
"scripts": {
"save": "node ../app-scripts/save.js",
"start": "node ../app-scripts/start.js"
},
"dependencies": {
"@nuvanti/ui": "*",
"@nuvanti/rad-model": "*",
"@nuvanti/ts-style": "*",
"@nuvanti/basic-ui-model": "*"
}
}
60 changes: 60 additions & 0 deletions simple_crm/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { createBasicUiModel } from "@nuvanti/basic-ui-model";
import { createRadModel } from "@nuvanti/rad-model";
import {} from "@nuvanti/ui";
import { modify } from "@nuvanti/ts-style";

const { radModel, addTable, generateFromRad } = createRadModel({
name: "Nuvanti",
id: "AMacekin",
defaultFieldDisplay: () => {
throw "";
},
defaultFormField: () => {
throw "";
},
});

addTable("User", (table) => {
table.nuvaId("globalId").nonNull().unique();
table.bool("disabled").nonNull();
});

addTable("Category", (table) => {
table.string("name", 15);
table.string("description", 500);
table.selectFormControl();
});

const { addPage, generateUi } = createBasicUiModel();

// addPage({
// path: "/",
// content: simpleEditableGridPage({ table: "Category", radModel }),
// });

// const shell = simpleNavbar({
// links: [
// { label: "Home", path: "/" },
// { label: "Categories", path: "/categories" },
// { label: "Contacts", path: "/contacts" },
// { label: "Peeps", path: "/peeps" },
// ],
// });

/** @type {import("@nuvanti/runtime-model").RuntimeModel} */
export const app = {
...generateFromRad(),
ui: generateUi(shell, createUiModel),
runProfile: [
{
asUser: `AMacekin`,
name: "default",
procedure: [
modify(
`insert into db.User (globalId, disabled) values (cast('AMacekin' as NuvaId), false)`
),
],
time: `2021-11-11T16:37:49.715Z`,
},
],
};
15 changes: 15 additions & 0 deletions simple_crm/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es2020",
"module": "esnext",
"checkJs": true,
"lib": ["ESNext"],
"esModuleInterop": true, // force import
"moduleResolution": "node",

"allowSyntheticDefaultImports": true // force import
},

"include": ["app.js"],
"exclude": ["dist", "build", "node_modules"]
}
16 changes: 16 additions & 0 deletions simple_crm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@nuvanti/example-simple-crm",
"version": "0.0.0",
"type": "module",
"license": "NUVANTI",
"scripts": {
"save": "node ../app-scripts/save.js",
"start": "node ../app-scripts/start.js"
},
"dependencies": {
"@nuvanti/ui": "*",
"@nuvanti/rad-model": "*",
"@nuvanti/ts-style": "*",
"@nuvanti/basic-ui-model": "*"
}
}
60 changes: 60 additions & 0 deletions starter/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { createBasicUiModel } from "@nuvanti/basic-ui-model";
import { createRadModel } from "@nuvanti/rad-model";
import { } from "@nuvanti/ui";
import { modify } from "@nuvanti/ts-style";

const { radModel, addTable, generateFromRad } = createRadModel({
name: "Nuvanti",
id: "AMacekin",
defaultFieldDisplay: () => {
throw "";
},
defaultFormField: () => {
throw "";
},
});

addTable("User", (table) => {
table.nuvaId("globalId").nonNull().unique();
table.bool("disabled").nonNull();
});

addTable("Category", (table) => {
table.string("name", 15);
table.string("description", 500);
table.selectFormControl();
});

const { addPage, generateUi } = createBasicUiModel();

// addPage({
// path: "/",
// content: simpleEditableGridPage({ table: "Category", radModel }),
// });

// const shell = simpleNavbar({
// links: [
// { label: "Home", path: "/" },
// { label: "Categories", path: "/categories" },
// { label: "Contacts", path: "/contacts" },
// { label: "Peeps", path: "/peeps" },
// ],
// });

/** @type {import("@nuvanti/runtime-model").RuntimeModel} */
export const app = {
...generateFromRad(),
ui: generateUi(shell, createUiModel),
runProfile: [
{
asUser: `AMacekin`,
name: "default",
procedure: [
modify(
`insert into db.User (globalId, disabled) values (cast('AMacekin' as NuvaId), false)`
),
],
time: `2021-11-11T16:37:49.715Z`,
},
],
};
15 changes: 15 additions & 0 deletions starter/jsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es2020",
"module": "esnext",
"checkJs": true,
"lib": ["ESNext"],
"esModuleInterop": true, // force import
"moduleResolution": "node",

"allowSyntheticDefaultImports": true // force import
},

"include": ["app.js"],
"exclude": ["dist", "build", "node_modules"]
}
16 changes: 16 additions & 0 deletions starter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@nuvanti/example-starter",
"version": "0.0.0",
"type": "module",
"license": "NUVANTI",
"scripts": {
"save": "node ../app-scripts/save.js",
"start": "node ../app-scripts/start.js"
},
"dependencies": {
"@nuvanti/ui": "*",
"@nuvanti/rad-model": "*",
"@nuvanti/ts-style": "*",
"@nuvanti/basic-ui-model": "*"
}
}

0 comments on commit 4860c1e

Please sign in to comment.