From fdd96581dc9f2eed6df483c9ea2a4a6776b9d243 Mon Sep 17 00:00:00 2001 From: yusmar Date: Thu, 8 Jul 2021 10:53:59 +0700 Subject: [PATCH] change schema product & dealers --- api/dealers/models/dealers.settings.json | 6 +- api/product-image-color/config/routes.json | 52 ++++++++++++++ .../controllers/product-image-color.js | 8 +++ .../models/product-image-color.js | 8 +++ .../models/product-image-color.settings.json | 33 +++++++++ .../services/product-image-color.js | 8 +++ api/product-otr/models/product-otr.settings.json | 4 +- api/product/models/product.settings.json | 15 ++-- package.json | 2 +- yarn.lock | 80 +++++++++++----------- 10 files changed, 161 insertions(+), 55 deletions(-) create mode 100644 api/product-image-color/config/routes.json create mode 100644 api/product-image-color/controllers/product-image-color.js create mode 100644 api/product-image-color/models/product-image-color.js create mode 100644 api/product-image-color/models/product-image-color.settings.json create mode 100644 api/product-image-color/services/product-image-color.js diff --git a/api/dealers/models/dealers.settings.json b/api/dealers/models/dealers.settings.json index 6b382d0..a658367 100644 --- a/api/dealers/models/dealers.settings.json +++ b/api/dealers/models/dealers.settings.json @@ -20,9 +20,6 @@ "address": { "type": "text" }, - "telp": { - "type": "biginteger" - }, "email": { "type": "email" }, @@ -53,6 +50,9 @@ "Dealer_3S", "Dealer_YPM" ] + }, + "telp": { + "type": "string" } } } diff --git a/api/product-image-color/config/routes.json b/api/product-image-color/config/routes.json new file mode 100644 index 0000000..10fe9de --- /dev/null +++ b/api/product-image-color/config/routes.json @@ -0,0 +1,52 @@ +{ + "routes": [ + { + "method": "GET", + "path": "/product-image-colors", + "handler": "product-image-color.find", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/product-image-colors/count", + "handler": "product-image-color.count", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/product-image-colors/:id", + "handler": "product-image-color.findOne", + "config": { + "policies": [] + } + }, + { + "method": "POST", + "path": "/product-image-colors", + "handler": "product-image-color.create", + "config": { + "policies": [] + } + }, + { + "method": "PUT", + "path": "/product-image-colors/:id", + "handler": "product-image-color.update", + "config": { + "policies": [] + } + }, + { + "method": "DELETE", + "path": "/product-image-colors/:id", + "handler": "product-image-color.delete", + "config": { + "policies": [] + } + } + ] +} diff --git a/api/product-image-color/controllers/product-image-color.js b/api/product-image-color/controllers/product-image-color.js new file mode 100644 index 0000000..556f4fc --- /dev/null +++ b/api/product-image-color/controllers/product-image-color.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/concepts/controllers.html#core-controllers) + * to customize this controller + */ + +module.exports = {}; diff --git a/api/product-image-color/models/product-image-color.js b/api/product-image-color/models/product-image-color.js new file mode 100644 index 0000000..dd847ef --- /dev/null +++ b/api/product-image-color/models/product-image-color.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/concepts/models.html#lifecycle-hooks) + * to customize this model + */ + +module.exports = {}; diff --git a/api/product-image-color/models/product-image-color.settings.json b/api/product-image-color/models/product-image-color.settings.json new file mode 100644 index 0000000..05b5e70 --- /dev/null +++ b/api/product-image-color/models/product-image-color.settings.json @@ -0,0 +1,33 @@ +{ + "kind": "collectionType", + "collectionName": "product_image_colors", + "info": { + "name": "Product_Image_Color", + "description": "" + }, + "options": { + "increments": true, + "timestamps": true, + "draftAndPublish": true + }, + "attributes": { + "name": { + "type": "string" + }, + "img": { + "model": "file", + "via": "related", + "allowedTypes": [ + "images", + "files", + "videos" + ], + "plugin": "upload", + "required": false + }, + "product": { + "model": "product", + "via": "product_image_colors" + } + } +} diff --git a/api/product-image-color/services/product-image-color.js b/api/product-image-color/services/product-image-color.js new file mode 100644 index 0000000..6bc4168 --- /dev/null +++ b/api/product-image-color/services/product-image-color.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/developer-docs/latest/concepts/services.html#core-services) + * to customize this service + */ + +module.exports = {}; diff --git a/api/product-otr/models/product-otr.settings.json b/api/product-otr/models/product-otr.settings.json index 8bb37cd..ec6ba77 100644 --- a/api/product-otr/models/product-otr.settings.json +++ b/api/product-otr/models/product-otr.settings.json @@ -12,8 +12,8 @@ }, "attributes": { "product": { - "model": "product", - "via": "product_otrs" + "via": "product_otrs", + "model": "product" }, "name": { "type": "string" diff --git a/api/product/models/product.settings.json b/api/product/models/product.settings.json index 35f7cbc..d684116 100644 --- a/api/product/models/product.settings.json +++ b/api/product/models/product.settings.json @@ -215,15 +215,6 @@ "spesifikasi_kelistrikan": { "type": "richtext" }, - "otr_price_sumsel": { - "type": "biginteger" - }, - "otr_price_palembang": { - "type": "biginteger" - }, - "otr_price_bengkulu": { - "type": "biginteger" - }, "price1": { "type": "biginteger" }, @@ -231,8 +222,12 @@ "type": "biginteger" }, "product_otrs": { + "collection": "product-otr", + "via": "product" + }, + "product_image_colors": { "via": "product", - "collection": "product-otr" + "collection": "product-image-color" } } } diff --git a/package.json b/package.json index 21183a9..861e9f2 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "devDependencies": {}, "dependencies": { - "knex": "<0.20.0", + "knex": "^0.21.1", "mysql": "^2.18.1", "sqlite3": "5.0.0", "strapi": "3.4.6", diff --git a/yarn.lock b/yarn.lock index d2470ee..ba406be 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2490,7 +2490,7 @@ bluebird@3.5.1: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.1.tgz#d9551f9de98f1fcda1e683d17ee91a0602ee2eb9" integrity sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA== -bluebird@^3.5.0, bluebird@^3.5.5, bluebird@^3.7.0, bluebird@^3.7.2: +bluebird@^3.5.0, bluebird@^3.5.5, bluebird@^3.7.2: version "3.7.2" resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== @@ -3172,12 +3172,7 @@ color@^3.1.3: color-convert "^1.9.1" color-string "^1.5.4" -colorette@1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.1.0.tgz#1f943e5a357fac10b4e0f5aaef3b14cdc1af6ec7" - integrity sha512-6S062WDQUXi6hOfkO/sBPVwE5ASXY4G2+b4atvhJfSsuUUhIaUKlkjLe9692Ipyt5/a+IPF5aVTu3V5gvXq5cg== - -colorette@^1.2.1: +colorette@1.2.1, colorette@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.2.1.tgz#4d0b921325c14faf92633086a536db6e89564b1b" integrity sha512-puCDz0CzydiSYOrnXpz/PKd69zRrribezjtE9yd4zvytoRc8+RY/KJPvtPFKZS3E3wP6neGyMe0vOTlHO5L3Pw== @@ -3209,10 +3204,10 @@ commander@^2.20.0, commander@^2.20.3: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" - integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== +commander@^6.2.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c" + integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA== commander@~2.19.0: version "2.19.0" @@ -3608,7 +3603,7 @@ date-fns@^2.8.1: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.17.0.tgz#afa55daea539239db0a64e236ce716ef3d681ba1" integrity sha512-ZEhqxUtEZeGgg9eHNSOAJ8O9xqSgiJdrL0lzSSfMF54x6KXWJiOH/xntSJ9YomJPrYH/p08t6gWjGWq1SDJlSA== -debug@*, debug@4, debug@^4.1.0, debug@^4.1.1: +debug@*, debug@4, debug@4.3.1, debug@^4.1.0, debug@^4.1.1: version "4.3.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== @@ -4246,6 +4241,11 @@ eslint-scope@^4.0.3: esrecurse "^4.1.0" estraverse "^4.1.1" +esm@^3.2.25: + version "3.2.25" + resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" + integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== + esprima@~3.1.0: version "3.1.3" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" @@ -5582,7 +5582,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3, inherits@~2.0.4: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.0, inherits@~2.0.1, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -5629,11 +5629,16 @@ internal-ip@^4.3.0: default-gateway "^4.2.0" ipaddr.js "^1.9.0" -interpret@^1.2.0, interpret@^1.4.0: +interpret@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e" integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA== +interpret@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/interpret/-/interpret-2.2.0.tgz#1a78a0b5965c40a5416d007ad6f50ad27c417df9" + integrity sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw== + intl-format-cache@^4.2.24, intl-format-cache@^4.2.43: version "4.3.1" resolved "https://registry.yarnpkg.com/intl-format-cache/-/intl-format-cache-4.3.1.tgz#484d31a9872161e6c02139349b259a6229ade377" @@ -6239,26 +6244,23 @@ klona@^2.0.3: resolved "https://registry.yarnpkg.com/klona/-/klona-2.0.4.tgz#7bb1e3affb0cb8624547ef7e8f6708ea2e39dfc0" integrity sha512-ZRbnvdg/NxqzC7L9Uyqzf4psi1OM4Cuc+sJAkQPjO6XkQIJTNbfK2Rsmbw8fx1p2mkZdp2FZYo2+LwXYY/uwIA== -knex@<0.20.0: - version "0.19.5" - resolved "https://registry.yarnpkg.com/knex/-/knex-0.19.5.tgz#3597ebecf88a5942f18c3e6d91af53bda59eeb5d" - integrity sha512-Hy258avCVircQq+oj3WBqPzl8jDIte438Qlq+8pt1i/TyLYVA4zPh2uKc7Bx0t+qOpa6D42HJ2jjtl2vagzilw== +knex@^0.21.1: + version "0.21.19" + resolved "https://registry.yarnpkg.com/knex/-/knex-0.21.19.tgz#df504a184eb29e286245839db0867e3ca161af00" + integrity sha512-6etvrq9XI1Ck6mEc/XiXFGVpD1Lmj6v9XWojqZgEbOvyMbW7XRvgZ99yIhN/kaBH+43FEy3xv/AcbRaH+1pJtw== dependencies: - bluebird "^3.7.0" - colorette "1.1.0" - commander "^3.0.2" - debug "4.1.1" + colorette "1.2.1" + commander "^6.2.0" + debug "4.3.1" + esm "^3.2.25" getopts "2.2.5" - inherits "~2.0.4" - interpret "^1.2.0" + interpret "^2.2.0" liftoff "3.1.0" - lodash "^4.17.15" - mkdirp "^0.5.1" - pg-connection-string "2.1.0" - tarn "^2.0.0" + lodash "^4.17.20" + pg-connection-string "2.4.0" + tarn "^3.0.1" tildify "2.0.0" - uuid "^3.3.3" - v8flags "^3.1.3" + v8flags "^3.2.0" koa-body@^4.2.0: version "4.2.0" @@ -7950,10 +7952,10 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -pg-connection-string@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.1.0.tgz#e07258f280476540b24818ebb5dca29e101ca502" - integrity sha512-bhlV7Eq09JrRIvo1eKngpwuqKtJnNhZdpdOlvrPrA4dxqXPjxSrbNrfnIDmTpwMyRszrcV4kU5ZA4mMsQUrjdg== +pg-connection-string@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.4.0.tgz#c979922eb47832999a204da5dbe1ebf2341b6a10" + integrity sha512-3iBXuv7XKvxeMrIgym7njT+HlZkwZqqGX4Bu9cci8xHZNT+Um1gWKqCsAzcC0d95rcKMU5WBg6YRUcHyV0HZKQ== picomatch@^2.0.4, picomatch@^2.0.7, picomatch@^2.2.1: version "2.2.2" @@ -10590,10 +10592,10 @@ tar@^4: safe-buffer "^5.1.2" yallist "^3.0.3" -tarn@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/tarn/-/tarn-2.0.0.tgz#c68499f69881f99ae955b4317ca7d212d942fdee" - integrity sha512-7rNMCZd3s9bhQh47ksAQd92ADFcJUjjbyOvyFjNLwTPpGieFHMC84S+LOzw0fx1uh6hnDz/19r8CPMnIjJlMMA== +tarn@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/tarn/-/tarn-3.0.1.tgz#ebac2c6dbc6977d34d4526e0a7814200386a8aec" + integrity sha512-6usSlV9KyHsspvwu2duKH+FMUhqJnAh6J5J/4MITl8s94iSUQTLkJggdiewKv4RyARQccnigV48Z+khiuVZDJw== term-size@^2.1.0: version "2.2.1" @@ -11081,7 +11083,7 @@ v8-compile-cache@^2.1.1: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.2.0.tgz#9471efa3ef9128d2f7c6a7ca39c4dd6b5055b132" integrity sha512-gTpR5XQNKFwOd4clxfnhaqvfqMpqEwr4tOtCyz4MtYZX2JYhfr1JvBFKdS+7K/9rfpZR3VLX+YWBbKoxCgS43Q== -v8flags@^3.1.3: +v8flags@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.2.0.tgz#b243e3b4dfd731fa774e7492128109a0fe66d656" integrity sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==