From c7d952266c0973cfd48f3b251515e1fc87c876f6 Mon Sep 17 00:00:00 2001 From: yusmar Date: Tue, 2 Nov 2021 14:31:49 +0700 Subject: [PATCH] add checkout --- api/cart/config/routes.json | 52 ++++++++++++++++++++++++++++++ api/cart/controllers/cart.js | 8 +++++ api/cart/models/cart.js | 8 +++++ api/cart/models/cart.settings.json | 38 ++++++++++++++++++++++ api/cart/services/cart.js | 8 +++++ api/checkout/config/routes.json | 52 ++++++++++++++++++++++++++++++ api/checkout/controllers/checkout.js | 8 +++++ api/checkout/models/checkout.js | 8 +++++ api/checkout/models/checkout.settings.json | 40 +++++++++++++++++++++++ api/checkout/services/checkout.js | 8 +++++ 10 files changed, 230 insertions(+) create mode 100644 api/cart/config/routes.json create mode 100644 api/cart/controllers/cart.js create mode 100644 api/cart/models/cart.js create mode 100644 api/cart/models/cart.settings.json create mode 100644 api/cart/services/cart.js create mode 100644 api/checkout/config/routes.json create mode 100644 api/checkout/controllers/checkout.js create mode 100644 api/checkout/models/checkout.js create mode 100644 api/checkout/models/checkout.settings.json create mode 100644 api/checkout/services/checkout.js diff --git a/api/cart/config/routes.json b/api/cart/config/routes.json new file mode 100644 index 0000000..cb1b638 --- /dev/null +++ b/api/cart/config/routes.json @@ -0,0 +1,52 @@ +{ + "routes": [ + { + "method": "GET", + "path": "/carts", + "handler": "cart.find", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/carts/count", + "handler": "cart.count", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/carts/:id", + "handler": "cart.findOne", + "config": { + "policies": [] + } + }, + { + "method": "POST", + "path": "/carts", + "handler": "cart.create", + "config": { + "policies": [] + } + }, + { + "method": "PUT", + "path": "/carts/:id", + "handler": "cart.update", + "config": { + "policies": [] + } + }, + { + "method": "DELETE", + "path": "/carts/:id", + "handler": "cart.delete", + "config": { + "policies": [] + } + } + ] +} diff --git a/api/cart/controllers/cart.js b/api/cart/controllers/cart.js new file mode 100644 index 0000000..556f4fc --- /dev/null +++ b/api/cart/controllers/cart.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/cart/models/cart.js b/api/cart/models/cart.js new file mode 100644 index 0000000..dd847ef --- /dev/null +++ b/api/cart/models/cart.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/cart/models/cart.settings.json b/api/cart/models/cart.settings.json new file mode 100644 index 0000000..300e82f --- /dev/null +++ b/api/cart/models/cart.settings.json @@ -0,0 +1,38 @@ +{ + "kind": "collectionType", + "collectionName": "carts", + "info": { + "name": "Cart", + "description": "" + }, + "options": { + "increments": true, + "timestamps": true, + "draftAndPublish": true + }, + "attributes": { + "product_name": { + "type": "string" + }, + "product_price": { + "type": "biginteger" + }, + "product_color": { + "type": "string" + }, + "product_otr": { + "type": "string" + }, + "product_img": { + "model": "file", + "via": "related", + "allowedTypes": [ + "images", + "files", + "videos" + ], + "plugin": "upload", + "required": false + } + } +} diff --git a/api/cart/services/cart.js b/api/cart/services/cart.js new file mode 100644 index 0000000..6bc4168 --- /dev/null +++ b/api/cart/services/cart.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/checkout/config/routes.json b/api/checkout/config/routes.json new file mode 100644 index 0000000..dbaae0a --- /dev/null +++ b/api/checkout/config/routes.json @@ -0,0 +1,52 @@ +{ + "routes": [ + { + "method": "GET", + "path": "/checkouts", + "handler": "checkout.find", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/checkouts/count", + "handler": "checkout.count", + "config": { + "policies": [] + } + }, + { + "method": "GET", + "path": "/checkouts/:id", + "handler": "checkout.findOne", + "config": { + "policies": [] + } + }, + { + "method": "POST", + "path": "/checkouts", + "handler": "checkout.create", + "config": { + "policies": [] + } + }, + { + "method": "PUT", + "path": "/checkouts/:id", + "handler": "checkout.update", + "config": { + "policies": [] + } + }, + { + "method": "DELETE", + "path": "/checkouts/:id", + "handler": "checkout.delete", + "config": { + "policies": [] + } + } + ] +} diff --git a/api/checkout/controllers/checkout.js b/api/checkout/controllers/checkout.js new file mode 100644 index 0000000..556f4fc --- /dev/null +++ b/api/checkout/controllers/checkout.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/checkout/models/checkout.js b/api/checkout/models/checkout.js new file mode 100644 index 0000000..dd847ef --- /dev/null +++ b/api/checkout/models/checkout.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/checkout/models/checkout.settings.json b/api/checkout/models/checkout.settings.json new file mode 100644 index 0000000..d1fdf95 --- /dev/null +++ b/api/checkout/models/checkout.settings.json @@ -0,0 +1,40 @@ +{ + "kind": "collectionType", + "collectionName": "checkouts", + "info": { + "name": "Checkout" + }, + "options": { + "increments": true, + "timestamps": true, + "draftAndPublish": true + }, + "attributes": { + "product_name": { + "type": "string" + }, + "product_img": { + "model": "file", + "via": "related", + "allowedTypes": [ + "images", + "files", + "videos" + ], + "plugin": "upload", + "required": false + }, + "product_color": { + "type": "string" + }, + "product_quantity": { + "type": "string" + }, + "product_total": { + "type": "biginteger" + }, + "transaction_id": { + "type": "string" + } + } +} diff --git a/api/checkout/services/checkout.js b/api/checkout/services/checkout.js new file mode 100644 index 0000000..6bc4168 --- /dev/null +++ b/api/checkout/services/checkout.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 = {};