@medusajs/pricing 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/joiner-config.d.ts +1 -2
- package/dist/joiner-config.js +1 -9
- package/dist/migrations/Migration20230929122253.js +60 -29
- package/dist/migrations/Migration20240322094407.d.ts +5 -0
- package/dist/migrations/Migration20240322094407.js +15 -0
- package/dist/migrations/{Migration20231101232834.d.ts → Migration20240322113359.d.ts} +1 -1
- package/dist/migrations/Migration20240322113359.js +19 -0
- package/dist/migrations/{Migration20240103140327.d.ts → Migration20240322120125.d.ts} +1 -1
- package/dist/migrations/Migration20240322120125.js +15 -0
- package/dist/models/index.d.ts +1 -3
- package/dist/models/index.js +3 -7
- package/dist/models/price-list-rule-value.d.ts +9 -0
- package/dist/models/price-list-rule-value.js +49 -4
- package/dist/models/price-list-rule.d.ts +8 -3
- package/dist/models/price-list-rule.js +65 -15
- package/dist/models/price-list.d.ts +7 -6
- package/dist/models/price-list.js +23 -11
- package/dist/models/price-rule.d.ts +8 -5
- package/dist/models/price-rule.js +63 -19
- package/dist/models/price-set-rule-type.d.ts +5 -4
- package/dist/models/price-set-rule-type.js +57 -8
- package/dist/models/price-set.d.ts +7 -6
- package/dist/models/price-set.js +42 -19
- package/dist/models/price.d.ts +27 -0
- package/dist/models/price.js +167 -0
- package/dist/models/rule-type.d.ts +1 -0
- package/dist/models/rule-type.js +21 -2
- package/dist/repositories/pricing.js +40 -38
- package/dist/scripts/seed.js +9 -17
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.js +1 -7
- package/dist/services/pricing-module.d.ts +19 -33
- package/dist/services/pricing-module.js +163 -348
- package/dist/services/rule-type.d.ts +5 -6
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.js +1 -2
- package/dist/types/services/index.d.ts +0 -10
- package/dist/types/services/index.js +0 -10
- package/dist/types/services/price-list.d.ts +0 -21
- package/package.json +5 -5
- package/dist/migrations/Migration20231101232834.js +0 -50
- package/dist/migrations/Migration20240103140327.js +0 -29
- package/dist/models/money-amount.d.ts +0 -19
- package/dist/models/money-amount.js +0 -111
- package/dist/models/price-set-money-amount-rules.d.ts +0 -10
- package/dist/models/price-set-money-amount-rules.js +0 -63
- package/dist/models/price-set-money-amount.d.ts +0 -24
- package/dist/models/price-set-money-amount.js +0 -128
- package/dist/services/price-list-rule-value.d.ts +0 -13
- package/dist/services/price-list-rule-value.js +0 -22
- package/dist/services/price-list-rule.d.ts +0 -15
- package/dist/services/price-list-rule.js +0 -41
- package/dist/services/price-rule.d.ts +0 -13
- package/dist/services/price-rule.js +0 -22
- package/dist/types/repositories/index.d.ts +0 -10
- package/dist/types/repositories/index.js +0 -26
- package/dist/types/repositories/money-amount.d.ts +0 -14
- package/dist/types/repositories/money-amount.js +0 -2
- package/dist/types/repositories/price-list-rule-value.d.ts +0 -10
- package/dist/types/repositories/price-list-rule-value.js +0 -2
- package/dist/types/repositories/price-list-rule.d.ts +0 -14
- package/dist/types/repositories/price-list-rule.js +0 -2
- package/dist/types/repositories/price-list.d.ts +0 -18
- package/dist/types/repositories/price-list.js +0 -2
- package/dist/types/repositories/price-rule.d.ts +0 -21
- package/dist/types/repositories/price-rule.js +0 -2
- package/dist/types/repositories/price-set-money-amount-rules.d.ts +0 -11
- package/dist/types/repositories/price-set-money-amount-rules.js +0 -2
- package/dist/types/repositories/price-set-money-amount.d.ts +0 -13
- package/dist/types/repositories/price-set-money-amount.js +0 -2
- package/dist/types/repositories/price-set-rule-type.d.ts +0 -10
- package/dist/types/repositories/price-set-rule-type.js +0 -2
- package/dist/types/repositories/price-set.d.ts +0 -5
- package/dist/types/repositories/price-set.js +0 -2
- package/dist/types/repositories/rule-type.d.ts +0 -12
- package/dist/types/repositories/rule-type.js +0 -2
- package/dist/types/services/money-amount.d.ts +0 -30
- package/dist/types/services/money-amount.js +0 -2
- package/dist/types/services/price-list-rule-value.d.ts +0 -21
- package/dist/types/services/price-list-rule-value.js +0 -2
- package/dist/types/services/price-list-rule.d.ts +0 -27
- package/dist/types/services/price-list-rule.js +0 -2
- package/dist/types/services/price-rule.d.ts +0 -42
- package/dist/types/services/price-rule.js +0 -2
- package/dist/types/services/price-set-money-amount-rules.d.ts +0 -24
- package/dist/types/services/price-set-money-amount-rules.js +0 -2
- package/dist/types/services/price-set-money-amount.d.ts +0 -32
- package/dist/types/services/price-set-money-amount.js +0 -2
- package/dist/types/services/price-set-rule-type.d.ts +0 -21
- package/dist/types/services/price-set-rule-type.js +0 -2
- package/dist/types/services/price-set.d.ts +0 -15
- package/dist/types/services/price-set.js +0 -2
- package/dist/types/services/pricing.d.ts +0 -20
- package/dist/types/services/pricing.js +0 -2
- package/dist/types/services/rule-type.d.ts +0 -32
- package/dist/types/services/rule-type.js +0 -2
package/dist/joiner-config.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { ModuleJoinerConfig } from "@medusajs/types";
|
|
2
2
|
import { MapToConfig } from "@medusajs/utils";
|
|
3
3
|
export declare const LinkableKeys: {
|
|
4
|
-
money_amount_id: string;
|
|
5
4
|
price_set_id: string;
|
|
6
5
|
price_list_id: string;
|
|
7
|
-
|
|
6
|
+
price_id: string;
|
|
8
7
|
};
|
|
9
8
|
export declare const entityNameToLinkableKeysMap: MapToConfig;
|
|
10
9
|
export declare const joinerConfig: ModuleJoinerConfig;
|
package/dist/joiner-config.js
CHANGED
|
@@ -8,10 +8,9 @@ const modules_sdk_1 = require("@medusajs/modules-sdk");
|
|
|
8
8
|
const _models_1 = require("./models");
|
|
9
9
|
const schema_1 = __importDefault(require("./schema"));
|
|
10
10
|
exports.LinkableKeys = {
|
|
11
|
-
money_amount_id: _models_1.MoneyAmount.name,
|
|
12
11
|
price_set_id: _models_1.PriceSet.name,
|
|
13
12
|
price_list_id: _models_1.PriceList.name,
|
|
14
|
-
|
|
13
|
+
price_id: _models_1.Price.name,
|
|
15
14
|
};
|
|
16
15
|
const entityLinkableKeysMap = {};
|
|
17
16
|
Object.entries(exports.LinkableKeys).forEach(([key, value]) => {
|
|
@@ -34,13 +33,6 @@ exports.joinerConfig = {
|
|
|
34
33
|
entity: "PriceSet",
|
|
35
34
|
},
|
|
36
35
|
},
|
|
37
|
-
{
|
|
38
|
-
name: ["money_amount", "money_amounts"],
|
|
39
|
-
args: {
|
|
40
|
-
methodSuffix: "MoneyAmounts",
|
|
41
|
-
entity: "MoneyAmount",
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
36
|
{
|
|
45
37
|
name: ["price_list", "price_lists"],
|
|
46
38
|
args: {
|
|
@@ -4,43 +4,74 @@ exports.Migration20230929122253 = void 0;
|
|
|
4
4
|
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
5
|
class Migration20230929122253 extends migrations_1.Migration {
|
|
6
6
|
async up() {
|
|
7
|
-
this.addSql('create table if not exists "money_amount" ("id" text not null, "currency_code" text null, "amount" numeric null, "min_quantity" numeric null, "max_quantity" numeric null, constraint "money_amount_pkey" primary key ("id"));');
|
|
8
|
-
this.addSql('create
|
|
9
|
-
this.addSql('create table "
|
|
10
|
-
this.addSql('
|
|
11
|
-
this.addSql('create
|
|
12
|
-
this.addSql('create
|
|
13
|
-
this.addSql('create table "
|
|
14
|
-
this.addSql('
|
|
15
|
-
this.addSql('
|
|
16
|
-
this.addSql('create index "IDX_price_set_rule_type_price_set_id" on "price_set_rule_type" ("price_set_id");');
|
|
17
|
-
this.addSql('create index "IDX_price_set_rule_type_rule_type_id" on "price_set_rule_type" ("rule_type_id");');
|
|
18
|
-
this.addSql('create table "price_set_money_amount_rules" ("id" text not null, "price_set_money_amount_id" text not null, "rule_type_id" text not null, "value" text not null, constraint "price_set_money_amount_rules_pkey" primary key ("id"));');
|
|
19
|
-
this.addSql('create index "IDX_price_set_money_amount_rules_price_set_money_amount_id" on "price_set_money_amount_rules" ("price_set_money_amount_id");');
|
|
20
|
-
this.addSql('create index "IDX_price_set_money_amount_rules_rule_type_id" on "price_set_money_amount_rules" ("rule_type_id");');
|
|
21
|
-
this.addSql('create table "price_rule" ("id" text not null, "price_set_id" text not null, "rule_type_id" text not null, "is_dynamic" boolean not null default false, "value" text not null, "priority" integer not null default 0, "price_set_money_amount_id" text not null, "price_list_id" text not null, constraint "price_rule_pkey" primary key ("id"));');
|
|
22
|
-
this.addSql('create index "IDX_price_rule_price_set_id" on "price_rule" ("price_set_id");');
|
|
23
|
-
this.addSql('create index "IDX_price_rule_rule_type_id" on "price_rule" ("rule_type_id");');
|
|
24
|
-
this.addSql('create index "IDX_price_rule_price_set_money_amount_id" on "price_rule" ("price_set_money_amount_id");');
|
|
25
|
-
this.addSql('alter table "price_set_money_amount" add constraint "price_set_money_amount_price_set_id_foreign" foreign key ("price_set_id") references "price_set" ("id") on update cascade on delete cascade;');
|
|
26
|
-
this.addSql('alter table "price_set_money_amount" add constraint "price_set_money_amount_money_amount_id_foreign" foreign key ("money_amount_id") references "money_amount" ("id") on update cascade on delete cascade;');
|
|
7
|
+
this.addSql('create table if not exists "money_amount" ("id" text not null, "currency_code" text not null, "amount" numeric not null, "min_quantity" numeric null, "max_quantity" numeric null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "money_amount_pkey" primary key ("id"));');
|
|
8
|
+
this.addSql('create table "price_set" ("id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_set_pkey" primary key ("id"));');
|
|
9
|
+
this.addSql('create table "price" ("id" text not null, "title" text, "price_set_id" text not null, "money_amount_id" text not null, "rules_count" integer not null default 0, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_pkey" primary key ("id"));');
|
|
10
|
+
this.addSql('alter table "price" add constraint "price_money_amount_id_unique" unique ("money_amount_id");');
|
|
11
|
+
this.addSql('create table "rule_type" ("id" text not null, "name" text not null, "rule_attribute" text not null, "default_priority" integer not null default 0, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "rule_type_pkey" primary key ("id"));');
|
|
12
|
+
this.addSql('create table "price_set_rule_type" ("id" text not null, "price_set_id" text not null, "rule_type_id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_set_rule_type_pkey" primary key ("id"));');
|
|
13
|
+
this.addSql('create table "price_rule" ("id" text not null, "price_set_id" text not null, "rule_type_id" text not null, "value" text not null, "priority" integer not null default 0, "price_id" text not null, "price_list_id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_rule_pkey" primary key ("id"));');
|
|
14
|
+
this.addSql('alter table "price" add constraint "price_price_set_id_foreign" foreign key ("price_set_id") references "price_set" ("id") on update cascade on delete cascade;');
|
|
15
|
+
this.addSql('alter table "price" add constraint "price_money_amount_id_foreign" foreign key ("money_amount_id") references "money_amount" ("id") on update cascade on delete cascade;');
|
|
27
16
|
this.addSql('alter table "price_set_rule_type" add constraint "price_set_rule_type_price_set_id_foreign" foreign key ("price_set_id") references "price_set" ("id") on update cascade on delete cascade;');
|
|
28
17
|
this.addSql('alter table "price_set_rule_type" add constraint "price_set_rule_type_rule_type_id_foreign" foreign key ("rule_type_id") references "rule_type" ("id") on update cascade;');
|
|
29
|
-
this.addSql('alter table "price_set_money_amount_rules" add constraint "price_set_money_amount_rules_price_set_money_amount_id_foreign" foreign key ("price_set_money_amount_id") references "price_set_money_amount" ("id") on update cascade on delete cascade;');
|
|
30
|
-
this.addSql('alter table "price_set_money_amount_rules" add constraint "price_set_money_amount_rules_rule_type_id_foreign" foreign key ("rule_type_id") references "rule_type" ("id") on update cascade;');
|
|
31
18
|
this.addSql('alter table "price_rule" add constraint "price_rule_price_set_id_foreign" foreign key ("price_set_id") references "price_set" ("id") on update cascade on delete cascade;');
|
|
32
19
|
this.addSql('alter table "price_rule" add constraint "price_rule_rule_type_id_foreign" foreign key ("rule_type_id") references "rule_type" ("id") on update cascade;');
|
|
33
|
-
this.addSql('alter table "price_rule" add constraint "
|
|
20
|
+
this.addSql('alter table "price_rule" add constraint "price_rule_price_id_foreign" foreign key ("price_id") references "price" ("id") on update cascade on delete cascade;');
|
|
34
21
|
this.addSql('create table if not exists "price_list" ("id" text not null, "status" text check ("status" in (\'active\', \'draft\')) not null default \'draft\', "starts_at" timestamptz null, "ends_at" timestamptz null, "rules_count" integer not null default 0, constraint "price_list_pkey" primary key ("id"));');
|
|
35
|
-
this.addSql('create table "price_list_rule" ("id" text not null, "rule_type_id" text not null, "price_list_id" text not null, constraint "price_list_rule_pkey" primary key ("id"));');
|
|
36
|
-
this.addSql('create index "IDX_price_list_rule_rule_type_id" on "price_list_rule" ("rule_type_id");');
|
|
37
|
-
this.addSql('create index "IDX_price_list_rule_price_list_id" on "price_list_rule" ("price_list_id");');
|
|
22
|
+
this.addSql('create table "price_list_rule" ("id" text not null, "rule_type_id" text not null, "price_list_id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_list_rule_pkey" primary key ("id"));');
|
|
38
23
|
this.addSql('alter table "price_list_rule" add constraint "price_list_rule_rule_type_id_foreign" foreign key ("rule_type_id") references "rule_type" ("id") on update cascade;');
|
|
39
24
|
this.addSql('alter table "price_list_rule" add constraint "price_list_rule_price_list_id_foreign" foreign key ("price_list_id") references "price_list" ("id") on update cascade;');
|
|
40
|
-
this.addSql('alter table "
|
|
41
|
-
this.addSql('alter table "price_set_money_amount" add constraint "price_set_money_amount_price_list_id_foreign" foreign key ("price_list_id") references "price_list" ("id") on update cascade on delete set null;');
|
|
42
|
-
this.addSql('create index "IDX_price_rule_price_list_id" on "price_set_money_amount" ("price_list_id");');
|
|
25
|
+
this.addSql('alter table "price" add column "price_list_id" text null;');
|
|
43
26
|
this.addSql('alter table "price_rule" drop column "price_list_id";');
|
|
27
|
+
this.addSql('create table "price_list_rule_value" ("id" text not null, "value" text not null, "price_list_rule_id" text not null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "price_list_rule_value_pkey" primary key ("id"));');
|
|
28
|
+
this.addSql('alter table "price_list_rule_value" add constraint "price_list_rule_value_price_list_rule_id_foreign" foreign key ("price_list_rule_id") references "price_list_rule" ("id") on update cascade on delete cascade;');
|
|
29
|
+
this.addSql(`ALTER TABLE price_list
|
|
30
|
+
ADD COLUMN IF NOT EXISTS rules_count integer not null default 0`);
|
|
31
|
+
this.addSql('alter table "price_list" add column if not exists "title" text, add column if not exists "name" text, add column if not exists "description" text not null, add column if not exists "type" text check ("type" in (\'sale\', \'override\')) not null default \'sale\', add column if not exists "created_at" timestamptz not null default now(), add column if not exists "updated_at" timestamptz not null default now(), add column if not exists "deleted_at" timestamptz null;');
|
|
32
|
+
this.addSql(`
|
|
33
|
+
UPDATE "price_list"
|
|
34
|
+
SET title = name
|
|
35
|
+
`);
|
|
36
|
+
this.addSql(`alter table "price_list" alter column "title" set not null `);
|
|
37
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_currency_code" ON "money_amount" (currency_code) WHERE deleted_at IS NULL;');
|
|
38
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_deleted_at" ON "money_amount" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
39
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_list_deleted_at" ON "price_list" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
40
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_set_deleted_at" ON "price_set" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
41
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_price_set_id" ON "price" (price_set_id) WHERE deleted_at IS NULL;');
|
|
42
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_money_amount_id" ON "price" (money_amount_id) WHERE deleted_at IS NULL;');
|
|
43
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_price_list_id" ON "price" (price_list_id) WHERE deleted_at IS NULL;');
|
|
44
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_deleted_at" ON "price" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
45
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_rule_type_rule_attribute" ON "rule_type" (rule_attribute) WHERE deleted_at IS NOT NULL;');
|
|
46
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_rule_type_deleted_at" ON "rule_type" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
47
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_set_rule_type_price_set_id" ON "price_set_rule_type" (price_set_id) WHERE deleted_at IS NOT NULL;');
|
|
48
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_set_rule_type_rule_type_id" ON "price_set_rule_type" (rule_type_id) WHERE deleted_at IS NOT NULL;');
|
|
49
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_set_rule_type_deleted_at" ON "price_set_rule_type" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
50
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_rule_price_set_id" ON "price_rule" (price_set_id) WHERE deleted_at IS NOT NULL;');
|
|
51
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_rule_rule_type_id" ON "price_rule" (rule_type_id) WHERE deleted_at IS NOT NULL;');
|
|
52
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_rule_price_id_unique" ON "price_rule" (price_id) WHERE deleted_at IS NOT NULL;');
|
|
53
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_rule_deleted_at" ON "price_rule" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
54
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_list_rule_rule_type_id_unique" ON "price_list_rule" (rule_type_id) WHERE deleted_at IS NOT NULL;');
|
|
55
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_list_rule_price_list_id" ON "price_list_rule" (price_list_id) WHERE deleted_at IS NOT NULL;');
|
|
56
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_list_rule_deleted_at" ON "price_list_rule" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
57
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_list_rule_value_price_list_rule_id" ON "price_list_rule_value" (price_list_rule_id) WHERE deleted_at IS NULL;');
|
|
58
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_list_rule_value_deleted_at" ON "price_list_rule_value" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
59
|
+
this.addSql('alter table if exists "price_list" drop column if exists "name";');
|
|
60
|
+
this.addSql('alter table if exists "price" add constraint "price_price_list_id_foreign" foreign key ("price_list_id") references "price_list" ("id") on update cascade on delete cascade;');
|
|
61
|
+
this.addSql('alter table if exists "price_rule" drop constraint if exists "price_rule_rule_type_id_foreign";');
|
|
62
|
+
this.addSql('alter table if exists "price_rule" add constraint "price_rule_rule_type_id_foreign" foreign key ("rule_type_id") references "rule_type" ("id") on update cascade on delete cascade;');
|
|
63
|
+
this.addSql('alter table if exists "price_rule" drop constraint if exists "price_rule_rule_type_id_foreign";');
|
|
64
|
+
this.addSql('alter table if exists "price_list_rule" drop constraint if exists "price_list_rule_price_list_id_foreign";');
|
|
65
|
+
this.addSql('alter table if exists "price_rule" add constraint "price_rule_rule_type_id_foreign" foreign key ("rule_type_id") references "rule_type" ("id") on update cascade;');
|
|
66
|
+
this.addSql('alter table if exists "price_list_rule" add constraint "price_list_rule_price_list_id_foreign" foreign key ("price_list_id") references "price_list" ("id") on update cascade on delete cascade;');
|
|
67
|
+
this.addSql('alter table if exists "price_set_rule_type" drop constraint if exists "price_set_rule_type_rule_type_id_foreign";');
|
|
68
|
+
this.addSql('alter table if exists "price_set_rule_type" add constraint "price_set_rule_type_rule_type_id_foreign" foreign key ("rule_type_id") references "rule_type" ("id") on update cascade on delete cascade;');
|
|
69
|
+
this.addSql('alter table if exists "price" drop constraint if exists "price_money_amount_id_foreign";');
|
|
70
|
+
this.addSql('alter table if exists "price" add column if not exists "amount" numeric not null, add column "min_quantity" numeric null, add column "max_quantity" numeric null;');
|
|
71
|
+
this.addSql('alter table if exists "price" drop constraint if exists "price_money_amount_id_unique";');
|
|
72
|
+
this.addSql('drop index if exists "IDX_price_money_amount_id";');
|
|
73
|
+
this.addSql('alter table if exists "price" rename column "money_amount_id" to "currency_code";');
|
|
74
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_price_currency_code" ON "price" (currency_code) WHERE deleted_at IS NULL;');
|
|
44
75
|
}
|
|
45
76
|
}
|
|
46
77
|
exports.Migration20230929122253 = Migration20230929122253;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20240322094407 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20240322094407 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql('drop table if exists "money_amount" cascade;');
|
|
8
|
+
}
|
|
9
|
+
async down() {
|
|
10
|
+
this.addSql('create table if not exists "money_amount" ("id" text not null, "currency_code" text not null, "amount" numeric not null, "min_quantity" numeric null, "max_quantity" numeric null, "created_at" timestamptz not null default now(), "updated_at" timestamptz not null default now(), "deleted_at" timestamptz null, constraint "money_amount_pkey" primary key ("id"));');
|
|
11
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_currency_code" ON "money_amount" (currency_code) WHERE deleted_at IS NULL;');
|
|
12
|
+
this.addSql('CREATE INDEX IF NOT EXISTS "IDX_money_amount_deleted_at" ON "money_amount" (deleted_at) WHERE deleted_at IS NOT NULL;');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Migration20240322094407 = Migration20240322094407;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20240322113359 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20240322113359 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql('alter table if exists "price_rule" drop constraint if exists "price_rule_price_id_foreign";');
|
|
8
|
+
this.addSql('drop index if exists "IDX_price_rule_price_id_unique";');
|
|
9
|
+
this.addSql('alter table if exists "price_rule" add constraint "price_rule_price_id_foreign" foreign key ("price_id") references "price" ("id") on update cascade on delete cascade;');
|
|
10
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_rule_price_id_unique" ON "price_rule" (price_id) WHERE deleted_at IS NULL;');
|
|
11
|
+
}
|
|
12
|
+
async down() {
|
|
13
|
+
this.addSql('alter table if exists "price_rule" drop constraint if exists "price_rule_price_id_foreign";');
|
|
14
|
+
this.addSql('drop index if exists "IDX_price_rule_price_id_unique";');
|
|
15
|
+
this.addSql('alter table if exists "price_rule" add constraint "price_rule_price_id_foreign" foreign key ("price_id") references "price" ("id") on update cascade on delete cascade;');
|
|
16
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_rule_price_id_unique" ON "price_rule" (price_id) WHERE deleted_at IS NULL;');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Migration20240322113359 = Migration20240322113359;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Migration20240322120125 = void 0;
|
|
4
|
+
const migrations_1 = require("@mikro-orm/migrations");
|
|
5
|
+
class Migration20240322120125 extends migrations_1.Migration {
|
|
6
|
+
async up() {
|
|
7
|
+
this.addSql('drop index if exists "IDX_price_rule_price_id_unique";');
|
|
8
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_rule_price_id_rule_type_id_unique" ON "price_rule" (price_id, rule_type_id) WHERE deleted_at IS NULL;');
|
|
9
|
+
}
|
|
10
|
+
async down() {
|
|
11
|
+
this.addSql('drop index if exists "IDX_price_rule_price_id_rule_type_id_unique";');
|
|
12
|
+
this.addSql('CREATE UNIQUE INDEX IF NOT EXISTS "IDX_price_rule_price_id_unique" ON "price_rule" (price_id) WHERE deleted_at IS NULL;');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.Migration20240322120125 = Migration20240322120125;
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as Price } from "./price";
|
|
2
2
|
export { default as PriceList } from "./price-list";
|
|
3
3
|
export { default as PriceListRule } from "./price-list-rule";
|
|
4
4
|
export { default as PriceListRuleValue } from "./price-list-rule-value";
|
|
5
5
|
export { default as PriceRule } from "./price-rule";
|
|
6
6
|
export { default as PriceSet } from "./price-set";
|
|
7
|
-
export { default as PriceSetMoneyAmount } from "./price-set-money-amount";
|
|
8
|
-
export { default as PriceSetMoneyAmountRules } from "./price-set-money-amount-rules";
|
|
9
7
|
export { default as PriceSetRuleType } from "./price-set-rule-type";
|
|
10
8
|
export { default as RuleType } from "./rule-type";
|
package/dist/models/index.js
CHANGED
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RuleType = exports.PriceSetRuleType = exports.
|
|
7
|
-
var
|
|
8
|
-
Object.defineProperty(exports, "
|
|
6
|
+
exports.RuleType = exports.PriceSetRuleType = exports.PriceSet = exports.PriceRule = exports.PriceListRuleValue = exports.PriceListRule = exports.PriceList = exports.Price = void 0;
|
|
7
|
+
var price_1 = require("./price");
|
|
8
|
+
Object.defineProperty(exports, "Price", { enumerable: true, get: function () { return __importDefault(price_1).default; } });
|
|
9
9
|
var price_list_1 = require("./price-list");
|
|
10
10
|
Object.defineProperty(exports, "PriceList", { enumerable: true, get: function () { return __importDefault(price_list_1).default; } });
|
|
11
11
|
var price_list_rule_1 = require("./price-list-rule");
|
|
@@ -16,10 +16,6 @@ var price_rule_1 = require("./price-rule");
|
|
|
16
16
|
Object.defineProperty(exports, "PriceRule", { enumerable: true, get: function () { return __importDefault(price_rule_1).default; } });
|
|
17
17
|
var price_set_1 = require("./price-set");
|
|
18
18
|
Object.defineProperty(exports, "PriceSet", { enumerable: true, get: function () { return __importDefault(price_set_1).default; } });
|
|
19
|
-
var price_set_money_amount_1 = require("./price-set-money-amount");
|
|
20
|
-
Object.defineProperty(exports, "PriceSetMoneyAmount", { enumerable: true, get: function () { return __importDefault(price_set_money_amount_1).default; } });
|
|
21
|
-
var price_set_money_amount_rules_1 = require("./price-set-money-amount-rules");
|
|
22
|
-
Object.defineProperty(exports, "PriceSetMoneyAmountRules", { enumerable: true, get: function () { return __importDefault(price_set_money_amount_rules_1).default; } });
|
|
23
19
|
var price_set_rule_type_1 = require("./price-set-rule-type");
|
|
24
20
|
Object.defineProperty(exports, "PriceSetRuleType", { enumerable: true, get: function () { return __importDefault(price_set_rule_type_1).default; } });
|
|
25
21
|
var rule_type_1 = require("./rule-type");
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
2
|
+
import { OptionalProps } from "@mikro-orm/core";
|
|
1
3
|
import PriceListRule from "./price-list-rule";
|
|
4
|
+
type OptionalFields = DAL.SoftDeletableEntityDateColumns;
|
|
2
5
|
export default class PriceListRuleValue {
|
|
6
|
+
[OptionalProps]?: OptionalFields;
|
|
3
7
|
id: string;
|
|
8
|
+
price_list_rule_id: string;
|
|
4
9
|
price_list_rule: PriceListRule;
|
|
5
10
|
value: string;
|
|
11
|
+
created_at: Date;
|
|
12
|
+
updated_at: Date;
|
|
13
|
+
deleted_at: Date | null;
|
|
6
14
|
onCreate(): void;
|
|
7
15
|
onInit(): void;
|
|
8
16
|
}
|
|
17
|
+
export {};
|
|
@@ -12,15 +12,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const utils_1 = require("@medusajs/utils");
|
|
15
16
|
const core_1 = require("@mikro-orm/core");
|
|
16
17
|
const price_list_rule_1 = __importDefault(require("./price-list-rule"));
|
|
17
|
-
const
|
|
18
|
+
const tableName = "price_list_rule_value";
|
|
19
|
+
const PriceListRuleValueDeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
|
|
20
|
+
tableName: tableName,
|
|
21
|
+
columns: "deleted_at",
|
|
22
|
+
where: "deleted_at IS NOT NULL",
|
|
23
|
+
});
|
|
24
|
+
const PriceListPriceListRuleIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
|
|
25
|
+
tableName: tableName,
|
|
26
|
+
columns: "price_list_rule_id",
|
|
27
|
+
where: "deleted_at IS NULL",
|
|
28
|
+
});
|
|
18
29
|
let PriceListRuleValue = class PriceListRuleValue {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.deleted_at = null;
|
|
32
|
+
}
|
|
19
33
|
onCreate() {
|
|
20
34
|
this.id = (0, utils_1.generateEntityId)(this.id, "plrv");
|
|
35
|
+
this.price_list_rule_id ?? (this.price_list_rule_id = this.price_list_rule?.id);
|
|
21
36
|
}
|
|
22
37
|
onInit() {
|
|
23
38
|
this.id = (0, utils_1.generateEntityId)(this.id, "plrv");
|
|
39
|
+
this.price_list_rule_id ?? (this.price_list_rule_id = this.price_list_rule?.id);
|
|
24
40
|
}
|
|
25
41
|
};
|
|
26
42
|
__decorate([
|
|
@@ -28,17 +44,45 @@ __decorate([
|
|
|
28
44
|
__metadata("design:type", String)
|
|
29
45
|
], PriceListRuleValue.prototype, "id", void 0);
|
|
30
46
|
__decorate([
|
|
47
|
+
PriceListPriceListRuleIdIndex.MikroORMIndex(),
|
|
31
48
|
(0, core_1.ManyToOne)(() => price_list_rule_1.default, {
|
|
32
|
-
|
|
49
|
+
columnType: "text",
|
|
50
|
+
mapToPk: true,
|
|
33
51
|
fieldName: "price_list_rule_id",
|
|
34
|
-
|
|
52
|
+
onDelete: "cascade",
|
|
35
53
|
}),
|
|
54
|
+
__metadata("design:type", String)
|
|
55
|
+
], PriceListRuleValue.prototype, "price_list_rule_id", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, core_1.ManyToOne)(() => price_list_rule_1.default, { persist: false }),
|
|
36
58
|
__metadata("design:type", price_list_rule_1.default)
|
|
37
59
|
], PriceListRuleValue.prototype, "price_list_rule", void 0);
|
|
38
60
|
__decorate([
|
|
39
61
|
(0, core_1.Property)({ columnType: "text" }),
|
|
40
62
|
__metadata("design:type", String)
|
|
41
63
|
], PriceListRuleValue.prototype, "value", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, core_1.Property)({
|
|
66
|
+
onCreate: () => new Date(),
|
|
67
|
+
columnType: "timestamptz",
|
|
68
|
+
defaultRaw: "now()",
|
|
69
|
+
}),
|
|
70
|
+
__metadata("design:type", Date)
|
|
71
|
+
], PriceListRuleValue.prototype, "created_at", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, core_1.Property)({
|
|
74
|
+
onCreate: () => new Date(),
|
|
75
|
+
onUpdate: () => new Date(),
|
|
76
|
+
columnType: "timestamptz",
|
|
77
|
+
defaultRaw: "now()",
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", Date)
|
|
80
|
+
], PriceListRuleValue.prototype, "updated_at", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
PriceListRuleValueDeletedAtIndex.MikroORMIndex(),
|
|
83
|
+
(0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
|
|
84
|
+
__metadata("design:type", Object)
|
|
85
|
+
], PriceListRuleValue.prototype, "deleted_at", void 0);
|
|
42
86
|
__decorate([
|
|
43
87
|
(0, core_1.BeforeCreate)(),
|
|
44
88
|
__metadata("design:type", Function),
|
|
@@ -52,6 +96,7 @@ __decorate([
|
|
|
52
96
|
__metadata("design:returntype", void 0)
|
|
53
97
|
], PriceListRuleValue.prototype, "onInit", null);
|
|
54
98
|
PriceListRuleValue = __decorate([
|
|
55
|
-
(0, core_1.Entity)()
|
|
99
|
+
(0, core_1.Entity)({ tableName }),
|
|
100
|
+
(0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
|
|
56
101
|
], PriceListRuleValue);
|
|
57
102
|
exports.default = PriceListRuleValue;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
1
2
|
import { Collection, OptionalProps } from "@mikro-orm/core";
|
|
2
3
|
import PriceList from "./price-list";
|
|
3
4
|
import PriceListRuleValue from "./price-list-rule-value";
|
|
4
5
|
import RuleType from "./rule-type";
|
|
5
|
-
type OptionalFields =
|
|
6
|
-
type OptionalRelations = "rule_type" | "price_list";
|
|
6
|
+
type OptionalFields = DAL.SoftDeletableEntityDateColumns;
|
|
7
7
|
export default class PriceListRule {
|
|
8
|
-
[OptionalProps]: OptionalFields
|
|
8
|
+
[OptionalProps]: OptionalFields;
|
|
9
9
|
id: string;
|
|
10
|
+
rule_type_id: string;
|
|
10
11
|
rule_type: RuleType;
|
|
11
12
|
price_list_rule_values: Collection<PriceListRuleValue, object>;
|
|
13
|
+
price_list_id: string;
|
|
12
14
|
price_list: PriceList;
|
|
15
|
+
created_at: Date;
|
|
16
|
+
updated_at: Date;
|
|
17
|
+
deleted_at: Date | null;
|
|
13
18
|
beforeCreate(): void;
|
|
14
19
|
onInit(): void;
|
|
15
20
|
}
|
|
@@ -12,20 +12,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const core_1 = require("@mikro-orm/core");
|
|
16
15
|
const utils_1 = require("@medusajs/utils");
|
|
16
|
+
const core_1 = require("@mikro-orm/core");
|
|
17
17
|
const price_list_1 = __importDefault(require("./price-list"));
|
|
18
18
|
const price_list_rule_value_1 = __importDefault(require("./price-list-rule-value"));
|
|
19
19
|
const rule_type_1 = __importDefault(require("./rule-type"));
|
|
20
|
+
const tableName = "price_list_rule";
|
|
21
|
+
const PriceListRuleDeletedAtIndex = (0, utils_1.createPsqlIndexStatementHelper)({
|
|
22
|
+
tableName: tableName,
|
|
23
|
+
columns: "deleted_at",
|
|
24
|
+
where: "deleted_at IS NOT NULL",
|
|
25
|
+
});
|
|
26
|
+
const PriceListRuleRuleTypeIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
|
|
27
|
+
tableName: tableName,
|
|
28
|
+
columns: "rule_type_id",
|
|
29
|
+
where: "deleted_at IS NULL",
|
|
30
|
+
unique: true,
|
|
31
|
+
});
|
|
32
|
+
const PriceListRulePriceListIdIndex = (0, utils_1.createPsqlIndexStatementHelper)({
|
|
33
|
+
tableName: tableName,
|
|
34
|
+
columns: "price_list_id",
|
|
35
|
+
where: "deleted_at IS NULL",
|
|
36
|
+
});
|
|
20
37
|
let PriceListRule = class PriceListRule {
|
|
21
38
|
constructor() {
|
|
22
39
|
this.price_list_rule_values = new core_1.Collection(this);
|
|
40
|
+
this.deleted_at = null;
|
|
23
41
|
}
|
|
24
42
|
beforeCreate() {
|
|
25
43
|
this.id = (0, utils_1.generateEntityId)(this.id, "plrule");
|
|
44
|
+
this.price_list_id ?? (this.price_list_id = this.price_list?.id);
|
|
45
|
+
this.rule_type_id ?? (this.rule_type_id = this.rule_type?.id);
|
|
26
46
|
}
|
|
27
47
|
onInit() {
|
|
28
48
|
this.id = (0, utils_1.generateEntityId)(this.id, "plrule");
|
|
49
|
+
this.price_list_id ?? (this.price_list_id = this.price_list?.id);
|
|
50
|
+
this.rule_type_id ?? (this.rule_type_id = this.rule_type?.id);
|
|
29
51
|
}
|
|
30
52
|
};
|
|
31
53
|
__decorate([
|
|
@@ -33,29 +55,60 @@ __decorate([
|
|
|
33
55
|
__metadata("design:type", String)
|
|
34
56
|
], PriceListRule.prototype, "id", void 0);
|
|
35
57
|
__decorate([
|
|
36
|
-
(
|
|
37
|
-
|
|
58
|
+
PriceListRuleRuleTypeIdIndex.MikroORMIndex(),
|
|
59
|
+
(0, core_1.ManyToOne)(() => rule_type_1.default, {
|
|
60
|
+
columnType: "text",
|
|
61
|
+
mapToPk: true,
|
|
38
62
|
fieldName: "rule_type_id",
|
|
39
|
-
name: "price_rule_rule_type_id_unique",
|
|
40
|
-
index: "IDX_price_list_rule_rule_type_id",
|
|
41
63
|
}),
|
|
64
|
+
__metadata("design:type", String)
|
|
65
|
+
], PriceListRule.prototype, "rule_type_id", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, core_1.ManyToOne)(() => rule_type_1.default, { persist: false }),
|
|
42
68
|
__metadata("design:type", rule_type_1.default)
|
|
43
69
|
], PriceListRule.prototype, "rule_type", void 0);
|
|
44
70
|
__decorate([
|
|
45
71
|
(0, core_1.OneToMany)(() => price_list_rule_value_1.default, (plrv) => plrv.price_list_rule, {
|
|
46
|
-
cascade: [core_1.Cascade.
|
|
72
|
+
cascade: [core_1.Cascade.PERSIST, "soft-remove"],
|
|
47
73
|
}),
|
|
48
74
|
__metadata("design:type", Object)
|
|
49
75
|
], PriceListRule.prototype, "price_list_rule_values", void 0);
|
|
50
76
|
__decorate([
|
|
51
|
-
(
|
|
52
|
-
|
|
77
|
+
PriceListRulePriceListIdIndex.MikroORMIndex(),
|
|
78
|
+
(0, core_1.ManyToOne)(() => price_list_1.default, {
|
|
79
|
+
columnType: "text",
|
|
80
|
+
mapToPk: true,
|
|
53
81
|
fieldName: "price_list_id",
|
|
54
|
-
|
|
55
|
-
index: "IDX_price_list_rule_price_list_id",
|
|
82
|
+
onDelete: "cascade",
|
|
56
83
|
}),
|
|
84
|
+
__metadata("design:type", String)
|
|
85
|
+
], PriceListRule.prototype, "price_list_id", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, core_1.ManyToOne)(() => price_list_1.default, { persist: false }),
|
|
57
88
|
__metadata("design:type", price_list_1.default)
|
|
58
89
|
], PriceListRule.prototype, "price_list", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, core_1.Property)({
|
|
92
|
+
onCreate: () => new Date(),
|
|
93
|
+
columnType: "timestamptz",
|
|
94
|
+
defaultRaw: "now()",
|
|
95
|
+
}),
|
|
96
|
+
__metadata("design:type", Date)
|
|
97
|
+
], PriceListRule.prototype, "created_at", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, core_1.Property)({
|
|
100
|
+
onCreate: () => new Date(),
|
|
101
|
+
onUpdate: () => new Date(),
|
|
102
|
+
columnType: "timestamptz",
|
|
103
|
+
defaultRaw: "now()",
|
|
104
|
+
}),
|
|
105
|
+
__metadata("design:type", Date)
|
|
106
|
+
], PriceListRule.prototype, "updated_at", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
PriceListRuleDeletedAtIndex.MikroORMIndex(),
|
|
109
|
+
(0, core_1.Property)({ columnType: "timestamptz", nullable: true }),
|
|
110
|
+
__metadata("design:type", Object)
|
|
111
|
+
], PriceListRule.prototype, "deleted_at", void 0);
|
|
59
112
|
__decorate([
|
|
60
113
|
(0, core_1.BeforeCreate)(),
|
|
61
114
|
__metadata("design:type", Function),
|
|
@@ -69,10 +122,7 @@ __decorate([
|
|
|
69
122
|
__metadata("design:returntype", void 0)
|
|
70
123
|
], PriceListRule.prototype, "onInit", null);
|
|
71
124
|
PriceListRule = __decorate([
|
|
72
|
-
(0, core_1.Entity)(),
|
|
73
|
-
(0, core_1.
|
|
74
|
-
name: "IDX_price_list_rule_rule_type_id_price_list_id_unique",
|
|
75
|
-
properties: ["price_list", "rule_type"],
|
|
76
|
-
})
|
|
125
|
+
(0, core_1.Entity)({ tableName }),
|
|
126
|
+
(0, core_1.Filter)(utils_1.DALUtils.mikroOrmSoftDeletableFilterOptions)
|
|
77
127
|
], PriceListRule);
|
|
78
128
|
exports.default = PriceListRule;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { DAL } from "@medusajs/types";
|
|
1
2
|
import { PriceListStatus, PriceListType } from "@medusajs/utils";
|
|
2
3
|
import { Collection, OptionalProps } from "@mikro-orm/core";
|
|
4
|
+
import Price from "./price";
|
|
3
5
|
import PriceListRule from "./price-list-rule";
|
|
4
|
-
import PriceSetMoneyAmount from "./price-set-money-amount";
|
|
5
6
|
import RuleType from "./rule-type";
|
|
6
|
-
type OptionalFields = "
|
|
7
|
-
|
|
7
|
+
type OptionalFields = "starts_at" | "ends_at" | DAL.SoftDeletableEntityDateColumns;
|
|
8
|
+
export declare const PriceListIdPrefix = "plist";
|
|
8
9
|
export default class PriceList {
|
|
9
|
-
[OptionalProps]: OptionalFields
|
|
10
|
+
[OptionalProps]: OptionalFields;
|
|
10
11
|
id: string;
|
|
11
12
|
title: string;
|
|
12
13
|
description: string;
|
|
@@ -14,10 +15,10 @@ export default class PriceList {
|
|
|
14
15
|
type: PriceListType;
|
|
15
16
|
starts_at: Date | null;
|
|
16
17
|
ends_at: Date | null;
|
|
17
|
-
|
|
18
|
+
prices: Collection<Price, object>;
|
|
18
19
|
price_list_rules: Collection<PriceListRule, object>;
|
|
19
20
|
rule_types: Collection<RuleType, object>;
|
|
20
|
-
rules_count
|
|
21
|
+
rules_count: number;
|
|
21
22
|
created_at: Date;
|
|
22
23
|
updated_at: Date;
|
|
23
24
|
deleted_at: Date | null;
|