drive-file

This commit is contained in:
tamaina 2021-09-12 22:54:15 +09:00
parent 295ad35210
commit 59ac258272

View file

@ -4,14 +4,12 @@ import { Users, DriveFolders } from '../index';
import { User } from '@/models/entities/user'; import { User } from '@/models/entities/user';
import { toPuny } from '@/misc/convert-host'; import { toPuny } from '@/misc/convert-host';
import { awaitAll } from '@/prelude/await-all'; import { awaitAll } from '@/prelude/await-all';
import { SchemaType } from '@/misc/schema'; import { Packed } from '@/misc/schema';
import config from '@/config/index'; import config from '@/config/index';
import { query, appendQuery } from '@/prelude/url'; import { query, appendQuery } from '@/prelude/url';
import { Meta } from '@/models/entities/meta'; import { Meta } from '@/models/entities/meta';
import { fetchMeta } from '@/misc/fetch-meta'; import { fetchMeta } from '@/misc/fetch-meta';
export type PackedDriveFile = SchemaType<typeof packedDriveFileSchema>;
type PackOptions = { type PackOptions = {
detail?: boolean, detail?: boolean,
self?: boolean, self?: boolean,
@ -99,12 +97,12 @@ export class DriveFileRepository extends Repository<DriveFile> {
return parseInt(sum, 10) || 0; return parseInt(sum, 10) || 0;
} }
public async pack(src: DriveFile['id'], options?: PackOptions): Promise<PackedDriveFile | null>; public async pack(src: DriveFile['id'], options?: PackOptions): Promise<Packed<'DriveFile'> | null>;
public async pack(src: DriveFile, options?: PackOptions): Promise<PackedDriveFile>; public async pack(src: DriveFile, options?: PackOptions): Promise<Packed<'DriveFile'>>;
public async pack( public async pack(
src: DriveFile['id'] | DriveFile, src: DriveFile['id'] | DriveFile,
options?: PackOptions options?: PackOptions
): Promise<PackedDriveFile | null> { ): Promise<Packed<'DriveFile'> | null> {
const opts = Object.assign({ const opts = Object.assign({
detail: false, detail: false,
self: false self: false