|
1
|
import { model } from "@medusajs/framework/utils" |
|
2
|
import { Order } from "./order" |
|
3
|
|
|
4
|
const _OrderSummary = model |
|
5
|
.define( |
|
6
|
{ |
|
7
|
tableName: "order_summary", |
|
8
|
name: "OrderSummary", |
|
9
|
}, |
|
10
|
{ |
|
11
|
id: model.id({ prefix: "ordsum" }).primaryKey(), |
|
12
|
version: model.number().default(1), |
|
13
|
totals: model.json(), |
|
14
|
order: model.belongsTo<() => typeof Order>(() => Order, { |
|
15
|
mappedBy: "summary", |
|
16
|
}), |
|
17
|
} |
|
18
|
) |
|
19
|
.indexes([ |
|
20
|
{ |
|
21
|
name: "IDX_order_summary_order_id_version", |
|
22
|
on: ["order_id", "version"], |
|
23
|
unique: false, |
|
24
|
where: "deleted_at IS NULL", |
|
25
|
}, |
|
26
|
{ |
|
27
|
name: "IDX_order_summary_deleted_at", |
|
28
|
on: ["deleted_at"], |
|
29
|
unique: false, |
|
30
|
where: "deleted_at IS NOT NULL", |
|
31
|
}, |
|
32
|
]) |
|
33
|
|
|
34
|
export const OrderSummary = _OrderSummary |