Skip to content

Commit

Permalink
Base struture and basic queries
Browse files Browse the repository at this point in the history
  • Loading branch information
stvkoch committed May 19, 2022
0 parents commit 5d32719
Show file tree
Hide file tree
Showing 50 changed files with 9,722 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .gitignore
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
.pnp
.pnp.js

# testing
coverage

# next.js
.next/
out/
build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env.local
.env.development.local
.env.test.local
.env.production.local

# turbo
.turbo
Northwind_small.sqlite
13 changes: 13 additions & 0 deletions README.md
@@ -0,0 +1,13 @@
### This is in a early development stage

packages/generators

```
pnpm run compile -- -w
```

packages/examples/yoga

```
NODE_ENV=development pnpm run server
```
17 changes: 17 additions & 0 deletions package.json
@@ -0,0 +1,17 @@
{
"name": "g-stratus",
"version": "1.0.0",
"main": "index.js",
"type": "module",
"private": true,
"packageManager": "pnpm@7.0.0",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"ts-node": "^9.1.1"
}
}
Binary file not shown.
17 changes: 17 additions & 0 deletions packages/examples/yoga/mocks/DB.ts
@@ -0,0 +1,17 @@
export default {
get: (sql, params) => {
console.log('DB Datasource',sql);

return {
id: 1,
name: sql,
email: "test@test.com",
customer: null,
};
},
exec: (sql, params) => ({
id: 2,
name: sql,
email: "test",
}),
};
18 changes: 18 additions & 0 deletions packages/examples/yoga/mocks/KV.ts
@@ -0,0 +1,18 @@

export default {
get: (key) => ({
id: 1,
name: key,
email: "test@test.com",
}),
put: (key, value) => ({
id: 2,
name: key,
email: value,
}),
delete: (key) => ({
id: 3,
name: key,
email: "deleted",
}),
};
48 changes: 48 additions & 0 deletions packages/examples/yoga/models/categories.ts
@@ -0,0 +1,48 @@

export default {
name: 'categories',
tableName: 'Category',
fields: {
Id: {
type: 'ID',
primary: true,
nullable: false
},
CategoryName: {
type: 'String',
default: '',
nullable: false
},
Description: {
type: 'String',
default: '',
nullable: true
}
},
associations: {
},
middlewares: {
all: [],
get: [],
update: [],
create: [],
delete: [],
subscribe: []
},
datasource: {
all: 'DB',
get: 'DB',
count: 'DB',
update: 'DB',
create: 'DB',
delete: 'DB',
},
generate: {
all: true,
get: true,
update: true,
create: true,
delete: true,
subscribe: true,
}
}
87 changes: 87 additions & 0 deletions packages/examples/yoga/models/customers.ts
@@ -0,0 +1,87 @@
export default {
name: "customers",
tableName: "Customer",
fields: {
Id: {
type: "ID",
primary: true,
nullable: false,
},
CompanyName: {
type: "String",
default: "",
nullable: true,
},
ContactName: {
type: "String",
default: "",
nullable: true,
},
CompanyTitle: {
type: "String",
default: "",
nullable: true,
},
Address: {
type: "String",
default: "",
nullable: true,
},
City: {
type: "String",
default: "",
nullable: true,
},
Region: {
type: "String",
default: "",
nullable: true,
},
PostalCode: {
type: "String",
default: "",
nullable: true,
},
Phone: {
type: "String",
default: "",
nullable: true,
},
Fax: {
type: "String",
default: "",
nullable: true,
},
Country: {
type: "String",
default: "",
nullable: true,
},
},
associations: {
orders: { hasMany: "orders", field: ["CustomerId", "Id"] },
},
middlewares: {
all: [],
get: [],
update: [],
create: [],
delete: [],
subscribe: [],
},
datasource: {
all: "DB",
get: "DB",
update: "DB",
create: "DB",
delete: "DB",
},
generate: {
all: true,
get: true,
update: true,
create: true,
delete: true,
subscribe: true,
},
};
129 changes: 129 additions & 0 deletions packages/examples/yoga/models/employees.ts
@@ -0,0 +1,129 @@
export default {
name: "employees",
tableName: "Employee",
fields: {
Id: {
type: "ID",
primary: true,
nullable: false,
},
LastName: {
type: "String",
default: "",
nullable: true,
},
FirstName: {
type: "String",
default: "",
nullable: true,
},
Title: {
type: "String",
default: "",
nullable: true,
},
TitleOfCourtesy: {
type: "String",
default: "",
nullable: true,
},
BirthDate: {
type: "String",
default: "",
nullable: true,
},
HireDate: {
type: "String",
default: "",
nullable: true,
},
Address: {
type: "String",
default: "",
nullable: true,
},
City: {
type: "String",
default: "",
nullable: true,
},
Region: {
type: "String",
default: "",
nullable: true,
},
PostalCode: {
type: "String",
default: "",
nullable: true,
},
Country: {
type: "String",
default: "",
nullable: true,
},
HomePhone: {
type: "String",
default: "",
nullable: true,
},
Extension: {
type: "String",
default: "",
nullable: true,
},
Photo: {
type: "String",
default: "",
nullable: true,
transform: (row) => row.Photo,
},
Notes: {
type: "String",
default: "",
nullable: true,
},
ReportsTo: {
type: "String",
default: "",
nullable: true,
},
PhotoPath: {
type: "String",
default: "",
nullable: true,
},
},
associations: {
orders: { hasMany: "orders", field: ["EmployeeId", "Id"] },
territories: {
hasManyToMany: "territories",
through: "EmployeeTerritory",
parentKey: ["TerritoryId", "Id"],
field: ["EmployeeId", "Id"],
},
},
middlewares: {
all: [],
get: [],
update: [],
create: [],
delete: [],
subscribe: [],
},
datasource: {
all: "DB",
get: "DB",
update: "DB",
create: "DB",
delete: "DB",
},
generate: {
all: true,
get: true,
update: true,
create: true,
delete: true,
subscribe: true,
},
};

0 comments on commit 5d32719

Please sign in to comment.