summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/json-schema/drive-file.ts
blob: 5ee1561c50c4fe0bf6bd1ec6f04a23d333644ee8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

export const packedDriveFileSchema = {
	type: 'object',
	properties: {
		id: {
			type: 'string',
			optional: false, nullable: false,
			format: 'id',
			example: 'xxxxxxxxxx',
		},
		createdAt: {
			type: 'string',
			optional: false, nullable: false,
			format: 'date-time',
		},
		name: {
			type: 'string',
			optional: false, nullable: false,
			example: '192.jpg',
		},
		type: {
			type: 'string',
			optional: false, nullable: false,
			example: 'image/jpeg',
		},
		md5: {
			type: 'string',
			optional: false, nullable: false,
			format: 'md5',
			example: '15eca7fba0480996e2245f5185bf39f2',
		},
		size: {
			type: 'number',
			optional: false, nullable: false,
			example: 51469,
		},
		isSensitive: {
			type: 'boolean',
			optional: false, nullable: false,
		},
		blurhash: {
			type: 'string',
			optional: false, nullable: true,
		},
		properties: {
			type: 'object',
			optional: false, nullable: false,
			properties: {
				width: {
					type: 'number',
					optional: true, nullable: false,
					example: 1280,
				},
				height: {
					type: 'number',
					optional: true, nullable: false,
					example: 720,
				},
				orientation: {
					type: 'number',
					optional: true, nullable: false,
					example: 8,
				},
				avgColor: {
					type: 'string',
					optional: true, nullable: false,
					example: 'rgb(40,65,87)',
				},
			},
		},
		url: {
			type: 'string',
			optional: false, nullable: false,
			format: 'url',
		},
		thumbnailUrl: {
			type: 'string',
			optional: false, nullable: true,
			format: 'url',
		},
		comment: {
			type: 'string',
			optional: false, nullable: true,
		},
		folderId: {
			type: 'string',
			optional: false, nullable: true,
			format: 'id',
			example: 'xxxxxxxxxx',
		},
		folder: {
			type: 'object',
			optional: true, nullable: true,
			ref: 'DriveFolder',
		},
		userId: {
			type: 'string',
			optional: false, nullable: true,
			format: 'id',
			example: 'xxxxxxxxxx',
		},
		user: {
			type: 'object',
			optional: true, nullable: true,
			ref: 'UserLite',
		},
	},
} as const;