@@ -65,15 +65,20 @@ type Base = {}
65
65
* Model.
66
66
*/
67
67
export interface ModelOptions extends Base {
68
+ /**
69
+ * The name of the model.
70
+ *
71
+ * @default string - The file name of the model.
72
+ */
68
73
name : string // defaults to the file name of the model
69
- table : string // defaults to the lowercase, plural name of the model name (or the name of the model file)
74
+ table ? : string // defaults to the lowercase, plural name of the model name (or the name of the model file)
70
75
primaryKey ?: string // defaults to `id`
71
76
autoIncrement ?: boolean // defaults to true
72
77
dashboard ?: {
73
78
highlight ?: boolean | number // defaults to undefined
74
79
}
75
80
76
- traits : {
81
+ traits ? : {
77
82
useUuid ?: boolean // defaults to false
78
83
useTimestamps ?: boolean | TimestampOptions // defaults to true
79
84
timestampable ?: boolean | TimestampOptions // useTimestamps alias
@@ -91,44 +96,44 @@ export interface ModelOptions extends Base {
91
96
useActivityLog ?: boolean | ActivityLogOption
92
97
}
93
98
94
- attributes : Attributes
99
+ attributes ? : Attributes
95
100
96
101
// relationships
97
- hasOne :
102
+ hasOne ? :
98
103
| {
99
104
model : ModelNames
100
105
foreignKey ?: string
101
106
relationName ?: string
102
107
} [ ]
103
108
| string [ ]
104
- hasMany :
109
+ hasMany ? :
105
110
| {
106
111
model : ModelNames // should be typed as ModelName
107
112
foreignKey ?: string
108
113
relationName ?: string
109
114
} [ ]
110
115
| ModelNames [ ]
111
- belongsTo :
116
+ belongsTo ? :
112
117
| {
113
118
model : ModelNames // should be typed as ModelName
114
119
foreignKey ?: string
115
120
relationName ?: string
116
121
} [ ]
117
122
| ModelNames [ ] // belongsTo: 'User'
118
- belongsToMany : BelongsToManyType [ ] | ModelNames [ ]
119
- hasOneThrough : {
123
+ belongsToMany ? : BelongsToManyType [ ] | ModelNames [ ]
124
+ hasOneThrough ? : {
120
125
model : ModelNames
121
126
through : ModelNames
122
127
foreignKey ?: string
123
128
throughForeignKey ?: string
124
129
relationName ?: string
125
130
} [ ]
126
131
127
- get : {
132
+ get ? : {
128
133
[ key : string ] : ( value : any ) => any
129
134
}
130
135
131
- set : {
136
+ set ? : {
132
137
[ key : string ] : ( value : any ) => any
133
138
}
134
139
}
0 commit comments