Feat: Medusa react price list (#1258)

* export everything from price lists in core

* medusa-js price list

* feat: add product list for price lists

* feat: add product list for price lists

* add price list to admin module

* add price list hooks initial

* refactor: product list controller

* fix: add integration test for price list products

* update types

* add tests for price lists

* update medusa react tests

* update update request for price lists

* Apply suggestions from code review

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>

* rename methods

* pr feedback

* list products from price list

* fix errors after merge

* update medusa react with medusa-js method name changes

* redo changes

* update hook names

* fix: routes in msw handler

Co-authored-by: Sebastian Rindom <skrindom@gmail.com>
Co-authored-by: Zakaria El Asri <zakaria.elas@gmail.com>
This commit is contained in:
Philip Korsholm
2022-04-03 20:48:49 +02:00
committed by GitHub
parent fb33dbaca3
commit b164977a19
24 changed files with 838 additions and 276 deletions

View File

@@ -1,7 +1,5 @@
---
title: Create a Service
---
# Create a Service
@@ -31,7 +29,7 @@ To create a service, you should create a JavaScript file in `src/services` to ho
For example, if you want to create a service `helloService`, create the file `hello.js` in `src/services` with the following content:
```js
import { BaseService } from "medusa-interfaces";
import { BaseService } from "medusa-interfaces"
class HelloService extends BaseService {
getMessage() {
@@ -39,7 +37,7 @@ class HelloService extends BaseService {
}
}
export default HelloService;
export default HelloService
```
## Service Constructor
@@ -85,10 +83,10 @@ constructor({ helloService }) {
To use your custom service in an endpoint, you can use `req.scope.resolve` passing it the services registration name:
```js
const helloService = req.scope.resolve('helloService');
const helloService = req.scope.resolve("helloService")
res.json({
message: helloService.getMessage()
message: helloService.getMessage(),
})
```