-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: added customize import strategy doc #2253
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - w. comments
import { AbstractBatchJobStrategy, BatchJobService } from '@medusajs/medusa' | ||
import { EntityManager } from 'typeorm' | ||
|
||
class ImportStrategy extends AbstractBatchJobStrategy { | ||
protected batchJobService_: BatchJobService | ||
protected manager_: EntityManager | ||
protected transactionManager_: EntityManager | ||
|
||
processJob(batchJobId: string): Promise<void> { | ||
throw new Error('Method not implemented.') | ||
} | ||
buildTemplate(): Promise<string> { | ||
throw new Error('Method not implemented.') | ||
} | ||
} | ||
|
||
export default ImportStrategy | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think we should make it clear that there are more methods to implement than just these two
So, for example, to overwrite the product import strategy set the `batchType` property in your strategy to `product-import`: | ||
|
||
```tsx | ||
class ImportStrategy extends AbstractBatchJobStrategy { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class ImportStrategy extends AbstractBatchJobStrategy { | |
class MyImportStrategy extends AbstractBatchJobStrategy { |
|
||
So, for example, to overwrite the product import strategy set the `batchType` property in your strategy to `product-import`: | ||
|
||
```tsx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: technically this isn't tsx but pure typescript
```tsx | |
```typescript |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true, it's exported from Notion in that format. I added a vale rule to spot it in the future
Closes DOCS-232 and DOCS-253