docs: add details on updating a cart's customer (#10226)

Should be merged after releasing v2.0.5

Closes DX-1096
This commit is contained in:
Shahed Nasser
2024-11-25 11:56:35 +00:00
committed by GitHub
parent 01b0a84898
commit ae1c607f4e
12 changed files with 110 additions and 65 deletions
+18 -18
View File
@@ -37,7 +37,7 @@ import { model } from "@medusajs/framework/utils"
const Post = model.define("post", {
id: model.id().primaryKey(),
title: model.text()
title: model.text(),
})
export default Post
@@ -143,8 +143,8 @@ module.exports = defineConfig({
},
modules: [
{
resolve: "./src/modules/blog"
}
resolve: "./src/modules/blog",
},
],
})
```
@@ -168,16 +168,16 @@ npx medusa db:generate blog
The `db:generate` command of the Medusa CLI accepts one or more module names to generate the migration for. It will create a migration file for the Blog Module in the directory `src/modules/blog/migrations` similar to the following:
```ts
import { Migration } from '@mikro-orm/migrations';
import { Migration } from "@mikro-orm/migrations"
export class Migration20241121103722 extends Migration {
async up(): Promise<void> {
this.addSql('create table if not exists "post" ("id" text not null, "title" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "post_pkey" primary key ("id"));');
this.addSql("create table if not exists \"post\" (\"id\" text not null, \"title\" text not null, \"created_at\" timestamptz not null default now(), \"updated_at\" timestamptz not null default now(), \"deleted_at\" timestamptz null, constraint \"post_pkey\" primary key (\"id\"));")
}
async down(): Promise<void> {
this.addSql('drop table if exists "post" cascade;');
this.addSql("drop table if exists \"post\" cascade;")
}
}
@@ -226,10 +226,10 @@ import {
createStep,
createWorkflow,
StepResponse,
WorkflowResponse
} from "@medusajs/framework/workflows-sdk";
import { BLOG_MODULE } from "../modules/blog";
import BlogModuleService from "../modules/blog/service";
WorkflowResponse,
} from "@medusajs/framework/workflows-sdk"
import { BLOG_MODULE } from "../modules/blog"
import BlogModuleService from "../modules/blog/service"
type CreatePostWorkflowInput = {
title: string
@@ -241,7 +241,7 @@ const createPostStep = createStep(
const blogModuleService: BlogModuleService = container.resolve(BLOG_MODULE)
const post = await blogModuleService.createPosts({
title
title,
})
return new StepResponse(post, post)
@@ -272,11 +272,11 @@ You'll now execute that workflow in an API route to expose the feature of creati
```ts
import type {
MedusaRequest,
MedusaResponse
} from "@medusajs/framework/http";
MedusaResponse,
} from "@medusajs/framework/http"
import {
createPostWorkflow
} from "../../../workflows/create-post";
createPostWorkflow,
} from "../../../workflows/create-post"
export async function POST(
req: MedusaRequest,
@@ -285,12 +285,12 @@ export async function POST(
const { result: post } = await createPostWorkflow(req.scope)
.run({
input: {
title: "My Post"
}
title: "My Post",
},
})
res.json({
post
post,
})
}
```