el.xwx.moe/types/global.ts

42 lines
1.0 KiB
TypeScript
Raw Normal View History

2023-05-22 07:20:48 -05:00
import { Collection, Link, Tag, User } from "@prisma/client";
2023-05-26 23:11:29 -05:00
2023-05-27 11:53:02 -05:00
type OptionalExcluding<T, TRequired extends keyof T> = Partial<T> &
2023-05-26 23:11:29 -05:00
Pick<T, TRequired>;
2023-03-05 15:03:20 -06:00
2023-05-27 11:29:39 -05:00
export interface LinkIncludingCollectionAndTags
extends Omit<Link, "id" | "createdAt" | "collectionId"> {
id?: number;
createdAt?: string;
collectionId?: number;
2023-03-28 02:31:50 -05:00
tags: Tag[];
2023-05-27 11:29:39 -05:00
collection: OptionalExcluding<Collection, "name" | "ownerId">;
}
2023-05-26 23:11:29 -05:00
export interface Member {
collectionId?: number;
userId?: number;
canCreate: boolean;
canUpdate: boolean;
canDelete: boolean;
user: OptionalExcluding<User, "email" | "name">;
}
export interface CollectionIncludingMembers
extends Omit<Collection, "id" | "createdAt"> {
id?: number;
2023-05-26 23:29:45 -05:00
createdAt?: string;
2023-05-26 23:11:29 -05:00
members: Member[];
2023-04-24 16:30:40 -05:00
}
2023-05-08 09:35:39 -05:00
2023-05-27 11:53:02 -05:00
export interface AccountSettings extends User {
profilePic: string | null;
oldPassword?: string;
newPassword?: string;
}
2023-05-29 14:40:23 -05:00
export interface PublicCollectionIncludingLinks
extends Omit<Collection, "ownerId"> {
ownerName?: string;
2023-05-31 09:30:45 -05:00
links: Omit<Link, "screenshotPath" | "pdfPath">[];
2023-05-29 14:40:23 -05:00
}