浏览代码

init repo

Arkadiusz Lisiecki 5 年之前
当前提交
2791503bc9
共有 62 个文件被更改,包括 1460 次插入0 次删除
  1. 2 0
      .gitignore
  2. 6 0
      CHANGELOG.md
  3. 19 0
      Dockerfile
  4. 26 0
      Dockerfile_bak
  5. 13 0
      README.md
  6. 63 0
      articles.js_bak
  7. 102 0
      docker-compose.yml
  8. 278 0
      index.js
  9. 47 0
      initial-data.js
  10. 28 0
      package.json
  11. 16 0
      schema/cashregisterdocs.js
  12. 12 0
      schema/cashregisters.js
  13. 23 0
      schema/companies.js
  14. 11 0
      schema/currency.js
  15. 22 0
      schema/deliveryitems.js
  16. 12 0
      schema/deliverymaterialprices.js
  17. 10 0
      schema/docflow.js
  18. 12 0
      schema/docnumbers.js
  19. 22 0
      schema/docpayment.js
  20. 42 0
      schema/documents.js
  21. 13 0
      schema/eshop_removed.js
  22. 9 0
      schema/feature_groups.js
  23. 10 0
      schema/feature_groups_features.js
  24. 16 0
      schema/features.js
  25. 11 0
      schema/featuresval.js
  26. 23 0
      schema/fifopart.js
  27. 17 0
      schema/fifopos.js
  28. 63 0
      schema/items.js
  29. 11 0
      schema/kinds.js
  30. 12 0
      schema/locations.js
  31. 15 0
      schema/logs.js
  32. 10 0
      schema/materials.js
  33. 15 0
      schema/monitor_logs.js
  34. 10 0
      schema/operatorgroupprivileges.js
  35. 9 0
      schema/operatorgroups.js
  36. 14 0
      schema/operators.js
  37. 11 0
      schema/operators_cashregisters.js
  38. 12 0
      schema/operators_settings.js
  39. 10 0
      schema/operators_shops.js
  40. 16 0
      schema/pictures.js
  41. 33 0
      schema/positions.js
  42. 21 0
      schema/printtemplates.js
  43. 12 0
      schema/product_minmax_features.js
  44. 13 0
      schema/productfeatures.js
  45. 49 0
      schema/products.js
  46. 14 0
      schema/products_minmax.js
  47. 11 0
      schema/productsgroup.js
  48. 14 0
      schema/settlements.js
  49. 13 0
      schema/shops.js
  50. 13 0
      schema/stocktaking.js
  51. 14 0
      schema/stocktaking_items.js
  52. 23 0
      schema/supaddress.js
  53. 34 0
      schema/suppliers.js
  54. 11 0
      schema/sysparams.js
  55. 10 0
      schema/sysprivileges.js
  56. 25 0
      schema/tagtemplateobjects.js
  57. 21 0
      schema/tagtemplates.js
  58. 13 0
      schema/transferdocreceived.js
  59. 10 0
      schema/uninumbers.js
  60. 11 0
      schema/uom.js
  61. 10 0
      schema/upgradelog.js
  62. 12 0
      schema/vat.js

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+node_modules
+schema_before_ref_strip

文件差异内容过多而无法显示
+ 6 - 0
CHANGELOG.md


+ 19 - 0
Dockerfile

@@ -0,0 +1,19 @@
+# https://docs.docker.com/samples/library/node/
+ARG NODE_VERSION=12.10.0
+
+FROM node:${NODE_VERSION}-alpine
+
+RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
+
+WORKDIR /home/node/app
+
+COPY package*.json ./
+
+USER node
+
+RUN yarn install
+
+COPY --chown=node:node . .
+
+EXPOSE 3000
+CMD ["yarn", "dev"]

+ 26 - 0
Dockerfile_bak

@@ -0,0 +1,26 @@
+# https://docs.docker.com/samples/library/node/
+ARG NODE_VERSION=12.10.0
+# https://github.com/Yelp/dumb-init/releases
+ARG DUMB_INIT_VERSION=1.2.2
+
+# Build container
+FROM node:${NODE_VERSION}-alpine AS build
+ARG DUMB_INIT_VERSION
+
+WORKDIR /home/node
+
+RUN apk add --no-cache build-base python2 yarn && \
+    wget -O dumb-init -q https://github.com/Yelp/dumb-init/releases/download/v${DUMB_INIT_VERSION}/dumb-init_${DUMB_INIT_VERSION}_amd64 && \
+    chmod +x dumb-init
+ADD . /home/node
+RUN yarn install && yarn build && yarn cache clean
+
+# Runtime container
+FROM node:${NODE_VERSION}-alpine
+
+WORKDIR /home/node
+
+COPY --from=build /home/node /home/node
+
+EXPOSE 3000
+CMD ["./dumb-init", "yarn", "start"]

+ 13 - 0
README.md

@@ -0,0 +1,13 @@
+# KeystoneJS Starter Template
+
+You've created a KeystoneJS project! This project contains a simple list of users and an admin application (`localhost:3000/admin`) with basic authentication.
+
+## Running the Project.
+
+To run this project first run `npm install`. Note: If you generated this project via the Keystone cli step this has been done for you \\o/.
+
+Once running, the Keystone Admin UI is reachable via `localhost:3000/admin`.
+
+## Next steps
+
+This example has no front-end application but you can build your own using the GraphQL API (`http://localhost:3000/admin/graphiql`).

+ 63 - 0
articles.js_bak

@@ -0,0 +1,63 @@
+const { Integer, Checkbox, Text, Decimal, DateTime, Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        items_id: { type: Uuid, isRequired: true, label: 'Egzemplarz' },
+        article_id: { type: Uuid, many: false, label: 'article' },
+        productsguid_id: { type: Uuid, many: false, label: 'productsguid' },
+        itype: { type: Integer, isRequired: true, label: 'itype' },
+        sold: { type: Checkbox, isRequired: true, label: 'sold' },
+        deficiency: { type: Checkbox, isRequired: true, label: 'deficiency' },
+        catnum: { type: Text, label: 'catnum' },
+        description: { type: Text, label: 'description' },
+        price_delivery: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_delivery' },
+        price_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_purchase' },
+        price_detal: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_detal' },
+        price_detal_brutto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena detaliczna brutto' },
+        price_eshop: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena esklep' },
+        profit_margin: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Marża' },
+        isize: { type: Text, isRequired: true, label: 'isize' },
+        mass: { type: Decimal, knexOptions: { precision: 10, scale: 2 }, label: 'Masa' },
+        quantity: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'Ilość' },
+        barcode: { type: Text, label: 'Kod kreskowy' },
+        tagged: { type: Checkbox, isRequired: true, label: 'tagged' },
+        currency_id: { type: Relationship, ref: 'currency.currency_id', many: false, label: 'Waluta' },
+        producer: { type: Text, label: 'Producent' },
+        symbol_prod: { type: Text, label: 'Symbol producenta' },
+        silver_price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt srebra' },
+        gold_price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt złota' },
+        platin_price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt platyny' },
+        purchase_date: { type: DateTime, label: 'Data zakupu' },
+        promo: { type: Checkbox, isRequired: true, label: 'promo' },
+        news: { type: Checkbox, isRequired: true, label: 'news' },
+        best: { type: Checkbox, isRequired: true, label: 'best' },
+        name: { type: Text, label: 'Nazwa' },
+        desctxt: { type: Text, label: 'desctxt' },
+        seotxt: { type: Text, label: 'seotxt' },
+        eshop: { type: Checkbox, isRequired: true, label: 'E-sklep' },
+        created_at: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Utworzono' },
+        modified_at: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Zmieniono' },
+        sup_id: { type: Relationship, ref: 'suppliers.suppliers_id', many: false, label: 'suppliers_id' },
+        pzdoc_id: { type: Uuid, many: false, label: 'pzdoc' },
+        kinds_id: { type: Relationship, ref: 'kinds.kinds_id', many: true, label: 'kinds' },
+        uom_id: { type: Relationship, ref: 'uom.uom_id', many: false, label: 'uom' },
+        materials_id: { type: Relationship, ref: 'materials.materials_id', many: true, label: 'materials' },
+        vat_id: { type: Relationship, ref: 'vat.vat_id', many: false, isRequired: true, label: 'VAT' },
+        locations_id: { type: Relationship, ref: 'locations.locations_id', many: true, label: 'locations' },
+        deliveryitems_id: { type: Relationship, ref: 'deliveryitems.deliveryitems_id', many: true, label: 'deliveryitems' },
+        shops_id: { type: Relationship, ref: 'shops.shops_id', many: true, isRequired: true, label: 'Magazyn' },
+        tagsoper_id: { type: Relationship, ref: 'operators.operators_id', many: false, label: 'tagsoper' }, // todo: spr. czy o to chodziło w foreign keys oryginalnej bazy
+        price_delivery_before_discount: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt dostawy przed rabatem' },
+        fifo_value: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'fifo_value' },
+        fifo: { type: Checkbox, label: 'fifo' },
+        fifo_last_price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'fifo_last_price' },
+        transit: { type: Checkbox, isRequired: true, label: 'Transport' },
+        transit_symbol: { type: Text, label: 'Symbol transportu' },
+        transit_proofsymbol: { type: Text, label: 'transit_proofsymbol' },
+        transit_currency_id: { type: Relationship, ref: 'currency.currency_id', many: false, label: 'Waluta transportu' },
+        transit_currency_rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'transit_currency_rate' },
+        transit_purchase_costs: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'transit_purchase_costs' },
+        transit_currency_material_rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'transit_currency_material_rate' },
+        quantity_precision: { type: Integer, isRequired: true, label: 'quantity_precision' },
+    }, label: 'Article'//, plural: 'Articles'
+};

+ 102 - 0
docker-compose.yml

@@ -0,0 +1,102 @@
+version: '3.3'
+
+services:
+  keystone:
+    build: .
+    #user: "node"
+    #working_dir: /home/node/app
+    #environment:
+      #- NODE_ENV=development
+      #- DISABLE_LOGGING=false
+    volumes:
+      - .:/home/node/app
+      - node_modules:/home/node/app/node_modules
+    command: ["yarn", "dev"]
+    links:
+      - postgres
+    ports:
+      - "3230:3000"
+    expose:
+      - "3050"
+      - "3000"
+    restart: always
+    #labels:
+    #  - "traefik.backend=node"
+    #  - "traefik.backend.port=3000"
+    #  - "traefik.frontend.rule=Host:kdev.jubilerschubert.pl,www.kdev.jubilerschubert.pl"
+    #  - "traefik.frontend.SSLRedirect=true"
+    #  - "traefik.frontend.SSLHost=kdev.jubilerschubert.pl"
+    #  - "traefik.frontend.SSLForceHost=true"
+    #  - "traefik.docker.networks=web"
+    #  - "traefik.enable=true"
+    #command: "npm start"
+    networks:
+      - default
+      - web
+
+  postgres:
+    image: postgres
+    restart: always
+    environment:
+      POSTGRES_PASSWORD: utnQ67pt74bVw6aB
+      POSTGRES_DB: kdev_postgres
+      POSTGRES_USER: kdev_postgres
+    volumes:
+      - /mnt/storage/kdev/db:/var/lib/postgresql/data
+    ports:
+      - "5432:5432"
+    networks:
+      - default
+
+# phppgadmin:
+#   restart: always
+#   image: dockage/phppgadmin:latest
+#   #ports:
+#   #- "80:80"
+#   #- "443:443"
+#   environment:
+#     - PHP_PG_ADMIN_SERVER_DESC=PostgreSQL
+#     - PHP_PG_ADMIN_SERVER_HOST=postgres
+#     - PHP_PG_ADMIN_SERVER_PORT=5432
+#     - PHP_PG_ADMIN_SERVER_SSL_MODE=allow
+#     - PHP_PG_ADMIN_SERVER_DEFAULT_DB=template1
+#     - PHP_PG_ADMIN_SERVER_PG_DUMP_PATH=/usr/bin/pg_dump
+#     - PHP_PG_ADMIN_SERVER_PG_DUMPALL_PATH=/usr/bin/pg_dumpall
+#     - PHP_PG_ADMIN_DEFAULT_LANG=auto
+#     - PHP_PG_ADMIN_AUTO_COMPLETE=default on
+#     - PHP_PG_ADMIN_EXTRA_LOGIN_SECURITY=false
+#     - PHP_PG_ADMIN_OWNED_ONLY=false
+#     - PHP_PG_ADMIN_SHOW_COMMENTS=true
+#     - PHP_PG_ADMIN_SHOW_ADVANCED=false
+#     - PHP_PG_ADMIN_SHOW_SYSTEM=false
+#     - PHP_PG_ADMIN_MIN_PASSWORD_LENGTH=1
+#     - PHP_PG_ADMIN_LEFT_WIDTH=200
+#     - PHP_PG_ADMIN_THEME=default
+#     - PHP_PG_ADMIN_SHOW_OIDS=false
+#     - PHP_PG_ADMIN_MAX_ROWS=30
+#     - PHP_PG_ADMIN_MAX_CHARS=50
+#     - PHP_PG_ADMIN_USE_XHTML_STRICT=false
+#     - PHP_PG_ADMIN_HELP_BASE=http://www.postgresql.org/docs/%s/interactive/
+#     - PHP_PG_ADMIN_AJAX_REFRESH=3
+#   labels:
+#     - "traefik.backend=phppgadmin"
+#     - "traefik.backend.port=80"
+#     - "traefik.frontend.rule=Host:pkdev.jubilerschubert.pl,www.pkdev.jubilerschubert.pl"
+#     - "traefik.frontend.SSLRedirect=true"
+#     - "traefik.frontend.SSLHost=pkdev.jubilerschubert.pl"
+#     - "traefik.frontend.SSLForceHost=true"
+#     - "traefik.frontend.redirect.permanent=true"
+#     - "traefik.docker.networks=web"
+#     - "traefik.enable=true"
+#   networks:
+#     - default
+#     - web
+
+networks:
+  default:
+    external: false
+  web:
+    external: true
+
+volumes:
+  node_modules:

+ 278 - 0
index.js

@@ -0,0 +1,278 @@
+const { Keystone } = require('@keystonejs/keystone');
+const { PasswordAuthStrategy } = require('@keystonejs/auth-password');
+const { Text, Checkbox, Password } = require('@keystonejs/fields');
+const { GraphQLApp } = require('@keystonejs/app-graphql');
+const { AdminUIApp } = require('@keystonejs/app-admin-ui');
+const { StaticApp } = require('@keystonejs/app-static');
+//const { expressSession } = require('express-session');
+//const { FileSessionStore } = require('session-file-store')(expressSession);
+
+const fs = require('fs');
+
+
+
+
+// Lists
+const CashregistersSchema = require('./schema/cashregisters.js');
+const CashregisterdocsSchema = require('./schema/cashregisterdocs.js');
+const CompaniesSchema = require('./schema/companies.js');
+const CurrencySchema = require('./schema/currency.js');
+const DeliveryitemsSchema = require('./schema/deliveryitems.js');
+const DeliverymaterialpricesSchema = require('./schema/deliverymaterialprices.js');
+const DocflowSchema = require('./schema/docflow.js');
+const DocnumbersSchema = require('./schema/docnumbers.js')
+const DocpaymentSchema = require('./schema/docpayment.js');
+const DocumentsSchema = require('./schema/documents.js');
+const Eshop_removedSchema = require('./schema/eshop_removed.js');
+const Feature_groups_featuresSchema = require('./schema/feature_groups_features.js');
+const Feature_groupsSchema = require('./schema/feature_groups.js');
+const FeaturesSchema = require('./schema/features.js');
+const FeaturesvalSchema = require('./schema/featuresval.js');
+const FifopartSchema = require('./schema/fifopart.js');
+const FifoposSchema = require('./schema/fifopos.js');
+const ItemsSchema = require('./schema/items.js');
+const KindsSchema = require('./schema/kinds.js')
+const LocationsSchema = require('./schema/locations.js');
+const LogsSchema = require('./schema/logs.js');
+const MaterialsSchema = require('./schema/materials.js');
+const Monitor_logsSchema = require('./schema/monitor_logs.js');
+const OperatorgroupprivilegesSchema = require('./schema/operatorgroupprivileges.js');
+const OperatorgroupsSchema = require('./schema/operatorgroups.js');
+const Operators_cashregistersSchema = require('./schema/operators_cashregisters.js');
+const Operators_settingsSchema = require('./schema/operators_settings.js');
+const Operators_shopsSchema = require('./schema/operators_shops.js');
+const OperatorsSchema = require('./schema/operators.js');
+const PicturesSchema = require('./schema/pictures.js');
+const PositionsSchema = require('./schema/positions.js');
+const PrinttemplatesSchema = require('./schema/printtemplates.js');
+const Product_minmax_featuresSchema = require('./schema/product_minmax_features.js');
+const ProductfeaturesSchema = require('./schema/productfeatures.js');
+const Products_minmaxSchema = require('./schema/products_minmax.js');
+const ProductsgroupSchema = require('./schema/productsgroup.js');
+const ProductsSchema = require('./schema/products.js');
+const SettlementsSchema = require('./schema/settlements.js');
+const ShopsSchema = require('./schema/shops.js');
+const Stocktaking_itemsSchema = require('./schema/stocktaking_items.js');
+const StocktakingSchema = require('./schema/stocktaking.js');
+const SupaddressSchema = require('./schema/supaddress.js');
+const SuppliersSchema = require('./schema/suppliers.js');
+const SysparamsSchema = require('./schema/sysparams.js');
+const SysprivilegesSchema = require('./schema/sysprivileges.js');
+const TagtemplateobjectsSchema = require('./schema/tagtemplateobjects.js');
+const TagtemplatesSchema = require('./schema/tagtemplates.js');
+const TransferdocreceivedSchema = require('./schema/transferdocreceived.js');
+const UninumbersSchema = require('./schema/uninumbers.js');
+const UomSchema = require('./schema/uom.js');
+const UpgradelogSchema = require('./schema/upgradelog.js');
+const VatSchema = require('./schema/vat.js');
+//const Logger = require('@keystonejs/logger').logger('test');
+
+
+const initialiseData = require('./initial-data');
+
+const { KnexAdapter: Adapter } = require('@keystonejs/adapter-knex');
+
+const PROJECT_NAME = 'SchuStock';
+const adapterConfig = { knexOptions: {
+    connection: 'postgresql://kdev_postgres:utnQ67pt74bVw6aB@postgres:5432/kdev_postgres',
+  }
+};
+
+/*
+const { v4: uuid } = require('uuid');
+const { CloudinaryAdapter } = require('@keystonejs/file-adapters');
+const { Wysiwyg } = require('@keystonejs/fields-wysiwyg-tinymce')
+*/
+
+
+const keystone = new Keystone({
+  adapter: new Adapter(adapterConfig),
+  //onConnect: process.env.CREATE_TABLES !== 'true' && initialiseData,
+  onConnect: initialiseData,
+  //secureCookies: false,
+  /*
+  cookie: {
+    secure: process.env.NODE_ENV === 'production', // Default to true in production
+    //secure: true, // Default to true in production
+    maxAge: 1000 * 60 * 60 * 24 * 30, // 30 days
+    sameSite: false,
+  },
+  */
+  cookieSecret: 'dupa23',
+  name: 'SchuStock',
+  brand: 'Jubiler Schubert',
+  //sessionStore: new FileSessionStore({  }),
+});
+
+//keystone.set('signin logo', ['https://jubilerschubert.pl/wp-content/uploads/schubert_logo.svg', 180, 42]);
+
+// Access control functions
+const userIsAdmin = ({ authentication: { item: user } }) => Boolean(user && user.isAdmin);
+const userOwnsItem = ({ authentication: { item: user } }) => {
+  if (!user) {
+    return false;
+  }
+
+  // Instead of a boolean, you can return a GraphQL query:
+  // https://www.keystonejs.com/api/access-control#graphqlwhere
+  return { id: user.id };
+};
+
+const userIsAdminOrOwner = auth => {
+  const isAdmin = access.userIsAdmin(auth);
+  const isOwner = access.userOwnsItem(auth);
+  return isAdmin ? isAdmin : isOwner;
+};
+
+const access = { userIsAdmin, userOwnsItem, userIsAdminOrOwner };
+
+keystone.createList('User', {
+  fields: {
+    name: { type: Text },
+    email: {
+      type: Text,
+      isUnique: true,
+    },
+    isAdmin: {
+      type: Checkbox,
+      // Field-level access controls
+      // Here, we set more restrictive field access so a non-admin cannot make themselves admin.
+      access: {
+        update: access.userIsAdmin,
+      },
+    },
+    password: {
+      type: Password,
+    },
+  },
+  // List-level access controls
+  access: {
+    read: access.userIsAdminOrOwner,
+    update: access.userIsAdminOrOwner,
+    create: access.userIsAdmin,
+    delete: access.userIsAdmin,
+    auth: true,
+  },
+});
+
+const authStrategy = keystone.createAuthStrategy({
+  type: PasswordAuthStrategy,
+  list: 'User',
+});
+
+
+keystone.createList('cashregisters', CashregistersSchema);
+keystone.createList('cashregisterdocs', CashregisterdocsSchema);
+keystone.createList('companies', CompaniesSchema);
+keystone.createList('currency', CurrencySchema);
+keystone.createList('deliveryitems', DeliveryitemsSchema);
+keystone.createList('deliverymaterialprices', DeliverymaterialpricesSchema);
+keystone.createList('docflow', DocflowSchema);
+keystone.createList('docnumbers', DocnumbersSchema);
+keystone.createList('docpayment', DocpaymentSchema);
+keystone.createList('documents', DocumentsSchema);
+keystone.createList('eshop_removed', Eshop_removedSchema);
+keystone.createList('feature_groups_features', Feature_groups_featuresSchema);
+keystone.createList('feature_groups', Feature_groupsSchema);
+keystone.createList('features', FeaturesSchema);
+keystone.createList('featuresval', FeaturesvalSchema);
+keystone.createList('fifopart', FifopartSchema);
+keystone.createList('fifopos', FifoposSchema);
+keystone.createList('items', ItemsSchema); // todo: spr
+keystone.createList('kinds', KindsSchema);
+keystone.createList('locations', LocationsSchema);
+keystone.createList('logs', LogsSchema);
+keystone.createList('materials', MaterialsSchema);
+keystone.createList('monitor_logs', Monitor_logsSchema);
+keystone.createList('operatorgroupprivileges', OperatorgroupprivilegesSchema);
+keystone.createList('operatorgroups', OperatorgroupsSchema);
+keystone.createList('operators_cashregisters', Operators_cashregistersSchema);
+keystone.createList('operators_settings', Operators_settingsSchema);
+keystone.createList('operators_shops', Operators_shopsSchema);
+keystone.createList('operators', OperatorsSchema);
+keystone.createList('pictures', PicturesSchema);
+keystone.createList('positions', PositionsSchema);
+keystone.createList('printtemplates', PrinttemplatesSchema);
+keystone.createList('product_minmax_features', Product_minmax_featuresSchema);
+keystone.createList('productfeatures', ProductfeaturesSchema);
+keystone.createList('products_minmax', Products_minmaxSchema);
+keystone.createList('products', ProductsSchema);
+keystone.createList('productsgroup', ProductsgroupSchema);
+keystone.createList('settlements', SettlementsSchema);
+keystone.createList('shops', ShopsSchema);
+keystone.createList('stocktaking_items', Stocktaking_itemsSchema);
+keystone.createList('stocktaking', StocktakingSchema);
+keystone.createList('supaddress', SupaddressSchema);
+keystone.createList('suppliers', SuppliersSchema);
+keystone.createList('sysparams', SysparamsSchema);
+keystone.createList('sysprivileges', SysprivilegesSchema);
+keystone.createList('tagtemplateobjects', TagtemplateobjectsSchema);
+keystone.createList('tagtemplates', TagtemplatesSchema);
+keystone.createList('transferdocreceived', TransferdocreceivedSchema);
+keystone.createList('uninumbers', UninumbersSchema);
+keystone.createList('uom', UomSchema);
+keystone.createList('upgradelog', UpgradelogSchema);
+keystone.createList('vat', VatSchema);
+
+
+//console.log(keystone._providers);
+/*
+const {
+  resolveAllKeys,
+  arrayToObject,
+  mapKeys,
+  objMerge,
+  flatten,
+  unique,
+  filterValues,
+  compose,
+} = require('@keystonejs/utils');
+
+//console.log(keystone._providers);
+//console.log(keystone._providers.map(p => console.log(p.lists)));
+
+
+//const queries = unique(flatten(this._providers.map(p => p.lists.map(x => console.log(x.getGqlQueries())))));
+//const queries = unique(flatten(this._providers.map(p => p.lists.map(x => console.log())));
+
+//console.log(keystone._providers.map(p => console.log(p.lists)));//.map(x => x.getGqlQueries())));
+//console.log(keystone._providers[0].getQueries('public'));
+//const mutations = unique(flatten(keystone._providers.map(p => p.getMutations('public'))));
+//console.log(flatten(keystone._providers.map(p => p.getTypes('public'))));
+
+//queries.length > 0 && `type Query { ${queries.join('\n')} }`,
+//mutations.length > 0 && `type Mutation { ${mutations.join('\n')} }`,
+
+//console.log(keystone._providers);
+
+//console.log(keystone.getTypeDefs('public'));
+
+/*
+if (typeof process.env.DUMP_SCHEMA === 'string') {
+  keystone.dumpSchema(process.env.DUMP_SCHEMA, 'public');
+  console.log(`Schema dumped to: ${path.resolve(process.env.DUMP_SCHEMA)}`);
+  process.exit(0);
+}
+
+
+function function2() {
+  console.log(keystone);
+}
+setTimeout(function2, 100);
+*/
+
+module.exports = {
+  keystone,
+  apps: [
+    new GraphQLApp(),
+    new StaticApp({ path: '/', src: 'public' }),
+    new AdminUIApp({
+      name: 'SchuStocc',
+      enableDefaultRoute: true,
+      authStrategy,
+    }),
+  ],
+  /*configureExpress: app => {
+    app.set('trust proxy', true);
+  }*/
+};

+ 47 - 0
initial-data.js

@@ -0,0 +1,47 @@
+const crypto = require('crypto');
+const randomString = () => crypto.randomBytes(6).hexSlice();
+
+module.exports = async keystone => {
+
+
+  console.log('wtf');
+  // Count existing users
+  const {
+    data: {
+      _allUsersMeta: { count },
+    },
+  } = await keystone.executeQuery(
+    `query {
+      _allUsersMeta {
+        count
+      }
+    }`
+  );
+
+  if (count === 0) {
+    const password = randomString();
+    const email = 'dev@jubilerschubert.pl';
+
+    await keystone.executeQuery(
+      `mutation initialUser($password: String, $email: String) {
+            createUser(data: {name: "Admin", email: $email, isAdmin: true, password: $password}) {
+              id
+            }
+          }`,
+      {
+        variables: {
+          password,
+          email,
+        },
+      }
+    );
+
+    console.log(`
+
+User created:
+  email: ${email}
+  password: ${password}
+Please change these details after initial login.
+`);
+  }
+};

+ 28 - 0
package.json

@@ -0,0 +1,28 @@
+{
+  "name": "@keystonejs/example-projects-starter",
+  "description": "An example KeystoneJS project with a User list and Authentication.",
+  "private": true,
+  "version": "5.0.7",
+  "author": "The KeystoneJS Development Team",
+  "repository": "https://github.com/keystonejs/keystone/tree/master/packages/create-keystone-app/example-projects/starter",
+  "homepage": "https://github.com/keystonejs/keystone",
+  "license": "MIT",
+  "engines": {
+    "node": ">=10.0.0"
+  },
+  "scripts": {
+    "dev": "cross-env NODE_ENV=development DISABLE_LOGGING=false keystone dev",
+    "build": "cross-env NODE_ENV=production keystone build",
+    "start": "cross-env NODE_ENV=production DISABLE_LOGGING=false keystone start",
+    "create-tables": "cross-env CREATE_TABLES=true keystone create-tables"
+  },
+  "dependencies": {
+    "@keystonejs/adapter-knex": "^10.0.1",
+    "@keystonejs/app-admin-ui": "^6.0.0",
+    "@keystonejs/app-graphql": "^5.1.7",
+    "@keystonejs/auth-password": "^5.1.7",
+    "@keystonejs/fields": "^10.0.0",
+    "@keystonejs/keystone": "^9.0.0",
+    "cross-env": "^7.0.0"
+  }
+}

+ 16 - 0
schema/cashregisterdocs.js

@@ -0,0 +1,16 @@
+const { DateTime, Integer, Text, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        cashregisterdocs_id: { type: AutoIncrement, isRequired: true, label: 'cashregisterdocs_id' },
+        cashregisters_id: { type: Relationship, ref: 'cashregisters', many: false, label: 'cashregisters_id' },
+        // bankaccounts_id: { type: Relationship, ref: 'bankaccounts.bankaccounts_id', many: true, label: 'bankaccounts' }, //
+        // cashregisterreportpositions_id: { type: Relationship, ref: 'cashregisterreportpositions.cashregisterreportpositions_id', many: true, label: 'cashregisterreportpositions' }, //
+        date: { type: DateTime, isRequired: true, label: 'Data' },
+        docnumber: { type: Integer, label: 'Numer dokumentu' },
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: true, label: 'Dostawcy' },
+        suppliers_name: { type: Text, label: 'Nazwa dostawcy' },
+        currency_id: { type: Relationship, ref: 'currency', many: false, label: 'Waluta' },
+    }, label: 'Paragon'//, plural: 'Paragony'
+};

+ 12 - 0
schema/cashregisters.js

@@ -0,0 +1,12 @@
+const { Integer, Text } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        cashregisters_id: { type: Integer, isRequired: true, label: 'cashregisters_id' },
+        name: { type: Text, label: 'Nazwa' },
+    }, label: 'cashregister'//, plural: 'Paragony (cr)'
+};
+
+// todo: w postgresie domyslna wartosc to byl kolejny numer: nextval('cashregisters_cashregisters_id_seq'::regclass)
+
+//cashregisters.cashregisters_id

+ 23 - 0
schema/companies.js

@@ -0,0 +1,23 @@
+const { Text } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        companies_id: { type: AutoIncrement, isRequired: true, label: 'ID Firmy' },
+        company_name: { type: Text, isRequired: true, label: 'Nazwa firmy' },
+        headerdata: { type: Text, isRequired: true, label: 'headerdata' },
+        us_code: { type: Text, label: 'us_code' },
+        company_name_jpk: { type: Text, label: 'Nazwa firmy do JPK' },
+        nip: { type: Text, isRequired: true, label: 'NIP' },
+        regon: { type: Text, isRequired: true, label: 'REGON' },
+        voivodeship: { type: Text, isRequired: true, label: 'voivodeship' },
+        county: { type: Text, isRequired: true, label: 'Wojewodztwo' },
+        municipality: { type: Text, isRequired: true, label: 'Miasto' },
+        street: { type: Text, isRequired: true, label: 'Ulica' },
+        building_number: { type: Text, isRequired: true, label: 'Numer budynku' },
+        flat_number: { type: Text, isRequired: true, label: 'Numer mieszkania' },
+        city: { type: Text, isRequired: true, label: 'Miasto' },
+        postal_code: { type: Text, isRequired: true, label: 'Kod pocztowy' },
+        post_office: { type: Text, isRequired: true, label: 'Poczta' },
+    }, label: 'Firma'//, plural: 'Firmy'
+};

+ 11 - 0
schema/currency.js

@@ -0,0 +1,11 @@
+const { Text, Decimal, DateTime } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        currency_id: { type: AutoIncrement, isRequired: true, label: 'ID Waluty' },
+        symbol: { type: Text, isRequired: true, label: 'Symbol' },
+        rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'Kurs' },
+        date_rate: { type: DateTime, label: 'Data kursu' },
+    }, label: 'Waluta'//, plural: 'Waluty'
+};

+ 22 - 0
schema/deliveryitems.js

@@ -0,0 +1,22 @@
+const { Text, Decimal, Integer, Checkbox, Uuid, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        deliveryitems_id: { type: Uuid, isRequired: true, label: 'deliveryitems' },
+        catnum: { type: Text, label: 'Numer katalogowy' },
+        price_netto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena netto' },
+        value_netto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc netto' },
+        isize: { type: Text, isRequired: true, label: 'isize' },
+        mass: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Masa' },
+        quantity: { type: Integer, label: 'Ilosc' },
+        documents_id: { type: Relationship, ref: 'documents', many: true, isRequired: true, label: 'documents' },
+        kinds_id: { type: Relationship, ref: 'kinds', many: true, label: 'kinds' },
+        uom_id: { type: Relationship, ref: 'uom', many: false, label: 'uom' },
+        materials_id: { type: Relationship, ref: 'materials', many: true, label: 'Surowiec' },
+        vat_id: { type: Relationship, ref: 'vat', many: false, isRequired: true, label: 'VAT' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+        fifo: { type: Checkbox, isRequired: true, label: 'fifo' },
+        itype: { type: Integer, isRequired: true, label: 'itype' },
+    }, label: 'Deliveryitem'//, plural: 'Deliveryitemss'
+};

+ 12 - 0
schema/deliverymaterialprices.js

@@ -0,0 +1,12 @@
+const { Text, Decimal, Uuid, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        deliverymaterialprices_id: { type: Uuid, isRequired: true, label: 'deliverymaterialprices' },
+        material: { type: Text, isRequired: true, label: 'Surowiec' },
+        price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, isRequired: true, label: 'Cena' },
+        documents_id: { type: Relationship, ref: 'documents', many: true, isRequired: true, label: 'documents' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+    }, label: 'Deliverymaterialprice'//, plural: 'Deliverymaterialpricess'
+};

+ 10 - 0
schema/docflow.js

@@ -0,0 +1,10 @@
+const { Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        docflow_id: { type: Uuid, isRequired: true, label: 'docflow' },
+        id1: { type: Uuid, isRequired: true, label: 'id1' },
+        id2: { type: Uuid, isRequired: true, label: 'id2' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, label: 'Magazyn' },
+    }//, label: 'Docflow'//, plural: 'Docflows'
+};

+ 12 - 0
schema/docnumbers.js

@@ -0,0 +1,12 @@
+const { Text, Integer, Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        docnumbers_id: { type: Uuid, isRequired: true, label: 'docnumbers' },
+        dtype: { type: Text, isRequired: true, label: 'dtype' },
+        year: { type: Text, isRequired: true, label: 'Rok' },
+        dnumber: { type: Integer, isRequired: true, label: 'dnumber' },
+        numformat: { type: Text, isRequired: true, label: 'numformat' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
+    }, label: 'Docnumber'//, plural: 'Docnumberss'
+};

+ 22 - 0
schema/docpayment.js

@@ -0,0 +1,22 @@
+const { Text, Decimal, Integer, DateTime, Checkbox, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        docpayment_id: { type: AutoIncrement, isRequired: true, label: 'Dokument sprzedazy' },
+        ptype: { type: Text, label: 'ptype' },
+        pvalue: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'pvalue' },
+        pdays: { type: Integer, label: 'pdays' },
+        documents_id: { type: Relationship, ref: 'documents', many: true, label: 'documents' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+        date_issue: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'date_issue' },
+        //advance_id: { type: Relationship, ref: 'advance.advance_id', many: false, label: 'advance' }, todo: spr. czy potrzebne
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: true, label: 'Dostawca' },
+        suppliers_name: { type: Text, label: 'Nazwa Dostawcy' },
+        date_payment: { type: DateTime, format: 'DD.MM.YYYY h:mm', label: 'Data platnosci' },
+        symbol_document: { type: Text, label: 'symbol_document' },
+        delayed: { type: Checkbox, label: 'Po terminie' },
+        archived: { type: Checkbox, label: 'Zarchiwizowano' },
+        currency_id: { type: Relationship, ref: 'currency', many: false, isRequired: true, label: 'Waluta' },
+    }//, label: 'Docpayment'//, plural: 'Docpayments'
+};

+ 42 - 0
schema/documents.js

@@ -0,0 +1,42 @@
+const { Integer, Checkbox, Text, Decimal, DateTime, Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        documents_id: { type: Uuid, isRequired: true, label: 'documents' },
+        docnumber: { type: Integer, isRequired: true, label: 'Numer dokumentu' },
+        accepted: { type: Checkbox, isRequired: true, label: 'Zatwierdzono' },
+        canceled: { type: Checkbox, isRequired: true, label: 'Anulowano' },
+        symbol: { type: Text, label: 'Symbol' },
+        proofsymbol: { type: Text, label: 'proofsymbol' },
+        dtype: { type: Text, isRequired: true, label: 'dtype' },
+        bprices: { type: Checkbox, isRequired: true, label: 'bprices' },
+        value_netto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc netto' },
+        value_vat: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc VAT' },
+        value_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc zakupu' },
+        date_w: { type: DateTime, isRequired: true, label: 'date_w' },
+        date_s: { type: DateTime, label: 'date_s' },
+        date_c: { type: DateTime, label: 'date_c' },
+        currency_rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'Kurs wymiany' },
+        currency_material_rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'Kurs wymiany za surowiec' },
+        printed: { type: Checkbox, isRequired: true, label: 'Wydrukowano?' },
+        print_memo_text: { type: Text, label: 'Notatka' },
+        convinfo: { type: Text, label: 'convinfo' },
+        convtype: { type: Text, label: 'convtype' },
+        barcode: { type: Text, label: 'Kod Kreskowy' },
+        exp: { type: Text, label: 'exp' },
+        purchase_costs: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt zakupu' },
+        origin: { type: Text, label: 'Pochodzenie' },
+        // target_shops_id: { type: Relationship, ref: 'target_shops.target_shops_id', many: true, label: 'target_shops' }, todo: spr. czy potrzebne?
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: true, label: 'Dostawca' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+        currency_id: { type: Relationship, ref: 'currency', many: false, label: 'Waluta' },
+        operators_id: { type: Relationship, ref: 'operators', many: true, label: 'Uzytkownik' },
+        comment: { type: Text, label: 'Komentarz' },
+        return_symbol: { type: Text, label: 'return_symbol' },
+        return_date_issue: { type: DateTime, label: 'return_date_issue' },
+        return_date_receipt: { type: DateTime, label: 'return_date_receipt' },
+        //document_groups_id: { type: Relationship, ref: 'document_groups.document_groups_id', many: true, label: 'document_groups' }, todo: spr. czy istotne
+        custom_vat: { type: Integer, label: 'custom_vat' },
+        nip: { type: Text, label: 'NIP' },
+    }, label: 'Document'//, plural: 'Documentss'
+};

+ 13 - 0
schema/eshop_removed.js

@@ -0,0 +1,13 @@
+const { DateTime, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        eshop_removed_id: { type: AutoIncrement, isRequired: true, label: 'eshop_removed' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, label: 'Magazyn' },
+        items_id: { type: Relationship, ref: 'items', many: false, label: 'Egzemplarze' },
+        article_id: { type: Relationship, ref: 'items', many: false, label: 'Artykul' },
+        productsguid_id: { type: Relationship, ref: 'products', many: false, label: 'Produkt' },
+        removed_at: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Data usuniecia' },
+    }//, label: 'Usuniete z e-sklepu'////, plural: 'Usuniete z e-sklepu'
+};

+ 9 - 0
schema/feature_groups.js

@@ -0,0 +1,9 @@
+const { Text } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        feature_groups_id: { type: AutoIncrement, isRequired: true, label: 'feature_groups' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+    }, label: 'Feature_group'////, plural: 'Feature_groups'
+};

+ 10 - 0
schema/feature_groups_features.js

@@ -0,0 +1,10 @@
+const { Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        feature_groups_features_id: { type: AutoIncrement, isRequired: true, label: 'feature_groups_features' },
+        feature_groups_id: { type: Relationship, ref: 'feature_groups', many: true, label: 'feature_groups' },
+        feature_id: { type: Relationship, ref: 'features', many: false, label: 'feature' },
+    }, label: 'Feature_groups_feature'//, plural: 'Feature_groups_featuress'
+};

+ 16 - 0
schema/features.js

@@ -0,0 +1,16 @@
+const { Text, Checkbox, Integer, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        features_id: { type: AutoIncrement, isRequired: true, label: 'ID Atrybutu' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+        hide: { type: Checkbox, isRequired: true, label: 'Ukryty' },
+        type: { type: Integer, isRequired: true, label: 'Typ' },
+        parent_id: { type: Relationship, ref: 'features', many: false, label: 'Nadrzedny' },
+        constant: { type: Checkbox, isRequired: true, label: 'Staly' },
+        print_type: { type: Integer, isRequired: true, label: 'print_type' },
+        user_valtype: { type: Integer, label: 'user_valtype' },
+        user_valtype_decimal_precision: { type: Integer, label: 'user_valtype_decimal_precision' },
+    }, label: 'Atrybut'//, plural: 'Atrybuty'
+};

+ 11 - 0
schema/featuresval.js

@@ -0,0 +1,11 @@
+const { Text, Checkbox, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        featuresval_id: { type: AutoIncrement, isRequired: true, label: 'ID Wartosci Atrybutu' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+        hide: { type: Checkbox, isRequired: true, label: 'Ukryty' },
+        features_id: { type: Relationship, ref: 'features', many: false, label: 'Atrybut' },
+    }//, label: 'Wartosc atrybutu'//, plural: 'Wartosci atrybutow'
+};

+ 23 - 0
schema/fifopart.js

@@ -0,0 +1,23 @@
+const { Text, DateTime, Decimal, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        fifopart_id: { type: AutoIncrement, isRequired: true, label: 'fifopart' },
+        pos_id: { type: Relationship, ref: 'positions', many: true, label: 'pos_id' },
+        pos_corrsrc_id: { type: Relationship, ref: 'positions', many: false, label: 'pos_corrsrc' },
+        type: { type: Text, label: 'Typ' },
+        state: { type: Text, label: 'state' },
+        id: { type: Text, label: 'id' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+        items_id: { type: Relationship, ref: 'items', many: true, label: 'Egzemplarz' },
+        date_part: { type: DateTime, isRequired: true, label: 'date_part' },
+        quantity: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'Ilosc' },
+        price_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_purchase' },
+        value: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'value' },
+        quantity2: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'quantity2' },
+        value2: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'value2' },
+        xyz: { type: Text, label: 'xyz' },
+        price_orig: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_orig' },
+    }, label: 'Fifopart'//, plural: 'Fifoparts'
+};

+ 17 - 0
schema/fifopos.js

@@ -0,0 +1,17 @@
+const { DateTime, Text, Decimal, Uuid, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        fifopos_id: { type: AutoIncrement, isRequired: true, label: 'fifopos' },
+        fifopart_id: { type: Relationship, ref: 'fifopart', many: false, label: 'fifopart' },
+        pos_id: {type: Relationship, ref: 'positions', many: true, label: 'pos_id' },
+        date_part: { type: DateTime, isRequired: true, label: 'date_part' },
+        id: { type: Text, label: 'id' },
+        items_id: { type: Relationship, ref: 'items', many: true, label: 'Egzemplarz' },
+        quantity: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'Ilosc' },
+        price_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_purchase' },
+        value: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'value' },
+        price_orig: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_orig' },
+    }, label: 'Fifopo'//, plural: 'Fifoposs'
+};

+ 63 - 0
schema/items.js

@@ -0,0 +1,63 @@
+const { Integer, Checkbox, Text, Decimal, DateTime, Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        items_id: { type: Uuid, isRequired: true, label: 'Egzemplarz' },
+        article_id: { type: Uuid, many: false, label: 'article' },
+        productsguid_id: { type: Relationship, ref: 'products', many: false, label: 'productsguid' },
+        itype: { type: Integer, isRequired: true, label: 'itype' },
+        sold: { type: Checkbox, isRequired: true, label: 'sold' },
+        deficiency: { type: Checkbox, isRequired: true, label: 'deficiency' },
+        catnum: { type: Text, label: 'catnum' },
+        description: { type: Text, label: 'description' },
+        price_delivery: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_delivery' },
+        price_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_purchase' },
+        price_detal: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_detal' },
+        price_detal_brutto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena detaliczna brutto' },
+        price_eshop: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena esklep' },
+        profit_margin: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Marza' },
+        isize: { type: Text, isRequired: true, label: 'isize' },
+        mass: { type: Decimal, knexOptions: { precision: 10, scale: 2 }, label: 'Masa' },
+        quantity: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'Ilosc' },
+        barcode: { type: Text, label: 'Kod kreskowy' },
+        tagged: { type: Checkbox, isRequired: true, label: 'tagged' },
+        currency_id: { type: Relationship, ref: 'currency', many: false, label: 'Waluta' },
+        producer: { type: Text, label: 'Producent' },
+        symbol_prod: { type: Text, label: 'Symbol producenta' },
+        silver_price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt srebra' },
+        gold_price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt zlota' },
+        platin_price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt platyny' },
+        purchase_date: { type: DateTime, label: 'Data zakupu' },
+        promo: { type: Checkbox, isRequired: true, label: 'promo' },
+        news: { type: Checkbox, isRequired: true, label: 'news' },
+        best: { type: Checkbox, isRequired: true, label: 'best' },
+        name: { type: Text, label: 'Nazwa' },
+        desctxt: { type: Text, label: 'desctxt' },
+        seotxt: { type: Text, label: 'seotxt' },
+        eshop: { type: Checkbox, isRequired: true, label: 'E-sklep' },
+        created_at: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Utworzono' },
+        modified_at: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Zmieniono' },
+        sup_id: { type: Relationship, ref: 'suppliers', many: false, label: 'suppliers_id' },
+        //pzdoc_id: { type: Relationship, ref: 'pzdoc.pzdoc_id', many: false, label: 'pzdoc' }, todo: spr. czy istotne
+        kinds_id: { type: Relationship, ref: 'kinds', many: true, label: 'kinds' },
+        uom_id: { type: Relationship, ref: 'uom', many: false, label: 'uom' },
+        materials_id: { type: Relationship, ref: 'materials', many: true, label: 'materials' },
+        vat_id: { type: Relationship, ref: 'vat', many: false, isRequired: true, label: 'VAT' },
+        locations_id: { type: Relationship, ref: 'locations', many: true, label: 'locations' },
+        deliveryitems_id: { type: Relationship, ref: 'deliveryitems', many: true, label: 'deliveryitems' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+        tagsoper_id: { type: Relationship, ref: 'operators', many: false, label: 'tagsoper' }, // todo: spr czy o to chodzilo w foregin keys orgyinalnej bazy
+        price_delivery_before_discount: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Koszt dostawy przed rabatem' },
+        fifo_value: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'fifo_value' },
+        fifo: { type: Checkbox, label: 'fifo' },
+        fifo_last_price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'fifo_last_price' },
+        transit: { type: Checkbox, isRequired: true, label: 'Transport' },
+        transit_symbol: { type: Text, label: 'Symbol transportu' },
+        transit_proofsymbol: { type: Text, label: 'transit_proofsymbol' },
+        transit_currency_id: { type: Relationship, ref: 'currency', many: false, label: 'Waluta transportu' },
+        transit_currency_rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'transit_currency_rate' },
+        transit_purchase_costs: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'transit_purchase_costs' },
+        transit_currency_material_rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'transit_currency_material_rate' },
+        quantity_precision: { type: Integer, isRequired: true, label: 'quantity_precision' },
+    }, label: 'Item'//, plural: 'Itemss'
+};

+ 11 - 0
schema/kinds.js

@@ -0,0 +1,11 @@
+const { Text, Checkbox, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        kinds_id: { type: AutoIncrement, label: 'ID Kategorii' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+        hide: { type: Checkbox, isRequired: true, label: 'Ukryta' }, //
+        feature_group_id: { type: Relationship, ref: 'feature_groups', many: false, label: 'feature_group' },
+    }, label: 'Kategoria produktu'//, plural: 'Kategorie produktow'
+};

+ 12 - 0
schema/locations.js

@@ -0,0 +1,12 @@
+const { Text, Checkbox, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        locations_id: { type: AutoIncrement, isRequired: true, label: 'Lokalizacja' },
+        symbol: { type: Text, isRequired: true, label: 'Symbol' },
+        name: { type: Text, label: 'Nazwa' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+        defloc: { type: Checkbox, label: 'defloc' },
+    }, label: 'Location'//, plural: 'Locationss'
+};

+ 15 - 0
schema/logs.js

@@ -0,0 +1,15 @@
+const { Integer, Text, DateTime, Uuid, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        logs_id: { type: Uuid, label: 'Log' },
+        code: { type: Integer, label: 'code' },
+        type: { type: Text, label: 'Typ' },
+        message: { type: Text, label: 'message' },
+        created_at: { type: DateTime, format: 'DD.MM.YYYY h:mm', label: 'Data' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, label: 'Magazyn' },
+        operators_id: { type: Relationship, ref: 'operators', many: true, label: 'Operator' },
+        version: { type: Text, label: 'Wersja' },
+    }, label: 'Log'//, plural: 'Logi'
+};

+ 10 - 0
schema/materials.js

@@ -0,0 +1,10 @@
+const { Text, Checkbox } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        materials_id: { type: AutoIncrement, isRequired: true, label: 'ID Surowca' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+        hide: { type: Checkbox, isRequired: true, label: 'Ukryj' },
+    }, label: 'Surowiec'//, plural: 'Surowce'
+};

+ 15 - 0
schema/monitor_logs.js

@@ -0,0 +1,15 @@
+const { DateTime, Integer, Text, Checkbox } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        monitor_logs_id: { type: AutoIncrement, isRequired: true, label: 'monitor_logs' },
+        date_event: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Data' },
+        type: { type: Integer, isRequired: true, label: 'Typ' },
+        comment: { type: Text, label: 'Komentarz' },
+        row: { type: Text, label: 'Wiersz' },
+        fields_old: { type: Text, label: 'fields_old' },
+        fields_new: { type: Text, label: 'fields_new' },
+        reported: { type: Checkbox, label: 'reported' },
+    }, label: 'Monitor_log'//, plural: 'Monitor_logss'
+};

+ 10 - 0
schema/operatorgroupprivileges.js

@@ -0,0 +1,10 @@
+const { Integer, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        operatorgroupprivileges_id: { type: AutoIncrement, isRequired: true, label: 'IDUprawnienia' },
+        puni: { type: Integer, isRequired: true, label: 'puni' },
+        operatorgroup_id: { type: Relationship, ref: 'operatorgroups', many: false, isRequired: true, label: 'Grupa uzytkownika' },
+    }, label: 'operatorgroupprivilege'//, plural: 'Uprawnienie Grupy Uzytkownika'
+};

+ 9 - 0
schema/operatorgroups.js

@@ -0,0 +1,9 @@
+const { Text } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        operatorgroups_id: { type: AutoIncrement, isRequired: true, label: 'IDTypuuzytkownika' },
+        name: { type: Text, label: 'Nazwa' },
+    }, label: 'Typ uzytkownika'//, plural: 'Typy uzytkownikow'
+};

+ 14 - 0
schema/operators.js

@@ -0,0 +1,14 @@
+const { Checkbox, Text, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        operators_id: { type: AutoIncrement, isRequired: true, label: 'Uzytkownik' },
+        active: { type: Checkbox, isRequired: true, label: 'Aktywny' },
+        name: { type: Text, isRequired: true, label: 'Imie' },
+        surname: { type: Text, isRequired: true, label: 'Nazwisko' },
+        pass: { type: Text, isRequired: true, label: 'Haslo' },
+        superoper: { type: Checkbox, isRequired: true, label: 'Super Admin' },
+        group_id: { type: Relationship, ref: 'operatorgroups', many: false, label: 'Grupa' },
+    }, label: 'Uzytkownicy'//, plural: 'Uzytkownik'
+};

+ 11 - 0
schema/operators_cashregisters.js

@@ -0,0 +1,11 @@
+const { Checkbox, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        operators_cashregisters_id: { type: AutoIncrement,isRequired: true, label: 'IDoperators_cashregisters' },
+        operators_id: { type: Relationship, ref: 'operators', many: true, isRequired: true, label: 'Uzytkownik' },
+        cashregisters_id: { type: Relationship, ref: 'cashregisters', many: true, isRequired: true, label: 'Kasa' },
+        default_cashregister: { type: Checkbox, isRequired: true, label: 'Kasa Domyslna' },
+    }, label: 'Operators_cashregister'//, plural: 'Operators_cashregisterss'
+};

+ 12 - 0
schema/operators_settings.js

@@ -0,0 +1,12 @@
+const { Text, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        operators_settings_id: { type: AutoIncrement, isRequired: true, label: 'Ustawienia uzytkownika' },
+        operators_id: { type: Relationship, ref: 'operators', many: true, isRequired: true, label: 'Uzytkownik' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, label: 'Magazyn' },
+        //settings_id: { type: Relationship, ref: 'settings.settings_id', many: true, isRequired: true, label: 'Ustawienia' }, // todo: spr. czy potrzebne?
+        value: { type: Text, label: 'Wartosc' },
+    }, label: 'Ustawienia uzytkownika'//, plural: 'Ustawienia uzytkownika'
+};

+ 10 - 0
schema/operators_shops.js

@@ -0,0 +1,10 @@
+const { Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        operators_shops_id: { type: AutoIncrement,isRequired: true, label: 'Magazyny Uzytkownika' },
+        operators_id: { type: Relationship, ref: 'operators', many: true, isRequired: true, label: 'Uzytkownik' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+    }, label: 'Operators_shop'//, plural: 'Operators_shopss'
+};

+ 16 - 0
schema/pictures.js

@@ -0,0 +1,16 @@
+const { Text, Checkbox, Integer, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        pictures_id: { type: AutoIncrement, isRequired: true, label: 'ID Zdjecia' },
+        filename: { type: Text, label: 'Nazwa pliku' },
+        filepath: { type: Text, label: 'Ściezka pliku' },
+        srvname: { type: Text, label: 'srvname' },
+        main: { type: Checkbox, isRequired: true, label: 'Glowne' },
+        description: { type: Text, label: 'Opis' },
+        image_file_size: { type: Integer, label: 'Rozmiar' },
+        thumb_file_size: { type: Integer, label: 'Rozmiar miniatury' },
+        article_id: { type: Relationship, ref: 'items', many: false, label: 'Produkt' },
+    }, label: 'Zdjecie'//, plural: 'Zdjecia'
+};

+ 33 - 0
schema/positions.js

@@ -0,0 +1,33 @@
+const { Text, Integer, DateTime, Decimal, Checkbox, Uuid, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        positions_id: { type: Uuid, many: true, isRequired: true, label: 'positions' },
+        dtype: { type: Text, isRequired: true, label: 'dtype' },
+        pitype: { type: Integer, label: 'pitype' },
+        pdate: { type: DateTime, label: 'pdate' },
+        price_netto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena netto' },
+        price_brutto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena brutto' },
+        value_netto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc netto' },
+        value_vat: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc VAT' },
+        price_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena zakupu' },
+        currency_rate: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'Kurs waluty' },
+        discount: { type: Decimal, knexOptions: { precision: 12, scale: 4 }, label: 'Upust' },
+        discount_doc: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'discount_doc' },
+        docdiscount: { type: Decimal, knexOptions: { precision: 5, scale: 1 }, label: 'docdiscount' },
+        ord: { type: Integer, label: 'ord' },
+        quantity: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'Ilosc' },
+        kor: { type: Checkbox, isRequired: true, label: 'kor' },
+        vat_id: { type: Relationship, ref: 'vat', many: false, label: 'VAT' },
+        documents_id: { type: Relationship, ref: 'documents', many: true, label: 'documents' },
+        items_id: { type: Relationship, ref: 'items', many: true, isRequired: true, label: 'Egzemplarz' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+        fifo: { type: Checkbox, label: 'fifo' },
+        fifogen: { type: Checkbox, label: 'fifogen' },
+        deliveryitems_id: { type: Relationship, ref: 'deliveryitems', many: true, label: 'deliveryitems' },
+        fifoposkor_id: { type: Relationship, ref: 'fifopos', many: false, label: 'fifoposkor' }, // todo: spr foreignkey, nie wiadomo czy o to chodzilo
+        custom_name: { type: Text, label: 'custom_name' },
+        custom_desc: { type: Text, label: 'custom_desc' },
+    }, label: 'Position'//, plural: 'Positionss'
+};

+ 21 - 0
schema/printtemplates.js

@@ -0,0 +1,21 @@
+const { Text, Checkbox, Decimal } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        printtemplates_id: { type: AutoIncrement, isRequired: true, label: 'ID Szablonu wydruku' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+        dtype: { type: Text, isRequired: true, label: 'Typ dokumentu' },
+        landscape: { type: Checkbox, isRequired: true, label: 'Poziomy' },
+        sourcedoc: { type: Checkbox, isRequired: true, label: 'Dokument zrodlowy' },
+        docpayment: { type: Checkbox, isRequired: true, label: 'Dokument sprzedazy' },
+        linesvert: { type: Checkbox, isRequired: true, label: 'linesvert' },
+        lineshorz: { type: Checkbox, isRequired: true, label: 'lineshorz' },
+        values: { type: Checkbox, isRequired: true, label: 'Wartosci' },
+        unrestricted: { type: Checkbox, isRequired: true, label: 'unrestricted' },
+        positions_text_size: { type: Decimal, knexOptions: { precision: 5, scale: 2 }, isRequired: true, label: 'positions_text_size' },
+        positionstable: { type: Text, isRequired: true, label: 'positionstable' },
+        default_template: { type: Checkbox, isRequired: true, label: 'Domyslny szablon' },
+        print_date_c: { type: Checkbox, isRequired: true, label: 'print_date_c' },
+    }, label: 'Szablon wydruku'//, plural: 'Szablony wydruku'
+};

+ 12 - 0
schema/product_minmax_features.js

@@ -0,0 +1,12 @@
+const { Text, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        product_minmax_features_id: { type: AutoIncrement, isRequired: true, label: 'product_minmax_features' },
+        products_minmax_id: { type: Relationship, ref: 'products_minmax', many: false, isRequired: true, label: 'products_minmax' },
+        features_id: { type: Relationship, ref: 'features', many: false, isRequired: true, label: 'Atrybut' },
+        features_val_id: { type: Relationship, ref: 'featuresval', many: false, label: 'Wartosc atrybutu' },
+        custom_val: { type: Text, label: 'custom_val' },
+    }, label: 'Product_minmax_feature'//, plural: 'Product_minmax_featuress'
+};

+ 13 - 0
schema/productfeatures.js

@@ -0,0 +1,13 @@
+const { Text, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        productfeatures_id:  { type: AutoIncrement, isRequired: true, label: 'productfeatures' },
+        features_id: { type: Relationship, ref: 'features', many: true, label: 'features' },
+        featuresval_id: { type: Relationship, ref: 'featuresval', many: false, label: 'featuresval' },
+        article_id: { type: Relationship, ref: 'items', many: false, label: 'article' },
+        custom_value: { type: Text, label: 'custom_value' },
+    }, label: 'Productfeature'//, plural: 'Productfeaturess'
+};
+

+ 49 - 0
schema/products.js

@@ -0,0 +1,49 @@
+const { Text, Uuid, Decimal, Integer, Checkbox, DateTime, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        products_id: { type: AutoIncrement, isRequired: true, label: 'products' },
+        productsguid_id: { type: Uuid, many: false, label: 'productsguid' },
+        catnum: { type: Text, label: 'catnum' },
+        symbol_supplier: { type: Text, label: 'symbol_supplier' },
+        description: { type: Text, label: 'description' },
+        price_delivery: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_delivery' },
+        price_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_purchase' },
+        price_detal: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_detal' },
+        price_detal_brutto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_detal_brutto' },
+        price_eshop: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena esklep' },
+        profit_margin: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Marza' },
+        isize: { type: Text, isRequired: true, label: 'isize' },
+        mass: { type: Decimal, knexOptions: { precision: 10, scale: 2 }, label: 'Masa' },
+        productiondays: { type: Integer, label: 'Czas prukcji' },
+        promo: { type: Checkbox, isRequired: true, label: 'Promocja' },
+        news: { type: Checkbox, isRequired: true, label: 'news' },
+        best: { type: Checkbox, isRequired: true, label: 'best' },
+        name: { type: Text, label: 'Nazwa' },
+        desctxt: { type: Text, label: 'Opis' },
+        seotxt: { type: Text, label: 'SEO' },
+        eshop: { type: Checkbox, isRequired: true, label: 'esklep' },
+        created_at: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Stworzono:' },
+        modified_at: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Zmodyfikowano:' },
+        currency_id: { type: Relationship, ref: 'currency', many: false, label: 'Waluta' },
+        kinds_id: { type: Relationship, ref: 'kinds', many: true, label: 'Rodzaje' },
+        uom_id: { type: Relationship, ref: 'uom', many: false, label: 'uom' },
+        materials_id: { type: Relationship, ref: 'materials', many: true, label: 'Surowiec' },
+        vat_id: { type: Relationship, ref: 'vat', many: false, label: 'VAT' },
+        productsgroup_id: { type: Relationship, ref: 'productsgroup', many: false, label: 'productsgroup' },
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: true, label: 'Dostawca' },
+        custom1: { type: Text, label: 'Dane 1' },
+        custom2: { type: Text, label: 'Dane 2' },
+        custom3: { type: Text, label: 'Dane 3' },
+        custom4: { type: Text, label: 'Dane 4' },
+        custom5: { type: Text, label: 'Dane 5' },
+        qdec: { type: Integer, label: 'qdec' },
+        fifo: { type: Checkbox, label: 'fifo' },
+        barcode: { type: Text, label: 'barcode' },
+        price_detal_per_uom: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_detal_per_uom' },
+        price_detal_per_uom_brutto: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'price_detal_per_uom_brutto' },
+        minmax_active: { type: Checkbox, isRequired: true, label: 'Min/Max' },
+        auto_order: { type: Checkbox, isRequired: true, label: 'auto_order' },
+    }, label: 'Product'//, plural: 'Productss'
+};

+ 14 - 0
schema/products_minmax.js

@@ -0,0 +1,14 @@
+const { DateTime, Decimal, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        products_minmax_id: { type: AutoIncrement, isRequired: true, label: 'products_minmax' },
+        products_id: { type: Relationship, ref: 'products', many: true, isRequired: true, label: 'products' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+        date_from: { type: DateTime, label: 'Od' },
+        date_to: { type: DateTime, label: 'Do' },
+        min: { type: Decimal, knexOptions: { precision: 10, scale: 4 }, isRequired: true, label: 'min' },
+        max: { type: Decimal, knexOptions: { precision: 10, scale: 4 }, isRequired: true, label: 'max' },
+    }, label: 'Products_minmax'//, plural: 'Products_minmaxs'
+};

+ 11 - 0
schema/productsgroup.js

@@ -0,0 +1,11 @@
+const { Text, Uuid, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        productsgroup_id: { type: AutoIncrement, many: false, isRequired: true, label: 'productsgroup' },
+        name: { type: Text, label: 'Nazwa' },
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: true, label: 'suppliers' },
+        productsgroup_guid: { type: Uuid, isRequired: true, label: 'productsgroup_guid' },
+    }, label: 'Productsgroup'//, plural: 'Productsgroups'
+};

+ 14 - 0
schema/settlements.js

@@ -0,0 +1,14 @@
+const { Text, Decimal, Checkbox, DateTime, Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        settlements_id: { type: Uuid, isRequired: true, label: 'settlements' },
+        docpayment_id: { type: Relationship, ref: 'docpayment', many: false, label: 'Dokument sprzedazy' },
+        cashregisterdoc_id: { type: Relationship, ref: 'cashregisterdocs', many: false, label: 'cashregisterdoc' },
+        desc_docpayment: { type: Text, label: 'Dokument sprzedazy' },
+        desc_cashregisterdoc: { type: Text, label: 'Rachunek' },
+        amount: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, isRequired: true, label: 'Kwota' },
+        overpayment: { type: Checkbox, isRequired: true, label: 'Nadplata' },
+        date: { type: DateTime, isRequired: true, label: 'Data' },
+    }, label: 'Settlement'//, plural: 'Settlements'
+};

+ 13 - 0
schema/shops.js

@@ -0,0 +1,13 @@
+const { Text, Integer, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        shops_id: { type: AutoIncrement, isRequired: true, label: 'Magazyn' },
+        symbol: { type: Text, isRequired: true, label: 'Symbol' },
+        warehouse_name: { type: Text, isRequired: true, label: 'warehouse_name' },
+        headerdata: { type: Text, isRequired: true, label: 'headerdata' },
+        type: { type: Integer, isRequired: true, label: 'type' },
+        companies_id: { type: Relationship, ref: 'companies', many: true, isRequired: true, label: 'Firma' },
+    }, label: 'Shop'//, plural: 'Shopss'
+};

+ 13 - 0
schema/stocktaking.js

@@ -0,0 +1,13 @@
+const { Checkbox, DateTime, Text, Integer, Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        stocktaking_id: { type: Uuid, isRequired: true, label: 'stocktaking' },
+        accepted: { type: Checkbox, isRequired: true, label: 'Zatwierdzono' },
+        date_o: { type: DateTime, label: 'date_o' },
+        name: { type: Text, label: 'Nazwa' },
+        posnumber: { type: Integer, label: 'posnumber' },
+        operators_id: { type: Relationship, ref: 'operators', many: true, isRequired: true, label: 'Uzytkownik' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+    }, label: 'Stocktaking'//, plural: 'Stocktakings'
+};

+ 14 - 0
schema/stocktaking_items.js

@@ -0,0 +1,14 @@
+const { Decimal, Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        stocktaking_items_id: { type: Uuid, isRequired: true, label: 'stocktaking_items' },
+        stocktaking_id: { type: Relationship, ref: 'stocktaking', many: false, isRequired: true, label: 'stocktaking' },
+        quantity: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'Ilosc' },
+        quantity2: { type: Decimal, knexOptions: { precision: 14, scale: 3 }, label: 'quantity2' },
+        value_purchase: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Wartosc zakupu' },
+        price: { type: Decimal, knexOptions: { precision: 12, scale: 2 }, label: 'Cena' },
+        items_id: { type: Relationship, ref: 'items', many: true, isRequired: true, label: 'Egzemplarz' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+    }, label: 'Stocktaking_item'//, plural: 'Stocktaking_itemss'
+};

+ 23 - 0
schema/supaddress.js

@@ -0,0 +1,23 @@
+const { Integer, Text, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        supaddress_id: { type: AutoIncrement, isRequired: true, label: 'supaddress' },
+        addrtype: { type: Integer, isRequired: true, label: 'addrtype' },
+        name: { type: Text, label: 'Imie' },
+        surname: { type: Text, label: 'Nazwisko' },
+        companyname: { type: Text, label: 'Nazwa Firmy' },
+        street: { type: Text, label: 'Ulica' },
+        housenumber: { type: Text, label: 'Nr. Domu' },
+        localnumber: { type: Text, label: 'localnumber' },
+        city: { type: Text, label: 'Miasto' },
+        zipcode: { type: Text, label: 'Kod Pocztowy' },
+        country: { type: Text, label: 'Kraj' },
+        nip: { type: Text, label: 'NIP' },
+        email: { type: Text, label: 'Adres e-mail' },
+        phone_mb: { type: Text, label: 'Numer telefonu' },
+        comment: { type: Text, label: 'Komentarz' },
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: true, isRequired: true, label: 'suppliers' },
+    }, label: 'Supaddre'//, plural: 'Supaddress'
+};

+ 34 - 0
schema/suppliers.js

@@ -0,0 +1,34 @@
+const { Text, Checkbox, Integer, Decimal, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        suppliers_id: { type: AutoIncrement, isRequired: true, label: 'suppliers' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+        shortname: { type: Text, label: 'Nazwa Skrocona' },
+        shortid: { type: Text, label: 'shortid' },
+        street: { type: Text, label: 'Ulica' },
+        city: { type: Text, label: 'Miasto' },
+        zipcode: { type: Text, label: 'Kod pocztowy' },
+        country: { type: Text, label: 'Kraj' },
+        phone: { type: Text, label: 'Numer telefonu' },
+        phone_mb: { type: Text, label: 'phone_mb' },
+        fax: { type: Text, label: 'FAX' },
+        email: { type: Text, label: 'Adres e-mail' },
+        prefixnip: { type: Text, label: 'prefixnip' },
+        nip: { type: Text, label: 'NIP' },
+        supcomment: { type: Text, label: 'supcomment' },
+        supplier: { type: Checkbox, isRequired: true, label: 'Dostawca?' },
+        payervat: { type: Checkbox, isRequired: true, label: 'Platnik VAT?' },
+        pesel: { type: Text, label: 'PESEL' },
+        www: { type: Text, label: 'Adres WWW' },
+        docidentity_type: { type: Integer, label: 'docidentity_type' },
+        docidentity_number: { type: Text, label: 'docidentity_number' },
+        discount: { type: Decimal, knexOptions: { precision: 5, scale: 1 }, label: 'Rabat' },
+        wsuser: { type: Text, label: 'wsuser' },
+        wspass: { type: Text, label: 'wspass' },
+        paytype: { type: Text, label: 'paytype' },
+        paydays: { type: Integer, label: 'paydays' },
+        // document_groups_id: { type: Relationship, ref: 'document_groups.document_groups_id', many: true, label: 'document_groups' }, todo: spr. czy to wazne bylo i jaki foregin key i w ogole
+    }, label: 'Supplier'//, plural: 'Suppliers'
+};

+ 11 - 0
schema/sysparams.js

@@ -0,0 +1,11 @@
+const { Text, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        sysparams_id: { type: AutoIncrement, isRequired: true, label: 'sysparams' },
+        name: { type: Text, label: 'Nazwa' },
+        value: { type: Text, label: 'Wartosc' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, label: 'Magazyn' },
+    }, label: 'Sysparam'//, plural: 'Sysparamss'
+};

+ 10 - 0
schema/sysprivileges.js

@@ -0,0 +1,10 @@
+const { Integer, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        sysprivileges_id: { type: AutoIncrement, isRequired: true, label: 'Uprawnienia Uzytkownika' },
+        puni: { type: Integer, isRequired: true, label: 'puni' },
+        operators_id: { type: Relationship, ref: 'operators', many: true, isRequired: true, label: 'Uzytkownik' },
+    }, label: 'Sysprivilege'//, plural: 'Sysprivilegess'
+};

+ 25 - 0
schema/tagtemplateobjects.js

@@ -0,0 +1,25 @@
+const { Text, Integer, Decimal, Float, Checkbox, Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        tagtemplateobjects_id: { type: AutoIncrement, isRequired: true, label: 'tagtemplateobjects' },
+        tagtemplates_id: { type: Relationship, ref: 'tagtemplates', many: true, label: 'tagtemplates' },
+        source_field: { type: Text, label: 'source_field' },
+        type: { type: Integer, label: 'type' },
+        pos_top: { type: Decimal, knexOptions: { precision: 10, scale: 3 }, label: 'pos_top' },
+        pos_left: { type: Decimal, knexOptions: { precision: 10, scale: 3 }, label: 'pos_left' },
+        width: { type: Decimal, knexOptions: { precision: 10, scale: 3 }, label: 'Szerokosc' },
+        height: { type: Decimal, knexOptions: { precision: 10, scale: 3 }, label: 'Wysokosc' },
+        text_align: { type: Text, label: 'Wyrownanie tekstu' },
+        font: { type: Text, label: 'Czcionka' },
+        font_size: { type: Float, label: 'Rozmiar Czcionki' },
+        font_color: { type: Text, label: 'Kolor Czcionki' },
+        font_bold: { type: Checkbox, label: 'Pogrubienie' },
+        font_italic: { type: Checkbox, label: 'Kursywa' },
+        font_underline: { type: Checkbox, label: 'Podkreslenie' },
+        font_strikeout: { type: Checkbox, label: 'Przekreslenie' },
+        rotation: { type: Integer, label: 'Obrot' },
+    }, label: 'Tagtemplateobject'//, plural: 'Tagtemplateobjectss'
+};
+

+ 21 - 0
schema/tagtemplates.js

@@ -0,0 +1,21 @@
+const { Text, Integer, Checkbox } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        tagtemplates_id: { type: AutoIncrement, many: true, isRequired: true, label: 'tagtemplates' },
+        name: { type: Text, label: 'Nazwa' },
+        width: { type: Integer, label: 'Szerokosc' },
+        height: { type: Integer, label: 'Wysokosc' },
+        size_type: { type: Text, label: 'size_type' },
+        type: { type: Integer, label: 'Typ' },
+        border: { type: Integer, label: 'Kraweds' },
+        digits_under_barcode: { type: Checkbox, label: 'digits_under_barcode' },
+        margin_top: { type: Integer, label: 'Margines Gorny' },
+        margin_bottom: { type: Integer, label: 'Margines Dolny' },
+        margin_left: { type: Integer, label: 'Margines Lewy' },
+        margin_right: { type: Integer, label: 'Margines Prawy' },
+        space_vertical: { type: Integer, label: 'Odstep w pionie' },
+        space_horizontal: { type: Integer, label: 'Odstep w poziomie' },
+    }, label: 'Tagtemplate'//, plural: 'Tagtemplatess'
+};

+ 13 - 0
schema/transferdocreceived.js

@@ -0,0 +1,13 @@
+const { Relationship } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        transferdocreceived_id: { type: AutoIncrement, isRequired: true, label: 'transferdocreceived' },
+        // todo: co to jest
+        /*tminus_id: { type: Relationship, ref: 'tminus.tminus_id', many: true, isRequired: true, label: 'tminus' },
+        tplus_id: { type: Relationship, ref: 'tplus.tplus_id', many: true, isRequired: true, label: 'tplus' },*/
+        tminus_id: { type: AutoIncrement, isRequired: true, many: true, isRequired: true, label: 'tminus' },
+        tplus_id: { type: AutoIncrement, isRequired: true, many: true, isRequired: true, label: 'tplus' },
+    }, label: 'Transferdocreceived'//, plural: 'Transferdocreceiveds'
+};

+ 10 - 0
schema/uninumbers.js

@@ -0,0 +1,10 @@
+const { Text, Integer, Uuid, Relationship } = require('@keystonejs/fields');
+
+module.exports = {
+    fields: {
+        uninumbers_id: { type: Uuid, isRequired: true, label: 'uninumbers' },
+        module: { type: Text, isRequired: true, label: 'module' },
+        number: { type: Integer, isRequired: true, label: 'number' },
+        shops_id: { type: Relationship, ref: 'shops', many: true, isRequired: true, label: 'Magazyn' },
+    }, label: 'Uninumber'//, plural: 'Uninumberss'
+};

+ 11 - 0
schema/uom.js

@@ -0,0 +1,11 @@
+const { Text, Checkbox } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        uom_id: { type: AutoIncrement, isRequired: true, label: 'uom' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+        shortname: { type: Text, label: 'Nazwa skrocona' },
+        ismass: { type: Checkbox, label: 'ismass' },
+    }, label: 'Uom'//, plural: 'Uoms'
+};

+ 10 - 0
schema/upgradelog.js

@@ -0,0 +1,10 @@
+const { Text, DateTime } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        upgradelog_id: { type: AutoIncrement, isRequired: true, label: 'upgradelog' },
+        ver: { type: Text, isRequired: true, label: 'wersja' },
+        upgrade_date: { type: DateTime, format: 'DD.MM.YYYY h:mm', isRequired: true, label: 'Data aktualizacji' },
+    }, label: 'Upgradelog'//, plural: 'Upgradelogs'
+};

+ 12 - 0
schema/vat.js

@@ -0,0 +1,12 @@
+const { Integer, Text } = require('@keystonejs/fields');
+const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
+
+module.exports = {
+    fields: {
+        vat_id: { type: AutoIncrement, label: 'ID VAT' },
+        value: { type: Integer, isRequired: true, label: 'Wartosc' },
+        name: { type: Text, isRequired: true, label: 'Nazwa' },
+        value_display: { type: Text, label: 'Wartosc wyswietlana' },
+        ptu: { type: Text, isRequired: true, label: 'Stawka PTU' },
+    }, label: 'Stawki VAT'//, plural: 'Stawka VAT'
+};

部分文件因为文件数量过多而无法显示