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:
@@ -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 service’s registration name:
|
||||
|
||||
```js
|
||||
const helloService = req.scope.resolve('helloService');
|
||||
const helloService = req.scope.resolve("helloService")
|
||||
|
||||
res.json({
|
||||
message: helloService.getMessage()
|
||||
message: helloService.getMessage(),
|
||||
})
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user