Use as const

#5089
This commit is contained in:
syuilo 2019-06-27 18:04:09 +09:00
parent 6b897e562a
commit 952789cc1e
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
102 changed files with 853 additions and 966 deletions

View file

@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm';
import { App } from '../entities/app';
import { AccessTokens } from '..';
import { ensure } from '../../prelude/ensure';
import { types, bool, SchemaType } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedApp = SchemaType<typeof packedAppSchema>;
@ -42,37 +42,37 @@ export class AppRepository extends Repository<App> {
}
export const packedAppSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this Note.',
example: 'xxxxxxxxxx',
},
name: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
description: 'アプリケーションの名前'
},
callbackUrl: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
description: 'コールバックするURL'
},
permission: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
}
},
secret: {
type: types.string,
optional: bool.true, nullable: bool.false,
type: 'string' as const,
optional: true as const, nullable: false as const,
description: 'アプリケーションのシークレットキー'
}
},

View file

@ -3,7 +3,7 @@ import { Users } from '..';
import { Blocking } from '../entities/blocking';
import { ensure } from '../../prelude/ensure';
import { awaitAll } from '../../prelude/await-all';
import { SchemaType, types, bool } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedBlocking = SchemaType<typeof packedBlockingSchema>;
@ -34,30 +34,30 @@ export class BlockingRepository extends Repository<Blocking> {
}
export const packedBlockingSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this blocking.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the blocking was created.'
},
blockeeId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
blockee: {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'User',
description: 'The blockee.'
},

View file

@ -5,7 +5,7 @@ import { User } from '../entities/user';
import { toPuny } from '../../misc/convert-host';
import { ensure } from '../../prelude/ensure';
import { awaitAll } from '../../prelude/await-all';
import { types, bool, SchemaType } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedDriveFile = SchemaType<typeof packedDriveFileSchema>;
@ -114,63 +114,63 @@ export class DriveFileRepository extends Repository<DriveFile> {
}
export const packedDriveFileSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this Drive file.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the Drive file was created on Misskey.'
},
name: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
description: 'The file name with extension.',
example: 'lenna.jpg'
},
type: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
description: 'The MIME type of this Drive file.',
example: 'image/jpeg'
},
md5: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'md5',
description: 'The MD5 hash of this Drive file.',
example: '15eca7fba0480996e2245f5185bf39f2'
},
size: {
type: types.number,
optional: bool.false, nullable: bool.false,
type: 'number' as const,
optional: false as const, nullable: false as const,
description: 'The size of this Drive file. (bytes)',
example: 51469
},
url: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
format: 'url',
description: 'The URL of this Drive file.',
},
folderId: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
format: 'id',
description: 'The parent folder ID of this Drive file.',
example: 'xxxxxxxxxx',
},
isSensitive: {
type: types.boolean,
optional: bool.false, nullable: bool.false,
type: 'boolean' as const,
optional: false as const, nullable: false as const,
description: 'Whether this Drive file is sensitive.',
},
},

View file

@ -3,7 +3,7 @@ import { DriveFolders, DriveFiles } from '..';
import { DriveFolder } from '../entities/drive-folder';
import { ensure } from '../../prelude/ensure';
import { awaitAll } from '../../prelude/await-all';
import { SchemaType, types, bool } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedDriveFolder = SchemaType<typeof packedDriveFolderSchema>;
@ -53,47 +53,47 @@ export class DriveFolderRepository extends Repository<DriveFolder> {
}
export const packedDriveFolderSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this Drive folder.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the Drive folder was created.'
},
name: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
description: 'The folder name.',
},
foldersCount: {
type: types.number,
optional: bool.true, nullable: bool.false,
type: 'number' as const,
optional: true as const, nullable: false as const,
description: 'The count of child folders.',
},
filesCount: {
type: types.number,
optional: bool.true, nullable: bool.false,
type: 'number' as const,
optional: true as const, nullable: false as const,
description: 'The count of child files.',
},
parentId: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
format: 'id',
description: 'The parent folder ID of this folder.',
example: 'xxxxxxxxxx',
},
parent: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'DriveFolder'
},
},

View file

@ -3,7 +3,7 @@ import { Users } from '..';
import { Following } from '../entities/following';
import { ensure } from '../../prelude/ensure';
import { awaitAll } from '../../prelude/await-all';
import { SchemaType, types, bool } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
type LocalFollowerFollowing = Following & {
followerHost: null;
@ -88,41 +88,41 @@ export class FollowingRepository extends Repository<Following> {
}
export const packedFollowingSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this following.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the following was created.'
},
followeeId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
followee: {
type: types.object,
optional: bool.true, nullable: bool.false,
type: 'object' as const,
optional: true as const, nullable: false as const,
ref: 'User',
description: 'The followee.'
},
followerId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
follower: {
type: types.object,
optional: bool.true, nullable: bool.false,
type: 'object' as const,
optional: true as const, nullable: false as const,
ref: 'User',
description: 'The follower.'
},

View file

@ -1,6 +1,6 @@
import { EntityRepository, Repository } from 'typeorm';
import { Hashtag } from '../entities/hashtag';
import { SchemaType, types, bool } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedHashtag = SchemaType<typeof packedHashtagSchema>;
@ -28,43 +28,43 @@ export class HashtagRepository extends Repository<Hashtag> {
}
export const packedHashtagSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
tag: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
description: 'The hashtag name. No # prefixed.',
example: 'misskey',
},
mentionedUsersCount: {
type: types.number,
optional: bool.false, nullable: bool.false,
type: 'number' as const,
optional: false as const, nullable: false as const,
description: 'Number of all users using this hashtag.'
},
mentionedLocalUsersCount: {
type: types.number,
optional: bool.false, nullable: bool.false,
type: 'number' as const,
optional: false as const, nullable: false as const,
description: 'Number of local users using this hashtag.'
},
mentionedRemoteUsersCount: {
type: types.number,
optional: bool.false, nullable: bool.false,
type: 'number' as const,
optional: false as const, nullable: false as const,
description: 'Number of remote users using this hashtag.'
},
attachedUsersCount: {
type: types.number,
optional: bool.false, nullable: bool.false,
type: 'number' as const,
optional: false as const, nullable: false as const,
description: 'Number of all users who attached this hashtag to profile.'
},
attachedLocalUsersCount: {
type: types.number,
optional: bool.false, nullable: bool.false,
type: 'number' as const,
optional: false as const, nullable: false as const,
description: 'Number of local users who attached this hashtag to profile.'
},
attachedRemoteUsersCount: {
type: types.number,
optional: bool.false, nullable: bool.false,
type: 'number' as const,
optional: false as const, nullable: false as const,
description: 'Number of remote users who attached this hashtag to profile.'
},
}

View file

@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm';
import { MessagingMessage } from '../entities/messaging-message';
import { Users, DriveFiles, UserGroups } from '..';
import { ensure } from '../../prelude/ensure';
import { types, bool, SchemaType } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedMessagingMessage = SchemaType<typeof packedMessagingMessageSchema>;
@ -46,76 +46,76 @@ export class MessagingMessageRepository extends Repository<MessagingMessage> {
}
export const packedMessagingMessageSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this MessagingMessage.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the MessagingMessage was created.'
},
userId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
user: {
type: types.object,
type: 'object' as const,
ref: 'User',
optional: bool.true, nullable: bool.false,
optional: true as const, nullable: false as const,
},
text: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
},
fileId: {
type: types.string,
optional: bool.true, nullable: bool.true,
type: 'string' as const,
optional: true as const, nullable: true as const,
format: 'id',
},
file: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'DriveFile',
},
recipientId: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
format: 'id',
},
recipient: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'User'
},
groupId: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
format: 'id',
},
group: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'UserGroup'
},
isRead: {
type: types.boolean,
optional: bool.true, nullable: bool.false,
type: 'boolean' as const,
optional: true as const, nullable: false as const,
},
reads: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
}
},

View file

@ -3,7 +3,7 @@ import { Users } from '..';
import { Muting } from '../entities/muting';
import { ensure } from '../../prelude/ensure';
import { awaitAll } from '../../prelude/await-all';
import { types, bool, SchemaType } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedMuting = SchemaType<typeof packedMutingSchema>;
@ -34,30 +34,30 @@ export class MutingRepository extends Repository<Muting> {
}
export const packedMutingSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this muting.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the muting was created.'
},
muteeId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
mutee: {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'User',
description: 'The mutee.'
},

View file

@ -2,7 +2,6 @@ import { EntityRepository, Repository } from 'typeorm';
import { NoteFavorite } from '../entities/note-favorite';
import { Notes } from '..';
import { ensure } from '../../prelude/ensure';
import { types, bool } from '../../misc/schema';
@EntityRepository(NoteFavorite)
export class NoteFavoriteRepository extends Repository<NoteFavorite> {
@ -29,30 +28,30 @@ export class NoteFavoriteRepository extends Repository<NoteFavorite> {
}
export const packedNoteFavoriteSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this favorite.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the favorite was created.'
},
note: {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'Note',
},
noteId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
},

View file

@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm';
import { NoteReaction } from '../entities/note-reaction';
import { Users } from '..';
import { ensure } from '../../prelude/ensure';
import { types, bool, SchemaType } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedNoteReaction = SchemaType<typeof packedNoteReactionSchema>;
@ -24,31 +24,31 @@ export class NoteReactionRepository extends Repository<NoteReaction> {
}
export const packedNoteReactionSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this reaction.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the reaction was created.'
},
user: {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'User',
description: 'User who performed this reaction.'
},
type: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
description: 'The reaction type.'
},
},

View file

@ -5,7 +5,7 @@ import { unique, concat } from '../../prelude/array';
import { nyaize } from '../../misc/nyaize';
import { Emojis, Users, Apps, PollVotes, DriveFiles, NoteReactions, Followings, Polls } from '..';
import { ensure } from '../../prelude/ensure';
import { SchemaType, types, bool } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
import { awaitAll } from '../../prelude/await-all';
export type PackedNote = SchemaType<typeof packedNoteSchema>;
@ -218,125 +218,125 @@ export class NoteRepository extends Repository<Note> {
}
export const packedNoteSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this Note.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the Note was created on Misskey.'
},
text: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
},
cw: {
type: types.string,
optional: bool.true, nullable: bool.true,
type: 'string' as const,
optional: true as const, nullable: true as const,
},
userId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
user: {
type: types.object,
type: 'object' as const,
ref: 'User',
optional: bool.false, nullable: bool.false,
optional: false as const, nullable: false as const,
},
replyId: {
type: types.string,
optional: bool.true, nullable: bool.true,
type: 'string' as const,
optional: true as const, nullable: true as const,
format: 'id',
example: 'xxxxxxxxxx',
},
renoteId: {
type: types.string,
optional: bool.true, nullable: bool.true,
type: 'string' as const,
optional: true as const, nullable: true as const,
format: 'id',
example: 'xxxxxxxxxx',
},
reply: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'Note'
},
renote: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
ref: 'Note'
},
viaMobile: {
type: types.boolean,
optional: bool.true, nullable: bool.false,
type: 'boolean' as const,
optional: true as const, nullable: false as const,
},
isHidden: {
type: types.boolean,
optional: bool.true, nullable: bool.false,
type: 'boolean' as const,
optional: true as const, nullable: false as const,
},
visibility: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
},
mentions: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
}
},
visibleUserIds: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
}
},
fileIds: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id'
}
},
files: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
ref: 'DriveFile'
}
},
tags: {
type: types.array,
optional: bool.true, nullable: bool.false,
type: 'array' as const,
optional: true as const, nullable: false as const,
items: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
}
},
poll: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
},
geo: {
type: types.object,
optional: bool.true, nullable: bool.true,
type: 'object' as const,
optional: true as const, nullable: true as const,
},
},
};

View file

@ -3,7 +3,7 @@ import { Users, Notes } from '..';
import { Notification } from '../entities/notification';
import { ensure } from '../../prelude/ensure';
import { awaitAll } from '../../prelude/await-all';
import { types, bool, SchemaType } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedNotification = SchemaType<typeof packedNotificationSchema>;
@ -51,37 +51,37 @@ export class NotificationRepository extends Repository<Notification> {
}
export const packedNotificationSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this notification.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the notification was created.'
},
type: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
enum: ['follow', 'receiveFollowRequest', 'mention', 'reply', 'renote', 'quote', 'reaction', 'pollVote'],
description: 'The type of the notification.'
},
userId: {
type: types.string,
optional: bool.true, nullable: bool.true,
type: 'string' as const,
optional: true as const, nullable: true as const,
format: 'id',
},
user: {
type: types.object,
type: 'object' as const,
ref: 'User',
optional: bool.true, nullable: bool.true,
optional: true as const, nullable: true as const,
},
}
};

View file

@ -1,6 +1,6 @@
import { EntityRepository, Repository } from 'typeorm';
import { Page } from '../entities/page';
import { SchemaType, types, bool } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
import { Users, DriveFiles, PageLikes } from '..';
import { awaitAll } from '../../prelude/await-all';
import { DriveFile } from '../entities/drive-file';
@ -89,54 +89,54 @@ export class PageRepository extends Repository<Page> {
}
export const packedPageSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
},
updatedAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
},
title: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
},
name: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
},
summary: {
type: types.string,
optional: bool.false, nullable: bool.true,
type: 'string' as const,
optional: false as const, nullable: true as const,
},
content: {
type: types.array,
optional: bool.false, nullable: bool.false,
type: 'array' as const,
optional: false as const, nullable: false as const,
},
variables: {
type: types.array,
optional: bool.false, nullable: bool.false,
type: 'array' as const,
optional: false as const, nullable: false as const,
},
userId: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
},
user: {
type: types.object,
type: 'object' as const,
ref: 'User',
optional: bool.false, nullable: bool.false,
optional: false as const, nullable: false as const,
},
}
};

View file

@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm';
import { UserGroup } from '../entities/user-group';
import { ensure } from '../../prelude/ensure';
import { UserGroupJoinings } from '..';
import { bool, types, SchemaType } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedUserGroup = SchemaType<typeof packedUserGroupSchema>;
@ -28,38 +28,38 @@ export class UserGroupRepository extends Repository<UserGroup> {
}
export const packedUserGroupSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this UserGroup.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the UserGroup was created.'
},
name: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
description: 'The name of the UserGroup.'
},
ownerId: {
type: types.string,
nullable: bool.false, optional: bool.false,
type: 'string' as const,
nullable: false as const, optional: false as const,
format: 'id',
},
userIds: {
type: types.array,
nullable: bool.false, optional: bool.true,
type: 'array' as const,
nullable: false as const, optional: true as const,
items: {
type: types.string,
nullable: bool.false, optional: bool.false,
type: 'string' as const,
nullable: false as const, optional: false as const,
format: 'id',
}
},

View file

@ -2,7 +2,7 @@ import { EntityRepository, Repository } from 'typeorm';
import { UserList } from '../entities/user-list';
import { ensure } from '../../prelude/ensure';
import { UserListJoinings } from '..';
import { bool, types, SchemaType } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
export type PackedUserList = SchemaType<typeof packedUserListSchema>;
@ -27,33 +27,33 @@ export class UserListRepository extends Repository<UserList> {
}
export const packedUserListSchema = {
type: types.object,
optional: bool.false, nullable: bool.false,
type: 'object' as const,
optional: false as const, nullable: false as const,
properties: {
id: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'id',
description: 'The unique identifier for this UserList.',
example: 'xxxxxxxxxx',
},
createdAt: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
format: 'date-time',
description: 'The date that the UserList was created.'
},
name: {
type: types.string,
optional: bool.false, nullable: bool.false,
type: 'string' as const,
optional: false as const, nullable: false as const,
description: 'The name of the UserList.'
},
userIds: {
type: types.array,
nullable: bool.false, optional: bool.true,
type: 'array' as const,
nullable: false as const, optional: true as const,
items: {
type: types.string,
nullable: bool.false, optional: bool.false,
type: 'string' as const,
nullable: false as const, optional: false as const,
format: 'id',
}
},

View file

@ -4,7 +4,7 @@ import { User, ILocalUser, IRemoteUser } from '../entities/user';
import { Emojis, Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserGroupJoinings } from '..';
import { ensure } from '../../prelude/ensure';
import config from '../../config';
import { SchemaType, bool, types } from '../../misc/schema';
import { SchemaType } from '../../misc/schema';
import { awaitAll } from '../../prelude/await-all';
export type PackedUser = SchemaType<typeof packedUserSchema>;
@ -243,150 +243,150 @@ export class UserRepository extends Repository<User> {
}
export const packedUserSchema = {
type: types.object,
nullable: bool.false, optional: bool.false,
type: 'object' as const,
nullable: false as const, optional: false as const,
properties: {
id: {
type: types.string,
nullable: bool.false, optional: bool.false,
type: 'string' as const,
nullable: false as const, optional: false as const,
format: 'id',
description: 'The unique identifier for this User.',
example: 'xxxxxxxxxx',
},
username: {
type: types.string,
nullable: bool.false, optional: bool.false,
type: 'string' as const,
nullable: false as const, optional: false as const,
description: 'The screen name, handle, or alias that this user identifies themselves with.',
example: 'ai'
},
name: {
type: types.string,
nullable: bool.true, optional: bool.false,
type: 'string' as const,
nullable: true as const, optional: false as const,
description: 'The name of the user, as theyve defined it.',
example: '藍'
},
url: {
type: types.string,
type: 'string' as const,
format: 'url',
nullable: bool.true, optional: bool.true,
nullable: true as const, optional: true as const,
},
avatarUrl: {
type: types.string,
type: 'string' as const,
format: 'url',
nullable: bool.true, optional: bool.false,
nullable: true as const, optional: false as const,
},
avatarColor: {
type: types.any,
nullable: bool.true, optional: bool.false,
type: 'any' as const,
nullable: true as const, optional: false as const,
},
bannerUrl: {
type: types.string,
type: 'string' as const,
format: 'url',
nullable: bool.true, optional: bool.true,
nullable: true as const, optional: true as const,
},
bannerColor: {
type: types.any,
nullable: bool.true, optional: bool.true,
type: 'any' as const,
nullable: true as const, optional: true as const,
},
emojis: {
type: types.any,
nullable: bool.true, optional: bool.false,
type: 'any' as const,
nullable: true as const, optional: false as const,
},
host: {
type: types.string,
nullable: bool.true, optional: bool.false,
type: 'string' as const,
nullable: true as const, optional: false as const,
example: 'misskey.example.com'
},
description: {
type: types.string,
nullable: bool.true, optional: bool.true,
type: 'string' as const,
nullable: true as const, optional: true as const,
description: 'The user-defined UTF-8 string describing their account.',
example: 'Hi masters, I am Ai!'
},
birthday: {
type: types.string,
nullable: bool.true, optional: bool.true,
type: 'string' as const,
nullable: true as const, optional: true as const,
example: '2018-03-12'
},
createdAt: {
type: types.string,
nullable: bool.false, optional: bool.true,
type: 'string' as const,
nullable: false as const, optional: true as const,
format: 'date-time',
description: 'The date that the user account was created on Misskey.'
},
updatedAt: {
type: types.string,
nullable: bool.true, optional: bool.true,
type: 'string' as const,
nullable: true as const, optional: true as const,
format: 'date-time',
},
location: {
type: types.string,
nullable: bool.true, optional: bool.true,
type: 'string' as const,
nullable: true as const, optional: true as const,
},
followersCount: {
type: types.number,
nullable: bool.false, optional: bool.true,
type: 'number' as const,
nullable: false as const, optional: true as const,
description: 'The number of followers this account currently has.'
},
followingCount: {
type: types.number,
nullable: bool.false, optional: bool.true,
type: 'number' as const,
nullable: false as const, optional: true as const,
description: 'The number of users this account is following.'
},
notesCount: {
type: types.number,
nullable: bool.false, optional: bool.true,
type: 'number' as const,
nullable: false as const, optional: true as const,
description: 'The number of Notes (including renotes) issued by the user.'
},
isBot: {
type: types.boolean,
nullable: bool.false, optional: bool.true,
type: 'boolean' as const,
nullable: false as const, optional: true as const,
description: 'Whether this account is a bot.'
},
pinnedNoteIds: {
type: types.array,
nullable: bool.false, optional: bool.true,
type: 'array' as const,
nullable: false as const, optional: true as const,
items: {
type: types.string,
nullable: bool.false, optional: bool.false,
type: 'string' as const,
nullable: false as const, optional: false as const,
format: 'id',
}
},
pinnedNotes: {
type: types.array,
nullable: bool.false, optional: bool.true,
type: 'array' as const,
nullable: false as const, optional: true as const,
items: {
type: types.object,
nullable: bool.false, optional: bool.false,
type: 'object' as const,
nullable: false as const, optional: false as const,
ref: 'Note'
}
},
isCat: {
type: types.boolean,
nullable: bool.false, optional: bool.true,
type: 'boolean' as const,
nullable: false as const, optional: true as const,
description: 'Whether this account is a cat.'
},
isAdmin: {
type: types.boolean,
nullable: bool.false, optional: bool.true,
type: 'boolean' as const,
nullable: false as const, optional: true as const,
description: 'Whether this account is the admin.'
},
isModerator: {
type: types.boolean,
nullable: bool.false, optional: bool.true,
type: 'boolean' as const,
nullable: false as const, optional: true as const,
description: 'Whether this account is a moderator.'
},
isLocked: {
type: types.boolean,
nullable: bool.false, optional: bool.true,
type: 'boolean' as const,
nullable: false as const, optional: true as const,
},
hasUnreadSpecifiedNotes: {
type: types.boolean,
nullable: bool.false, optional: bool.true,
type: 'boolean' as const,
nullable: false as const, optional: true as const,
},
hasUnreadMentions: {
type: types.boolean,
nullable: bool.false, optional: bool.true,
type: 'boolean' as const,
nullable: false as const, optional: true as const,
},
},
};