浏览代码

fixed schema

Arkadiusz Lisiecki 5 年之前
父节点
当前提交
03a21acc19
共有 54 个文件被更改,包括 160 次插入153 次删除
  1. 12 0
      README.md
  2. 3 5
      index.js
  3. 2 2
      schema/cashregisterdocs.js
  4. 1 1
      schema/cashregisters.js
  5. 2 5
      schema/companies.js
  6. 3 3
      schema/currency.js
  7. 5 5
      schema/deliveryitems.js
  8. 4 4
      schema/deliverymaterialprices.js
  9. 3 3
      schema/docflow.js
  10. 1 1
      schema/docnumbers.js
  11. 5 5
      schema/docpayment.js
  12. 4 4
      schema/documents.js
  13. 2 2
      schema/eshop_removed.js
  14. 2 2
      schema/feature_groups.js
  15. 3 3
      schema/feature_groups_features.js
  16. 1 1
      schema/features.js
  17. 2 2
      schema/featuresval.js
  18. 5 5
      schema/fifopart.js
  19. 4 4
      schema/fifopos.js
  20. 7 7
      schema/items.js
  21. 2 2
      schema/kinds.js
  22. 3 3
      schema/locations.js
  23. 3 3
      schema/logs.js
  24. 2 2
      schema/materials.js
  25. 1 1
      schema/monitor_logs.js
  26. 1 1
      schema/operatorgroupprivileges.js
  27. 2 2
      schema/operatorgroups.js
  28. 2 2
      schema/operators.js
  29. 4 4
      schema/operators_cashregisters.js
  30. 5 5
      schema/operators_settings.js
  31. 4 4
      schema/operators_shops.js
  32. 1 1
      schema/pictures.js
  33. 5 5
      schema/positions.js
  34. 2 2
      schema/printtemplates.js
  35. 2 2
      schema/product_minmax_features.js
  36. 3 3
      schema/productfeatures.js
  37. 4 4
      schema/products.js
  38. 4 4
      schema/products_minmax.js
  39. 3 3
      schema/productsgroup.js
  40. 2 2
      schema/settlements.js
  41. 2 2
      schema/shops.js
  42. 3 3
      schema/stocktaking.js
  43. 4 4
      schema/stocktaking_items.js
  44. 2 2
      schema/supaddress.js
  45. 2 2
      schema/suppliers.js
  46. 3 3
      schema/sysparams.js
  47. 2 2
      schema/sysprivileges.js
  48. 2 2
      schema/tagtemplateobjects.js
  49. 1 1
      schema/tagtemplates.js
  50. 6 6
      schema/transferdocreceived.js
  51. 2 2
      schema/uninumbers.js
  52. 2 2
      schema/uom.js
  53. 2 2
      schema/upgradelog.js
  54. 1 1
      schema/vat.js

+ 12 - 0
README.md

@@ -13,8 +13,20 @@ Once running, the Keystone Admin UI is reachable via `localhost:3000/admin`.
 This example has no front-end application but you can build your own using the GraphQL API (`http://localhost:3000/admin/graphiql`).
 
 
+https://v4.keystonejs.com/documentation/database/relationships/
+
 npx keystone  create-tables
 
 
 CREATE EXTENSION pgcrypto;
 
+cat kdev_postgres.sql.gz | gzip -d | docker-compose exec -T postgres psql -U kdev_postgres
+
+docker-compose exec -u postgres postgres psql -U kdev_postgres
+docker-compose down && docker-compose up -d
+
+
+TODO:
+https://www.keystonejs.com/keystonejs/fields/src/types/date-time/#knex-adapter
+
+Paragons, Positions

+ 3 - 5
index.js

@@ -55,7 +55,7 @@ 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 SuppliersSchema = require('./schema/suppliers.js');
 const SysparamsSchema = require('./schema/sysparams.js');
 const SysprivilegesSchema = require('./schema/sysprivileges.js');
 const TagtemplateobjectsSchema = require('./schema/tagtemplateobjects.js');
@@ -168,11 +168,10 @@ const authStrategy = keystone.createAuthStrategy({
 });
 
 
-//keystone.createList('cashregisters', CashregistersSchema);
-//keystone.createList('cashregisterdocs', CashregisterdocsSchema);
+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);
@@ -221,7 +220,6 @@ keystone.createList('uninumbers', UninumbersSchema);
 keystone.createList('uom', UomSchema);
 keystone.createList('upgradelog', UpgradelogSchema);
 keystone.createList('vat', VatSchema);
-*/
 
 //console.log(keystone._providers);
 /*

+ 2 - 2
schema/cashregisterdocs.js

@@ -3,13 +3,13 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        cashregisterdocs_id: { type: AutoIncrement, isRequired: true, label: 'cashregisterdocs_id' },
+        id: { type: Integer, 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_id: { type: Relationship, ref: 'suppliers', many: false, label: 'Dostawcy' },
         suppliers_name: { type: Text, label: 'Nazwa dostawcy' },
         currency_id: { type: Relationship, ref: 'currency', many: false, label: 'Waluta' },
     }, label: 'Paragon'//, plural: 'Paragony'

+ 1 - 1
schema/cashregisters.js

@@ -2,7 +2,7 @@ const { Integer, Text } = require('@keystonejs/fields');
 
 module.exports = {
     fields: {
-        cashregisters_id: { type: Integer, isRequired: true, label: 'cashregisters_id' },
+        id: { type: Integer, isRequired: true, label: 'cashregisters_id' },
         name: { type: Text, label: 'Nazwa' },
     }, label: 'cashregister'//, plural: 'Paragony (cr)'
 };

+ 2 - 5
schema/companies.js

@@ -1,12 +1,9 @@
-const { Text, Integer, Uuid } = require('@keystonejs/fields');
+const { Text, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
-const { uuidv4 } = require('uuid/v4');
 
 module.exports = {
     fields: {
-//        companies_id: { type: Integer, isRequired: true, label: 'ID Firmy' },
-//	id: { type: Uuid, defaultValu: uuidv4 },
-	    id: { type: Uuid, knexOptions: { defaultTo: knex => knex.raw('gen_random_uuid()') } },
+        id: { type: Integer, 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' },

+ 3 - 3
schema/currency.js

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

+ 5 - 5
schema/deliveryitems.js

@@ -3,19 +3,19 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        deliveryitems_id: { type: Uuid, isRequired: true, label: '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' },
+        documents_id: { type: Relationship, ref: 'documents', many: false, isRequired: true, label: 'documents' },
+        kinds_id: { type: Relationship, ref: 'kinds', many: false, label: 'kinds' },
         uom_id: { type: Relationship, ref: 'uom', many: false, label: 'uom' },
-        materials_id: { type: Relationship, ref: 'materials', many: true, label: 'Surowiec' },
+        materials_id: { type: Relationship, ref: 'materials', many: false, 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' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
         fifo: { type: Checkbox, isRequired: true, label: 'fifo' },
         itype: { type: Integer, isRequired: true, label: 'itype' },
     }, label: 'Deliveryitem'//, plural: 'Deliveryitemss'

+ 4 - 4
schema/deliverymaterialprices.js

@@ -1,12 +1,12 @@
-const { Text, Decimal, Uuid, Relationship } = require('@keystonejs/fields');
+const { Text, Decimal, Uuid, Relationship, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        deliverymaterialprices_id: { type: Uuid, isRequired: true, label: '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' },
+        documents_id: { type: Relationship, ref: 'documents', many: false, isRequired: true, label: 'documents' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
     }, label: 'Deliverymaterialprice'//, plural: 'Deliverymaterialpricess'
 };

+ 3 - 3
schema/docflow.js

@@ -1,10 +1,10 @@
-const { Uuid, Relationship } = require('@keystonejs/fields');
+const { Uuid, Relationship, Integer } = require('@keystonejs/fields');
 
 module.exports = {
     fields: {
-        docflow_id: { type: Uuid, isRequired: true, label: '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' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, label: 'Magazyn' },
     }//, label: 'Docflow'//, plural: 'Docflows'
 };

+ 1 - 1
schema/docnumbers.js

@@ -2,7 +2,7 @@ const { Text, Integer, Uuid, Relationship } = require('@keystonejs/fields');
 
 module.exports = {
     fields: {
-        docnumbers_id: { type: Uuid, isRequired: true, label: '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' },

+ 5 - 5
schema/docpayment.js

@@ -1,17 +1,17 @@
-const { Text, Decimal, Integer, DateTime, Checkbox, Relationship } = require('@keystonejs/fields');
+const { Text, Decimal, Integer, DateTime, Checkbox, Relationship, Uuid } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        docpayment_id: { type: AutoIncrement, isRequired: true, label: 'Dokument sprzedazy' },
+        id: { type: Uuid, 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' },
+        documents_id: { type: Relationship, ref: 'documents', many: false, label: 'documents' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, 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_id: { type: Relationship, ref: 'suppliers', many: false, 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' },

+ 4 - 4
schema/documents.js

@@ -2,7 +2,7 @@ const { Integer, Checkbox, Text, Decimal, DateTime, Uuid, Relationship } = requi
 
 module.exports = {
     fields: {
-        documents_id: { type: Uuid, isRequired: true, label: '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' },
@@ -27,10 +27,10 @@ module.exports = {
         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' },
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: false, label: 'Dostawca' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
         currency_id: { type: Relationship, ref: 'currency', many: false, label: 'Waluta' },
-        operators_id: { type: Relationship, ref: 'operators', many: true, label: 'Uzytkownik' },
+        operators_id: { type: Relationship, ref: 'operators', many: false, label: 'Uzytkownik' },
         comment: { type: Text, label: 'Komentarz' },
         return_symbol: { type: Text, label: 'return_symbol' },
         return_date_issue: { type: DateTime, label: 'return_date_issue' },

+ 2 - 2
schema/eshop_removed.js

@@ -1,9 +1,9 @@
-const { DateTime, Relationship } = require('@keystonejs/fields');
+const { DateTime, Relationship, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        eshop_removed_id: { type: AutoIncrement, isRequired: true, label: 'eshop_removed' },
+        id: { type: Integer, 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' },

+ 2 - 2
schema/feature_groups.js

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

+ 3 - 3
schema/feature_groups_features.js

@@ -1,10 +1,10 @@
-const { Relationship } = require('@keystonejs/fields');
+const { Relationship, Integer } = 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' },
+        id: { type: Integer, isRequired: true, label: 'feature_groups_features' },
+        feature_groups_id: { type: Relationship, ref: 'feature_groups', many: false, label: 'feature_groups' },
         feature_id: { type: Relationship, ref: 'features', many: false, label: 'feature' },
     }, label: 'Feature_groups_feature'//, plural: 'Feature_groups_featuress'
 };

+ 1 - 1
schema/features.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        features_id: { type: AutoIncrement, isRequired: true, label: 'ID Atrybutu' },
+        id: { type: Integer, 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' },

+ 2 - 2
schema/featuresval.js

@@ -1,9 +1,9 @@
-const { Text, Checkbox, Relationship } = require('@keystonejs/fields');
+const { Text, Checkbox, Relationship, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        featuresval_id: { type: AutoIncrement, isRequired: true, label: 'ID Wartosci Atrybutu' },
+        id: { type: Integer, 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' },

+ 5 - 5
schema/fifopart.js

@@ -1,16 +1,16 @@
-const { Text, DateTime, Decimal, Relationship } = require('@keystonejs/fields');
+const { Text, DateTime, Decimal, Relationship, Integer } = 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' },
+        id: { type: Integer, isRequired: true, label: 'fifopart' },
+        pos_id: { type: Relationship, ref: 'positions', many: false, 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' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
+        items_id: { type: Relationship, ref: 'items', many: false, 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' },

+ 4 - 4
schema/fifopos.js

@@ -1,14 +1,14 @@
-const { DateTime, Text, Decimal, Uuid, Relationship } = require('@keystonejs/fields');
+const { DateTime, Text, Decimal, Uuid, Relationship, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        fifopos_id: { type: AutoIncrement, isRequired: true, label: 'fifopos' },
+        id: { type: Integer, 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' },
+        pos_id: {type: Relationship, ref: 'positions', many: false, 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' },
+        items_id: { type: Relationship, ref: 'items', many: false, 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' },

+ 7 - 7
schema/items.js

@@ -2,9 +2,9 @@ const { Integer, Checkbox, Text, Decimal, DateTime, Uuid, Relationship } = requi
 
 module.exports = {
     fields: {
-        items_id: { type: Uuid, isRequired: true, label: 'Egzemplarz' },
+        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' },
+        productsguid_id: { type: Relationship, ref: 'products', many: false, label: 'productsguid', filters: { products: ':productsguid_id' } },
         itype: { type: Integer, isRequired: true, label: 'itype' },
         sold: { type: Checkbox, isRequired: true, label: 'sold' },
         deficiency: { type: Checkbox, isRequired: true, label: 'deficiency' },
@@ -39,13 +39,13 @@ module.exports = {
         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' },
+        kinds_id: { type: Relationship, ref: 'kinds', many: false, label: 'kinds' },
         uom_id: { type: Relationship, ref: 'uom', many: false, label: 'uom' },
-        materials_id: { type: Relationship, ref: 'materials', many: true, label: 'materials' },
+        materials_id: { type: Relationship, ref: 'materials', many: false, 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' },
+        locations_id: { type: Relationship, ref: 'locations', many: false, label: 'locations' },
+        deliveryitems_id: { type: Relationship, ref: 'deliveryitems', many: false, label: 'deliveryitems' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, 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' },

+ 2 - 2
schema/kinds.js

@@ -1,9 +1,9 @@
-const { Text, Checkbox, Relationship } = require('@keystonejs/fields');
+const { Text, Checkbox, Relationship, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        kinds_id: { type: AutoIncrement, label: 'ID Kategorii' },
+        id: { type: Integer, 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' },

+ 3 - 3
schema/locations.js

@@ -1,12 +1,12 @@
-const { Text, Checkbox, Relationship } = require('@keystonejs/fields');
+const { Text, Checkbox, Relationship, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        locations_id: { type: AutoIncrement, isRequired: true, label: 'Lokalizacja' },
+        id: { type: Integer, 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' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
         defloc: { type: Checkbox, label: 'defloc' },
     }, label: 'Location'//, plural: 'Locationss'
 };

+ 3 - 3
schema/logs.js

@@ -3,13 +3,13 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        logs_id: { type: Uuid, label: 'Log' },
+        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' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, label: 'Magazyn' },
+        operators_id: { type: Relationship, ref: 'operators', many: false, label: 'Operator' },
         version: { type: Text, label: 'Wersja' },
     }, label: 'Log'//, plural: 'Logi'
 };

+ 2 - 2
schema/materials.js

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

+ 1 - 1
schema/monitor_logs.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        monitor_logs_id: { type: AutoIncrement, isRequired: true, label: 'monitor_logs' },
+        id: { type: Integer, 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' },

+ 1 - 1
schema/operatorgroupprivileges.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        operatorgroupprivileges_id: { type: AutoIncrement, isRequired: true, label: 'IDUprawnienia' },
+        id: { type: Integer, 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'

+ 2 - 2
schema/operatorgroups.js

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

+ 2 - 2
schema/operators.js

@@ -1,9 +1,9 @@
-const { Checkbox, Text, Relationship } = require('@keystonejs/fields');
+const { Checkbox, Text, Relationship, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        operators_id: { type: AutoIncrement, isRequired: true, label: 'Uzytkownik' },
+        id: { type: Integer, 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' },

+ 4 - 4
schema/operators_cashregisters.js

@@ -1,11 +1,11 @@
-const { Checkbox, Relationship } = require('@keystonejs/fields');
+const { Checkbox, Relationship, Integer } = 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' },
+        id: { type: Integer,isRequired: true, label: 'IDoperators_cashregisters' },
+        operators_id: { type: Relationship, ref: 'operators', many: false, isRequired: true, label: 'Uzytkownik' },
+        cashregisters_id: { type: Relationship, ref: 'cashregisters', many: false, isRequired: true, label: 'Kasa' },
         default_cashregister: { type: Checkbox, isRequired: true, label: 'Kasa Domyslna' },
     }, label: 'Operators_cashregister'//, plural: 'Operators_cashregisterss'
 };

+ 5 - 5
schema/operators_settings.js

@@ -1,12 +1,12 @@
-const { Text, Relationship } = require('@keystonejs/fields');
+const { Text, Relationship, Integer } = 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?
+        id: { type: Integer, isRequired: true, label: 'Ustawienia uzytkownika' },
+        operators_id: { type: Relationship, ref: 'operators', many: false, isRequired: true, label: 'Uzytkownik' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, label: 'Magazyn' },
+        //settings_id: { type: Relationship, ref: 'settings.settings_id', many: false, isRequired: true, label: 'Ustawienia' }, // todo: spr. czy potrzebne?
         value: { type: Text, label: 'Wartosc' },
     }, label: 'Ustawienia uzytkownika'//, plural: 'Ustawienia uzytkownika'
 };

+ 4 - 4
schema/operators_shops.js

@@ -1,10 +1,10 @@
-const { Relationship } = require('@keystonejs/fields');
+const { Relationship, Integer } = 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' },
+        id: { type: Integer, isRequired: true, label: 'Magazyny Uzytkownika' },
+        operators_id: { type: Relationship, ref: 'operators', many: false, isRequired: true, label: 'Uzytkownik' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
     }, label: 'Operators_shop'//, plural: 'Operators_shopss'
 };

+ 1 - 1
schema/pictures.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        pictures_id: { type: AutoIncrement, isRequired: true, label: 'ID Zdjecia' },
+        id: { type: Integer, isRequired: true, label: 'ID Zdjecia' },
         filename: { type: Text, label: 'Nazwa pliku' },
         filepath: { type: Text, label: 'Ściezka pliku' },
         srvname: { type: Text, label: 'srvname' },

+ 5 - 5
schema/positions.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        positions_id: { type: Uuid, many: true, isRequired: true, label: 'positions' },
+        id: { type: Uuid, many: false, isRequired: true, label: 'positions' },
         dtype: { type: Text, isRequired: true, label: 'dtype' },
         pitype: { type: Integer, label: 'pitype' },
         pdate: { type: DateTime, label: 'pdate' },
@@ -20,12 +20,12 @@ module.exports = {
         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' },
+        documents_id: { type: Relationship, ref: 'documents', many: false, label: 'documents' },
+        items_id: { type: Relationship, ref: 'items', many: false, isRequired: true, label: 'Egzemplarz' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
         fifo: { type: Checkbox, label: 'fifo' },
         fifogen: { type: Checkbox, label: 'fifogen' },
-        deliveryitems_id: { type: Relationship, ref: 'deliveryitems', many: true, label: 'deliveryitems' },
+        deliveryitems_id: { type: Relationship, ref: 'deliveryitems', many: false, 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' },

+ 2 - 2
schema/printtemplates.js

@@ -1,9 +1,9 @@
-const { Text, Checkbox, Decimal } = require('@keystonejs/fields');
+const { Text, Checkbox, Decimal, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        printtemplates_id: { type: AutoIncrement, isRequired: true, label: 'ID Szablonu wydruku' },
+        id: { type: Integer, 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' },

+ 2 - 2
schema/product_minmax_features.js

@@ -1,9 +1,9 @@
-const { Text, Relationship } = require('@keystonejs/fields');
+const { Text, Relationship, Integer } = 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' },
+        id: { type: Integer, 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' },

+ 3 - 3
schema/productfeatures.js

@@ -1,10 +1,10 @@
-const { Text, Relationship } = require('@keystonejs/fields');
+const { Text, Relationship, Integer } = 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' },
+        id:  { type: Integer, isRequired: true, label: 'productfeatures' },
+        features_id: { type: Relationship, ref: 'features', many: false, 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' },

+ 4 - 4
schema/products.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        products_id: { type: AutoIncrement, isRequired: true, label: 'products' },
+        id: { type: Integer, isRequired: true, label: 'products' },
         productsguid_id: { type: Uuid, many: false, label: 'productsguid' },
         catnum: { type: Text, label: 'catnum' },
         symbol_supplier: { type: Text, label: 'symbol_supplier' },
@@ -27,12 +27,12 @@ module.exports = {
         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' },
+        kinds_id: { type: Relationship, ref: 'kinds', many: false, label: 'Rodzaje' },
         uom_id: { type: Relationship, ref: 'uom', many: false, label: 'uom' },
-        materials_id: { type: Relationship, ref: 'materials', many: true, label: 'Surowiec' },
+        materials_id: { type: Relationship, ref: 'materials', many: false, 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' },
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: false, label: 'Dostawca' },
         custom1: { type: Text, label: 'Dane 1' },
         custom2: { type: Text, label: 'Dane 2' },
         custom3: { type: Text, label: 'Dane 3' },

+ 4 - 4
schema/products_minmax.js

@@ -1,11 +1,11 @@
-const { DateTime, Decimal, Relationship } = require('@keystonejs/fields');
+const { DateTime, Decimal, Relationship, Integer } = 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' },
+        id: { type: Integer, isRequired: true, label: 'products_minmax' },
+        products_id: { type: Relationship, ref: 'products', many: false, isRequired: true, label: 'products' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, 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' },

+ 3 - 3
schema/productsgroup.js

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

+ 2 - 2
schema/settlements.js

@@ -1,8 +1,8 @@
-const { Text, Decimal, Checkbox, DateTime, Uuid, Relationship } = require('@keystonejs/fields');
+const { Text, Decimal, Checkbox, DateTime, Uuid, Relationship, Integer } = require('@keystonejs/fields');
 
 module.exports = {
     fields: {
-        settlements_id: { type: Uuid, isRequired: true, label: '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' },

+ 2 - 2
schema/shops.js

@@ -3,11 +3,11 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        shops_id: { type: AutoIncrement, isRequired: true, label: 'Magazyn' },
+        id: { type: Integer, 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' },
+        companies_id: { type: Relationship, ref: 'companies', many: false, isRequired: true, label: 'Firma' },
     }, label: 'Shop'//, plural: 'Shopss'
 };

+ 3 - 3
schema/stocktaking.js

@@ -2,12 +2,12 @@ const { Checkbox, DateTime, Text, Integer, Uuid, Relationship } = require('@keys
 
 module.exports = {
     fields: {
-        stocktaking_id: { type: Uuid, isRequired: true, label: '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' },
+        operators_id: { type: Relationship, ref: 'operators', many: false, isRequired: true, label: 'Uzytkownik' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
     }, label: 'Stocktaking'//, plural: 'Stocktakings'
 };

+ 4 - 4
schema/stocktaking_items.js

@@ -1,14 +1,14 @@
-const { Decimal, Uuid, Relationship } = require('@keystonejs/fields');
+const { Decimal, Uuid, Relationship, Integer } = require('@keystonejs/fields');
 
 module.exports = {
     fields: {
-        stocktaking_items_id: { type: Uuid, isRequired: true, label: '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' },
+        items_id: { type: Relationship, ref: 'items', many: false, isRequired: true, label: 'Egzemplarz' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
     }, label: 'Stocktaking_item'//, plural: 'Stocktaking_itemss'
 };

+ 2 - 2
schema/supaddress.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        supaddress_id: { type: AutoIncrement, isRequired: true, label: 'supaddress' },
+        id: { type: Integer, isRequired: true, label: 'supaddress' },
         addrtype: { type: Integer, isRequired: true, label: 'addrtype' },
         name: { type: Text, label: 'Imie' },
         surname: { type: Text, label: 'Nazwisko' },
@@ -18,6 +18,6 @@ module.exports = {
         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' },
+        suppliers_id: { type: Relationship, ref: 'suppliers', many: false, isRequired: true, label: 'suppliers' },
     }, label: 'Supaddre'//, plural: 'Supaddress'
 };

+ 2 - 2
schema/suppliers.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        suppliers_id: { type: AutoIncrement, isRequired: true, label: 'suppliers' },
+        id: { type: Integer, isRequired: true, label: 'suppliers' },
         name: { type: Text, isRequired: true, label: 'Nazwa' },
         shortname: { type: Text, label: 'Nazwa Skrocona' },
         shortid: { type: Text, label: 'shortid' },
@@ -29,6 +29,6 @@ module.exports = {
         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
+        // document_groups_id: { type: Relationship, ref: 'document_groups.document_groups_id', many: false, label: 'document_groups' }, todo: spr. czy to wazne bylo i jaki foregin key i w ogole
     }, label: 'Supplier'//, plural: 'Suppliers'
 };

+ 3 - 3
schema/sysparams.js

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

+ 2 - 2
schema/sysprivileges.js

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

+ 2 - 2
schema/tagtemplateobjects.js

@@ -3,8 +3,8 @@ 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' },
+        id: { type: Integer, isRequired: true, label: 'tagtemplateobjects' },
+        tagtemplates_id: { type: Relationship, ref: 'tagtemplates', many: false, 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' },

+ 1 - 1
schema/tagtemplates.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        tagtemplates_id: { type: AutoIncrement, many: true, isRequired: true, label: 'tagtemplates' },
+        id: { type: Integer, many: false, isRequired: true, label: 'tagtemplates' },
         name: { type: Text, label: 'Nazwa' },
         width: { type: Integer, label: 'Szerokosc' },
         height: { type: Integer, label: 'Wysokosc' },

+ 6 - 6
schema/transferdocreceived.js

@@ -1,13 +1,13 @@
-const { Relationship } = require('@keystonejs/fields');
+const { Relationship, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        transferdocreceived_id: { type: AutoIncrement, isRequired: true, label: 'transferdocreceived' },
+        id: { type: Integer, 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' },
+        /*tminus_id: { type: Relationship, ref: 'tminus.tminus_id', many: false, isRequired: true, label: 'tminus' },
+        tplus_id: { type: Relationship, ref: 'tplus.tplus_id', many: false, isRequired: true, label: 'tplus' },*/
+        tminus_id: { type: AutoIncrement, isRequired: true, many: false, isRequired: true, label: 'tminus' },
+        tplus_id: { type: AutoIncrement, isRequired: true, many: false, isRequired: true, label: 'tplus' },
     }, label: 'Transferdocreceived'//, plural: 'Transferdocreceiveds'
 };

+ 2 - 2
schema/uninumbers.js

@@ -2,9 +2,9 @@ const { Text, Integer, Uuid, Relationship } = require('@keystonejs/fields');
 
 module.exports = {
     fields: {
-        uninumbers_id: { type: Uuid, isRequired: true, label: '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' },
+        shops_id: { type: Relationship, ref: 'shops', many: false, isRequired: true, label: 'Magazyn' },
     }, label: 'Uninumber'//, plural: 'Uninumberss'
 };

+ 2 - 2
schema/uom.js

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

+ 2 - 2
schema/upgradelog.js

@@ -1,9 +1,9 @@
-const { Text, DateTime } = require('@keystonejs/fields');
+const { Text, DateTime, Integer } = require('@keystonejs/fields');
 const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        upgradelog_id: { type: AutoIncrement, isRequired: true, label: 'upgradelog' },
+        id: { type: Integer, 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'

+ 1 - 1
schema/vat.js

@@ -3,7 +3,7 @@ const { AutoIncrement } = require('@keystonejs/fields-auto-increment');
 
 module.exports = {
     fields: {
-        vat_id: { type: AutoIncrement, label: 'ID VAT' },
+        id: { type: Integer, label: 'ID VAT' },
         value: { type: Integer, isRequired: true, label: 'Wartosc' },
         name: { type: Text, isRequired: true, label: 'Nazwa' },
         value_display: { type: Text, label: 'Wartosc wyswietlana' },