|
1
|
import { model } from "@medusajs/framework/utils" |
|
2
|
|
|
3
|
/** |
|
4
|
* PropertyLabel stores custom display labels for entity properties. |
|
5
|
* Labels are global (shared across all admin users) and provide |
|
6
|
* consistent terminology throughout the admin interface. |
|
7
|
*/ |
|
8
|
export const PropertyLabel = model |
|
9
|
.define("property_label", { |
|
10
|
id: model.id({ prefix: "plbl" }).primaryKey(), |
|
11
|
/** |
|
12
|
* The entity this label applies to (e.g., "Order", "Product") |
|
13
|
*/ |
|
14
|
entity: model.text().searchable(), |
|
15
|
/** |
|
16
|
* The property path (e.g., "display_id", "customer.email") |
|
17
|
*/ |
|
18
|
property: model.text().searchable(), |
|
19
|
/** |
|
20
|
* Custom display name for the property |
|
21
|
*/ |
|
22
|
label: model.text().translatable(), |
|
23
|
/** |
|
24
|
* Optional description providing context about the property |
|
25
|
*/ |
|
26
|
description: model.text().translatable().nullable(), |
|
27
|
}) |
|
28
|
.indexes([ |
|
29
|
{ |
|
30
|
on: ["entity", "property"], |
|
31
|
unique: true, |
|
32
|
}, |
|
33
|
{ |
|
34
|
on: ["entity"], |
|
35
|
}, |
|
36
|
]) |