/schemas/Note

This commit is contained in:
tamaina 2023-05-02 16:51:41 +00:00
parent 6c53d1fdb7
commit 3fcee7c4bd
26 changed files with 184 additions and 191 deletions

View File

@ -1,4 +1,4 @@
import { localUsernameSchema, passwordSchema } from "./schema/user"; import { localUsernameSchema, passwordSchema } from "./schemas/user";
export type RolePolicies = { export type RolePolicies = {
gtlAvailable: boolean; gtlAvailable: boolean;

View File

@ -1,174 +0,0 @@
export const packedNoteSchema = {
type: 'object',
properties: {
id: {
type: 'string',
optional: false, nullable: false,
format: 'id',
example: 'xxxxxxxxxx',
},
createdAt: {
type: 'string',
optional: false, nullable: false,
format: 'date-time',
},
deletedAt: {
type: 'string',
optional: true, nullable: true,
format: 'date-time',
},
text: {
type: 'string',
optional: false, nullable: true,
},
cw: {
type: 'string',
optional: true, nullable: true,
},
userId: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
user: {
type: 'object',
ref: 'UserLite',
optional: false, nullable: false,
},
replyId: {
type: 'string',
optional: true, nullable: true,
format: 'id',
example: 'xxxxxxxxxx',
},
renoteId: {
type: 'string',
optional: true, nullable: true,
format: 'id',
example: 'xxxxxxxxxx',
},
reply: {
type: 'object',
optional: true, nullable: true,
ref: 'Note',
},
renote: {
type: 'object',
optional: true, nullable: true,
ref: 'Note',
},
isHidden: {
type: 'boolean',
optional: true, nullable: false,
},
visibility: {
type: 'string',
optional: false, nullable: false,
},
mentions: {
type: 'array',
optional: true, nullable: false,
items: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
visibleUserIds: {
type: 'array',
optional: true, nullable: false,
items: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
fileIds: {
type: 'array',
optional: true, nullable: false,
items: {
type: 'string',
optional: false, nullable: false,
format: 'id',
},
},
files: {
type: 'array',
optional: true, nullable: false,
items: {
type: 'object',
optional: false, nullable: false,
ref: 'DriveFile',
},
},
tags: {
type: 'array',
optional: true, nullable: false,
items: {
type: 'string',
optional: false, nullable: false,
},
},
poll: {
type: 'object',
optional: true, nullable: true,
},
channelId: {
type: 'string',
optional: true, nullable: true,
format: 'id',
example: 'xxxxxxxxxx',
},
channel: {
type: 'object',
optional: true, nullable: true,
items: {
type: 'object',
optional: false, nullable: false,
properties: {
id: {
type: 'string',
optional: false, nullable: false,
},
name: {
type: 'string',
optional: false, nullable: true,
},
},
},
},
localOnly: {
type: 'boolean',
optional: true, nullable: false,
},
reactionAcceptance: {
type: 'string',
optional: false, nullable: true,
},
reactions: {
type: 'object',
optional: false, nullable: false,
},
renoteCount: {
type: 'number',
optional: false, nullable: false,
},
repliesCount: {
type: 'number',
optional: false, nullable: false,
},
uri: {
type: 'string',
optional: true, nullable: false,
},
url: {
type: 'string',
optional: true, nullable: false,
},
myReaction: {
type: 'object',
optional: true, nullable: true,
},
},
} as const;

View File

@ -1,4 +1,6 @@
export const packedAntennaSchema = { export const packedAntennaSchema = {
$id: '/schemas/Antenna',
type: 'object', type: 'object',
properties: { properties: {
id: { id: {
@ -69,21 +71,21 @@ export const packedAntennaSchema = {
type: 'boolean', type: 'boolean',
default: false, default: false,
}, },
required: [
'id',
'createdAt',
'name',
'keywords',
'excludeKeywords',
'src',
'userListId',
'users',
'caseSensitive',
'notify',
'withReplies',
'withFile',
'isActive',
'hasUnreadNote',
],
}, },
required: [
'id',
'createdAt',
'name',
'keywords',
'excludeKeywords',
'src',
'userListId',
'users',
'caseSensitive',
'notify',
'withReplies',
'withFile',
'isActive',
'hasUnreadNote',
],
} as const; } as const;

View File

@ -0,0 +1,6 @@
export const IdSchema = {
$id: '/schemas/Id',
type: 'string',
format: 'id',
example: 'xxxxxxxxxx',
};

View File

@ -0,0 +1,159 @@
export const packedNoteSchema = {
$id: '/schemas/Note',
type: 'object',
properties: {
id: {
type: 'string',
$ref: '/schemas/Id',
},
createdAt: {
type: 'string',
format: 'date-time',
},
deletedAt: {
oneOf: [{
type: 'string',
format: 'date-time',
}, { type: 'null' }],
},
text: {
type: 'string',
optional: false, nullable: true,
},
cw: {
oneOf: [{ type: 'string' }, { type: 'null' }],
},
userId: {
type: 'string',
$ref: '/schemas/Id',
},
user: {
type: 'object',
$ref: '/schemas/UserLite',
},
replyId: {
oneOf: [{
type: 'string',
$ref: '/schemas/Id',
}, { type: 'null' }],
},
renoteId: {
oneOf: [{
type: 'string',
$ref: '/schemas/Id',
}, { type: 'null' }],
},
reply: {
oneOf: [{
$ref: '/schemas/Note',
}, { type: 'null' }],
},
renote: {
oneOf: [{
$ref: '/schemas/Note',
}, { type: 'null' }],
},
isHidden: {
type: 'boolean',
},
visibility: {
type: 'string',
},
mentions: {
type: 'array',
items: {
type: 'string',
$ref: '/schemas/Id',
},
},
visibleUserIds: {
type: 'array',
items: {
type: 'string',
$ref: '/schemas/Id',
},
},
fileIds: {
type: 'array',
items: {
type: 'string',
$ref: '/schemas/Id',
},
},
files: {
type: 'array',
items: {
$ref: '/schemas/DriveFile',
},
},
tags: {
type: 'array',
items: {
type: 'string',
},
},
poll: {
oneOf: [{
type: 'object',
$ref: '/schemas/Poll',
}, { type: 'null' }],
},
channelId: {
oneOf: [{
type: 'string',
$ref: '/schemas/Id',
}, { type: 'null' }],
},
channel: {
oneOf: [{
type: 'object',
properties: {
id: { type: 'string' },
name: { type: 'string' },
color: { type: 'string' },
},
required: ['id', 'name', 'color'],
}, { type: 'null' }],
},
localOnly: {
type: 'boolean',
},
reactionAcceptance: {
oneOf: [{
enum: ['likeOnly', 'likeOnlyForRemote']
}, { type: 'null' }],
},
reactions: {
type: 'object',
},
renoteCount: {
type: 'number',
optional: false, nullable: false,
},
repliesCount: {
type: 'number',
},
uri: {
type: 'string',
},
url: {
type: 'string',
},
myReaction: {
type: 'object',
},
},
required: [
'id',
'createdAt',
'text',
'userId',
'user',
'visibility',
'reactionAcceptance',
'reactions',
'renoteCount',
'repliesCount',
],
} as const;