SchemaTypeの型計算量を削減 (#8332)
* schema typeの型計算量を削減 * reduce some type error * wip * fix * clean up * more shrink
This commit is contained in:
@ -65,5 +65,5 @@ export default define(meta, paramDef, async (ps) => {
|
||||
imageUrl: ps.imageUrl,
|
||||
}).then(x => Announcements.findOneOrFail(x.identifiers[0]));
|
||||
|
||||
return announcement;
|
||||
return Object.assign({}, announcement, { createdAt: announcement.createdAt.toISOString(), updatedAt: null });
|
||||
});
|
||||
|
@ -10,20 +10,24 @@ export const meta = {
|
||||
kind: 'read:gallery-likes',
|
||||
|
||||
res: {
|
||||
type: 'object',
|
||||
type: 'array',
|
||||
optional: false, nullable: false,
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'id',
|
||||
items: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'id',
|
||||
},
|
||||
post: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
ref: 'GalleryPost',
|
||||
},
|
||||
},
|
||||
page: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
ref: 'GalleryPost',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
@ -10,20 +10,23 @@ export const meta = {
|
||||
kind: 'read:page-likes',
|
||||
|
||||
res: {
|
||||
type: 'object',
|
||||
type: 'array',
|
||||
optional: false, nullable: false,
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'id',
|
||||
items: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
format: 'id',
|
||||
},
|
||||
page: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
ref: 'Page',
|
||||
},
|
||||
},
|
||||
page: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
ref: 'Page',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
} as const;
|
||||
|
||||
@ -47,5 +50,5 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
.take(ps.limit)
|
||||
.getMany();
|
||||
|
||||
return await PageLikes.packMany(likes, user);
|
||||
return PageLikes.packMany(likes, user);
|
||||
});
|
||||
|
@ -12,46 +12,7 @@ export const meta = {
|
||||
items: {
|
||||
type: 'object',
|
||||
optional: false, nullable: false,
|
||||
properties: {
|
||||
id: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
name: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
callbackUrl: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
permission: {
|
||||
type: 'array',
|
||||
optional: false, nullable: false,
|
||||
items: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
secret: {
|
||||
type: 'string',
|
||||
optional: true, nullable: false,
|
||||
},
|
||||
isAuthorized: {
|
||||
type: 'object',
|
||||
optional: true, nullable: false,
|
||||
properties: {
|
||||
appId: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
userId: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ref: 'App',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
@ -14,12 +14,12 @@ export const meta = {
|
||||
properties: {
|
||||
state: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
optional: true, nullable: false,
|
||||
enum: ['already-subscribed', 'subscribed'],
|
||||
},
|
||||
key: {
|
||||
type: 'string',
|
||||
optional: false, nullable: false,
|
||||
optional: false, nullable: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -49,7 +49,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
|
||||
if (exist != null) {
|
||||
return {
|
||||
state: 'already-subscribed',
|
||||
state: 'already-subscribed' as const,
|
||||
key: instance.swPublicKey,
|
||||
};
|
||||
}
|
||||
@ -64,7 +64,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
});
|
||||
|
||||
return {
|
||||
state: 'subscribed',
|
||||
state: 'subscribed' as const,
|
||||
key: instance.swPublicKey,
|
||||
};
|
||||
});
|
||||
|
@ -84,6 +84,7 @@ export interface MainStreamTypes {
|
||||
};
|
||||
driveFileCreated: Packed<'DriveFile'>;
|
||||
readAntenna: Antenna;
|
||||
receiveFollowRequest: Packed<'User'>;
|
||||
}
|
||||
|
||||
export interface DriveStreamTypes {
|
||||
|
Reference in New Issue
Block a user