import { Collection, Link, Tag, User } from "@prisma/client"; import Stripe from "stripe"; type OptionalExcluding = Partial & Pick; export interface LinkIncludingShortenedCollectionAndTags extends Omit< Link, "id" | "createdAt" | "collectionId" | "updatedAt" | "lastPreserved" > { id?: number; createdAt?: string; collectionId?: number; tags: Tag[]; pinnedBy?: { id: number; }[]; collection: OptionalExcluding; } export interface Member { collectionId?: number; userId: number; canCreate: boolean; canUpdate: boolean; canDelete: boolean; user: OptionalExcluding; } export interface CollectionIncludingMembersAndLinkCount extends Omit { id?: number; ownerId?: number; createdAt?: string; _count?: { links: number }; members: Member[]; } export interface TagIncludingLinkCount extends Tag { _count?: { links: number }; } export interface AccountSettings extends User { newPassword?: string; whitelistedUsers: string[]; subscription?: { active?: boolean; }; } interface LinksIncludingTags extends Link { tags: Tag[]; } export interface PublicCollectionIncludingLinks extends Collection { links: LinksIncludingTags[]; } export enum Sort { DateNewestFirst, DateOldestFirst, NameAZ, NameZA, DescriptionAZ, DescriptionZA, } export type LinkRequestQuery = { sort: Sort; cursor?: number; collectionId?: number; tagId?: number; pinnedOnly?: boolean; searchQueryString?: string; searchByName?: boolean; searchByUrl?: boolean; searchByDescription?: boolean; searchByTextContent?: boolean; searchByTags?: boolean; }; export type PublicLinkRequestQuery = { cursor?: number; collectionId: number; }; interface CollectionIncludingLinks extends Collection { links: LinksIncludingTags[]; } export interface Backup extends Omit { collections: CollectionIncludingLinks[]; } export type MigrationRequest = { format: MigrationFormat; data: string; }; export enum MigrationFormat { linkwarden, htmlFile, } export enum Plan { monthly, yearly, } export type DeleteUserBody = { password: string; cancellation_details?: { comment?: string; feedback?: Stripe.SubscriptionCancelParams.CancellationDetails.Feedback; }; }; export enum ArchivedFormat { png, jpeg, pdf, readability, } export enum LinkType { url, pdf, image, }