|
1
|
import { model } from "@medusajs/framework/utils" |
|
2
|
|
|
3
|
import { ShippingOption } from "./shipping-option" |
|
4
|
|
|
5
|
export const ShippingProfile = model |
|
6
|
.define("shipping_profile", { |
|
7
|
id: model.id({ prefix: "sp" }).primaryKey(), |
|
8
|
name: model.text(), |
|
9
|
type: model.text(), |
|
10
|
shipping_options: model.hasMany(() => ShippingOption, { |
|
11
|
mappedBy: "shipping_profile", |
|
12
|
}), |
|
13
|
metadata: model.json().nullable(), |
|
14
|
}) |
|
15
|
.indexes([ |
|
16
|
{ |
|
17
|
on: ["name"], |
|
18
|
unique: true, |
|
19
|
where: "deleted_at IS NULL", |
|
20
|
}, |
|
21
|
]) |