add schemas refs, fix Packed type

This commit is contained in:
tamaina 2021-09-12 22:12:48 +09:00
parent 96c79545db
commit e749b756a0

View file

@ -21,6 +21,9 @@ import { packedClipSchema } from '@/models/repositories/clip';
import { packedFederationInstanceSchema } from '@/models/repositories/federation-instance'; import { packedFederationInstanceSchema } from '@/models/repositories/federation-instance';
import { packedQueueCountSchema } from '@/models/repositories/queue'; import { packedQueueCountSchema } from '@/models/repositories/queue';
import { packedGalleryPostSchema } from '@/models/repositories/gallery-post'; import { packedGalleryPostSchema } from '@/models/repositories/gallery-post';
import { packedEmojiSchema } from '@/models/repositories/emoji';
import { packedReversiGameSchema } from '@/models/repositories/games/reversi/game';
import { packedReversiMatchingSchema } from '@/models/repositories/games/reversi/matching';
export const refs = { export const refs = {
User: packedUserSchema, User: packedUserSchema,
@ -45,11 +48,12 @@ export const refs = {
Clip: packedClipSchema, Clip: packedClipSchema,
FederationInstance: packedFederationInstanceSchema, FederationInstance: packedFederationInstanceSchema,
GalleryPost: packedGalleryPostSchema, GalleryPost: packedGalleryPostSchema,
Emoji: packedEmojiSchema,
ReversiGame: packedReversiGameSchema,
ReversiMatching: packedReversiMatchingSchema,
}; };
export type Packed<x extends keyof typeof refs> = PackRef<typeof refs[x]>; export type Packed<x extends keyof typeof refs> = ObjType<(typeof refs[x])['properties']>;
type PackRef<s extends { properties: Obj, [x: string]: any }> = { [x in keyof s['properties']]: SchemaType<s['properties'][x]> };
export interface Schema extends SimpleSchema { export interface Schema extends SimpleSchema {
items?: Schema; items?: Schema;