Browse Source

docs: Fixes & additions to docs

Michael Bromley 4 years ago
parent
commit
54d1b0c337

+ 3 - 3
docs/content/plugins/plugin-architecture/_index.md

@@ -8,10 +8,10 @@ showtoc: true
 
 {{< figure src="plugin_architecture.png" >}}
 
-A plugin in Vendure is a specialized Nestjs Module which is decorated with the [`VendurePlugin` class decorator]({{< relref "vendure-plugin" >}}). This diagram illustrates the how a plugin can integrate with and extend Vendure.
+A plugin in Vendure is a specialized Nestjs Module which is decorated with the [`VendurePlugin` class decorator]({{< relref "vendure-plugin" >}}). This diagram illustrates how a plugin can integrate with and extend Vendure.
  
-1. A Plugin may define logic to be run by the [Vendure Worker]({{< relref "/docs/developer-guide/vendure-worker" >}}). This is suitable for long-running or resource-intensive tasks and is done by providing controllers via the [`workers` metadata property]({{< relref "vendure-plugin-metadata" >}}#workers).
+1. A Plugin may define logic to be run by the [Vendure Worker]({{< relref "/docs/developer-guide/vendure-worker" >}}). This is suitable for long-running or resource-intensive tasks.
 2. A Plugin can modify any aspect of server configuration via the [`configuration` metadata property]({{< relref "vendure-plugin-metadata" >}}#configuration).
 3. A Plugin can extend the GraphQL APIs via the [`shopApiExtensions` metadata property]({{< relref "vendure-plugin-metadata" >}}#shopapiextensions) and the [`adminApiExtensions` metadata property]({{< relref "vendure-plugin-metadata" >}}#adminapiextensions).
-4. A Plugin can interact with Vendure by importing the [`PluginCommonModule`]({{< relref "plugin-common-module" >}}), by which it may inject any of the core Vendure services (which are responsible for all interaction with the database as well as business logic). Additionally a plugin may define new database entities via the [`entities` metadata property]({{< relref "vendure-plugin-metadata" >}}#entities) and otherwise define any other providers and controllers just like any [Nestjs module](https://docs.nestjs.com/modules).
+4. A Plugin can interact with Vendure by importing the [`PluginCommonModule`]({{< relref "plugin-common-module" >}}), by which it may inject any of the core Vendure services (which are responsible for all interaction with the database as well as business logic). Additionally, a plugin may define new database entities via the [`entities` metadata property]({{< relref "vendure-plugin-metadata" >}}#entities) and otherwise define any other providers and controllers just like any [Nestjs module](https://docs.nestjs.com/modules).
 5. A Plugin can run arbitrary code, which allows it to make use of external services. For example, a plugin could interface with a cloud storage provider, a payment gateway, or a video encoding service.

+ 2 - 2
docs/content/plugins/plugin-examples/extending-graphql-api.md

@@ -157,8 +157,8 @@ import { Ctx, RequestContext, Product } from '@vendure/core';
 export class FieldOverrideExampleResolver {
   
   @ResolveField()
-  description(@Ctx() ctx: RequestContext, @Parent() variant: Product) {
-    return this.wrapInFormatting(ctx, variant.id);
+  description(@Ctx() ctx: RequestContext, @Parent() product: Product) {
+    return this.wrapInFormatting(ctx, product.id);
   }
   
   private wrapInFormatting(ctx: RequestContext, id: ID): string {

+ 12 - 1
docs/content/plugins/plugin-examples/using-job-queue-service.md

@@ -76,7 +76,18 @@ class ProductVideoService implements OnModuleInit {
   }
 }
 ```
-The `ProductVideoService` is in charge of setting up the JobQueue and adding jobs to that queue.
+The `ProductVideoService` is in charge of setting up the JobQueue and adding jobs to that queue. Calling 
+
+```TypeScript
+productVideoService.transcodeForProduct(id, url);
+```
+
+will add a transcoding job to the queue.
+
+{{< alert warning >}}
+**Note:** plugin code typically gets executed on both the server _and_ the worker. Therefore, you sometimes need to explicitly check
+what context you are in. This can be done with the [ProcessContext]({{< relref "process-context" >}}) provider.
+{{< /alert >}}
 
 ```TypeScript
 // product-video.plugin.ts