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-06-14 17:34:54 -05:00
|
|
|
export interface LinkIncludingShortenedCollectionAndTags
|
2023-05-27 11:29:39 -05:00
|
|
|
extends Omit<Link, "id" | "createdAt" | "collectionId"> {
|
|
|
|
id?: number;
|
|
|
|
createdAt?: string;
|
|
|
|
collectionId?: number;
|
2023-03-28 02:31:50 -05:00
|
|
|
tags: Tag[];
|
2023-06-13 14:19:37 -05:00
|
|
|
pinnedBy?: {
|
|
|
|
id: number;
|
|
|
|
}[];
|
2023-06-24 16:54:35 -05:00
|
|
|
collection: OptionalExcluding<Collection, "name" | "ownerId">;
|
2023-04-26 15:40:48 -05:00
|
|
|
}
|
|
|
|
|
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">;
|
|
|
|
}
|
|
|
|
|
2023-06-16 07:55:21 -05:00
|
|
|
export interface CollectionIncludingMembersAndLinkCount
|
2023-06-18 00:27:57 -05:00
|
|
|
extends Omit<Collection, "id" | "createdAt" | "ownerId"> {
|
2023-05-26 23:11:29 -05:00
|
|
|
id?: number;
|
2023-06-18 00:27:57 -05:00
|
|
|
ownerId?: number;
|
2023-05-26 23:29:45 -05:00
|
|
|
createdAt?: string;
|
2023-06-18 00:27:57 -05:00
|
|
|
_count?: { links: number };
|
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 {
|
2023-06-07 14:34:50 -05:00
|
|
|
profilePic: string;
|
2023-05-27 11:53:02 -05:00
|
|
|
oldPassword?: string;
|
|
|
|
newPassword?: string;
|
|
|
|
}
|
|
|
|
|
2023-06-14 17:34:54 -05:00
|
|
|
interface LinksIncludingTags extends Link {
|
|
|
|
tags: Tag[];
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface PublicCollectionIncludingLinks extends Collection {
|
|
|
|
links: LinksIncludingTags[];
|
2023-05-29 14:40:23 -05:00
|
|
|
}
|
2023-06-13 21:44:50 -05:00
|
|
|
|
|
|
|
export enum Sort {
|
2023-06-14 17:34:54 -05:00
|
|
|
DateNewestFirst,
|
|
|
|
DateOldestFirst,
|
2023-06-13 21:44:50 -05:00
|
|
|
NameAZ,
|
|
|
|
NameZA,
|
2023-06-13 23:40:23 -05:00
|
|
|
DescriptionAZ,
|
|
|
|
DescriptionZA,
|
2023-06-13 21:44:50 -05:00
|
|
|
}
|
2023-06-14 17:34:54 -05:00
|
|
|
|
|
|
|
export type LinkSearchFilter = {
|
|
|
|
name: boolean;
|
|
|
|
url: boolean;
|
|
|
|
description: boolean;
|
|
|
|
tags: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type LinkRequestQuery = {
|
2023-06-15 07:39:30 -05:00
|
|
|
cursor?: number;
|
2023-06-14 17:34:54 -05:00
|
|
|
collectionId?: number;
|
|
|
|
tagId?: number;
|
2023-06-15 07:39:30 -05:00
|
|
|
sort: Sort;
|
2023-06-14 17:34:54 -05:00
|
|
|
searchFilter?: LinkSearchFilter;
|
|
|
|
searchQuery?: string;
|
|
|
|
pinnedOnly?: boolean;
|
|
|
|
};
|
|
|
|
|
|
|
|
export type PublicLinkRequestQuery = {
|
2023-06-15 07:39:30 -05:00
|
|
|
cursor?: number;
|
|
|
|
collectionId: number;
|
2023-06-14 17:34:54 -05:00
|
|
|
};
|