feat(core-flows): support ad hoc returns (#13598)
* feat(core-flows): support ad hoc returns * fix: missing transform * handle edge case * refactor * replace gte for gt * cleanup * weird bug fix * add test * Create quick-nails-kick.md * stop sending empty strings * add code to refund reason * fix build * fix tests * handle code in dashboard * fix tests * more tests failing * add reference and reference id to credit lieng * rework create refund form
This commit is contained in:
@@ -30,10 +30,10 @@
|
||||
"build": "rimraf dist && tsc --build && npm run resolve:aliases",
|
||||
"test": "jest --bail --passWithNoTests --forceExit -- src",
|
||||
"test:integration": "jest --forceExit -- integration-tests/**/__tests__/**/*.ts",
|
||||
"migration:initial": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm migration:create --initial",
|
||||
"migration:create": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm-orm migration:create",
|
||||
"migration:up": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm-orm migration:up",
|
||||
"orm:cache:clear": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm-orm cache:clear"
|
||||
"migration:initial": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro migration:create --initial",
|
||||
"migration:create": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm migration:create",
|
||||
"migration:up": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm migration:up",
|
||||
"orm:cache:clear": "MIKRO_ORM_CLI_CONFIG=./mikro-orm.config.dev.ts MIKRO_ORM_ALLOW_GLOBAL_CLI=true medusa-mikro-orm cache:clear"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@medusajs/framework": "2.10.3",
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Migration } from "@mikro-orm/migrations"
|
||||
|
||||
export class Migration20250929124701 extends Migration {
|
||||
override async up(): Promise<void> {
|
||||
// Step 1: Add the column as nullable
|
||||
this.addSql(
|
||||
`alter table "refund_reason" add column "code" text;`
|
||||
)
|
||||
|
||||
// Step 2: Populate the code column from label (convert to snake_case)
|
||||
this.addSql(`
|
||||
update "refund_reason"
|
||||
set "code" = lower(replace("label", ' ', '_'));
|
||||
`)
|
||||
|
||||
// Step 3: Set the column to not nullable
|
||||
this.addSql(`alter table "refund_reason" alter column "code" set not null;`)
|
||||
}
|
||||
|
||||
override async down(): Promise<void> {
|
||||
// Remove the code column
|
||||
this.addSql(`alter table "refund_reason" drop column "code";`)
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import Refund from "./refund"
|
||||
const RefundReason = model.define("RefundReason", {
|
||||
id: model.id({ prefix: "refr" }).primaryKey(),
|
||||
label: model.text().searchable(),
|
||||
code: model.text().searchable(),
|
||||
description: model.text().searchable().nullable(),
|
||||
metadata: model.json().nullable(),
|
||||
refunds: model.hasMany(() => Refund, {
|
||||
|
||||
Reference in New Issue
Block a user