directus

Форк
0
/
schemas.ts 
305 строк · 6.0 Кб
1
import type { CollectionsOverview, Relation } from '@directus/types';
2

3
export const systemSchema = {
4
	collections: {
5
		directus_users: {
6
			collection: 'directus_users',
7
			primary: 'id',
8
			singleton: false,
9
			note: '$t:directus_collection.directus_users',
10
			sortField: null,
11
			accountability: null,
12
			fields: {
13
				id: {
14
					field: 'id',
15
					defaultValue: null,
16
					nullable: false,
17
					generated: false,
18
					type: 'uuid',
19
					dbType: 'uuid',
20
					precision: null,
21
					scale: null,
22
					special: [],
23
					note: null,
24
					alias: false,
25
					validation: null,
26
				},
27
				name: {
28
					field: 'name',
29
					defaultValue: "A User's Name",
30
					nullable: false,
31
					generated: false,
32
					type: 'uuid',
33
					dbType: 'uuid',
34
					precision: null,
35
					scale: null,
36
					special: [],
37
					note: null,
38
					alias: false,
39
					validation: null,
40
				},
41
				items: {
42
					field: 'items',
43
					defaultValue: null,
44
					nullable: true,
45
					generated: false,
46
					type: 'alias',
47
					dbType: null,
48
					precision: null,
49
					scale: null,
50
					special: ['o2m'],
51
					note: null,
52
					alias: true,
53
					validation: null,
54
				},
55
			},
56
		},
57
		directus_files: {
58
			collection: 'directus_files',
59
			primary: 'id',
60
			singleton: false,
61
			note: '$t:directus_collection.directus_files',
62
			sortField: null,
63
			accountability: null,
64
			fields: {
65
				id: {
66
					field: 'id',
67
					defaultValue: null,
68
					nullable: false,
69
					generated: false,
70
					type: 'uuid',
71
					dbType: 'uuid',
72
					precision: null,
73
					scale: null,
74
					special: [],
75
					note: null,
76
					alias: false,
77
					validation: null,
78
				},
79
				title: {
80
					field: 'title',
81
					defaultValue: "A File's Title",
82
					nullable: false,
83
					generated: false,
84
					type: 'string',
85
					dbType: 'text',
86
					precision: null,
87
					scale: null,
88
					special: [],
89
					note: null,
90
					alias: false,
91
					validation: null,
92
				},
93
				uploaded_by: {
94
					field: 'uploaded_by',
95
					defaultValue: null,
96
					nullable: true,
97
					generated: false,
98
					type: 'uuid',
99
					dbType: 'uuid',
100
					precision: null,
101
					scale: null,
102
					special: [],
103
					note: null,
104
					alias: false,
105
					validation: null,
106
				},
107
			},
108
		},
109
	} as CollectionsOverview,
110
	relations: [
111
		{
112
			collection: 'directus_files',
113
			field: 'uploaded_by',
114
			related_collection: 'directus_users',
115
			schema: {
116
				table: 'directus_files',
117
				column: 'uploaded_by',
118
				foreign_key_table: 'directus_users',
119
				foreign_key_column: 'id',
120
				on_update: 'NO ACTION',
121
				on_delete: 'NO ACTION',
122
				constraint_name: null,
123
			},
124
			meta: {
125
				system: true,
126
				many_collection: 'directus_files',
127
				many_field: 'uploaded_by',
128
				one_collection: 'directus_users',
129
				one_field: 'items',
130
				one_allowed_collections: null,
131
				one_collection_field: null,
132
				one_deselect_action: 'nullify',
133
				junction_field: null,
134
				sort_field: null,
135
			},
136
		},
137
	] as Relation[],
138
};
139

140
export const userSchema = {
141
	collections: {
142
		authors: {
143
			collection: 'authors',
144
			primary: 'id',
145
			singleton: false,
146
			note: 'authors',
147
			sortField: null,
148
			accountability: null,
149
			fields: {
150
				id: {
151
					field: 'id',
152
					defaultValue: null,
153
					nullable: false,
154
					generated: false,
155
					type: 'uuid',
156
					dbType: 'uuid',
157
					precision: null,
158
					scale: null,
159
					special: [],
160
					note: null,
161
					alias: false,
162
					validation: null,
163
				},
164
				name: {
165
					field: 'name',
166
					defaultValue: "An Author's Name",
167
					nullable: false,
168
					generated: false,
169
					type: 'uuid',
170
					dbType: 'uuid',
171
					precision: null,
172
					scale: null,
173
					special: [],
174
					note: null,
175
					alias: false,
176
					validation: null,
177
				},
178
				items: {
179
					field: 'items',
180
					defaultValue: null,
181
					nullable: true,
182
					generated: false,
183
					type: 'alias',
184
					dbType: null,
185
					precision: null,
186
					scale: null,
187
					special: ['o2m'],
188
					note: null,
189
					alias: true,
190
					validation: null,
191
				},
192
			},
193
		},
194
		posts: {
195
			collection: 'posts',
196
			primary: 'id',
197
			singleton: false,
198
			note: 'posts',
199
			sortField: null,
200
			accountability: null,
201
			fields: {
202
				id: {
203
					field: 'id',
204
					defaultValue: null,
205
					nullable: false,
206
					generated: false,
207
					type: 'uuid',
208
					dbType: 'uuid',
209
					precision: null,
210
					scale: null,
211
					special: [],
212
					note: null,
213
					alias: false,
214
					validation: null,
215
				},
216
				title: {
217
					field: 'title',
218
					defaultValue: "A Post's Title",
219
					nullable: false,
220
					generated: false,
221
					type: 'string',
222
					dbType: 'text',
223
					precision: null,
224
					scale: null,
225
					special: [],
226
					note: null,
227
					alias: false,
228
					validation: null,
229
				},
230
				uploaded_by: {
231
					field: 'uploaded_by',
232
					defaultValue: null,
233
					nullable: true,
234
					generated: false,
235
					type: 'uuid',
236
					dbType: 'uuid',
237
					precision: null,
238
					scale: null,
239
					special: [],
240
					note: null,
241
					alias: false,
242
					validation: null,
243
				},
244
			},
245
		},
246
	} as CollectionsOverview,
247
	relations: [
248
		{
249
			collection: 'posts',
250
			field: 'uploaded_by',
251
			related_collection: 'authors',
252
			schema: {
253
				table: 'posts',
254
				column: 'uploaded_by',
255
				foreign_key_table: 'authors',
256
				foreign_key_column: 'id',
257
				on_update: 'NO ACTION',
258
				on_delete: 'SET NULL',
259
				constraint_name: null,
260
			},
261
			meta: {
262
				id: 11,
263
				many_collection: 'posts',
264
				many_field: 'uploaded_by',
265
				one_collection: 'authors',
266
				one_field: 'items',
267
				one_collection_field: null,
268
				one_allowed_collections: null,
269
				junction_field: null,
270
				sort_field: null,
271
				one_deselect_action: 'nullify',
272
			},
273
		},
274
	] as Relation[],
275
};
276

277
export const snapshotApplyTestSchema = {
278
	collections: {
279
		test_table: {
280
			collection: 'test_table',
281
			primary: 'id',
282
			singleton: false,
283
			note: 'test_table',
284
			sortField: null,
285
			accountability: 'all',
286
			fields: {
287
				id: {
288
					field: 'id',
289
					defaultValue: null,
290
					nullable: false,
291
					generated: false,
292
					type: 'uuid',
293
					dbType: 'uuid',
294
					precision: null,
295
					scale: null,
296
					special: [],
297
					note: null,
298
					alias: false,
299
					validation: null,
300
				},
301
			},
302
		},
303
	} as CollectionsOverview,
304
	relations: [] as Relation[],
305
};
306

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.