|
1
|
import { model } from "@medusajs/framework/utils" |
|
2
|
import StoreCurrency from "./currency" |
|
3
|
import StoreLocale from "./locale" |
|
4
|
|
|
5
|
const Store = model |
|
6
|
.define("Store", { |
|
7
|
id: model.id({ prefix: "store" }).primaryKey(), |
|
8
|
name: model.text().default("Medusa Store").searchable(), |
|
9
|
default_sales_channel_id: model.text().nullable(), |
|
10
|
default_region_id: model.text().nullable(), |
|
11
|
default_location_id: model.text().nullable(), |
|
12
|
metadata: model.json().nullable(), |
|
13
|
supported_currencies: model.hasMany(() => StoreCurrency, { |
|
14
|
mappedBy: "store", |
|
15
|
}), |
|
16
|
/** |
|
17
|
* The supported locales of the store. |
|
18
|
* |
|
19
|
* @since 2.12.3 |
|
20
|
*/ |
|
21
|
supported_locales: model.hasMany(() => StoreLocale, { |
|
22
|
mappedBy: "store", |
|
23
|
}), |
|
24
|
}) |
|
25
|
.cascades({ |
|
26
|
delete: ["supported_currencies", "supported_locales"], |
|
27
|
}) |
|
28
|
|
|
29
|
export default Store |