Files
ncd-fe/packages/pl-api/lib/entities/drive-file.ts
nicole mikołajczyk ad00129411 pl-api: migrate to oxfmt+oxlint
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
2026-02-15 03:00:05 +01:00

34 lines
713 B
TypeScript

import * as v from 'valibot';
/**
* @category Schemas
*/
const driveFileSchema = v.pipe(
v.any(),
v.transform((file) => ({
...file,
thumbnail_url: file.thumbnailUrl,
content_type: file.contentType,
is_avatar: file.isAvatar,
is_banner: file.isBanner,
})),
v.object({
id: v.string(),
url: v.string(),
thumbnail_url: v.string(),
filename: v.string(),
content_type: v.string(),
sensitive: v.boolean(),
description: v.fallback(v.nullable(v.string()), null),
is_avatar: v.boolean(),
is_banner: v.boolean(),
}),
);
/**
* @category Entity types
*/
type DriveFile = v.InferOutput<typeof driveFileSchema>;
export { driveFileSchema, type DriveFile };