2023-05-22 07:20:48 -05:00
|
|
|
import { Collection, Link, Tag, User } from "@prisma/client";
|
2023-10-24 14:57:37 -05:00
|
|
|
import Stripe from "stripe";
|
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-11-02 13:59:31 -05:00
|
|
|
extends Omit<
|
|
|
|
Link,
|
|
|
|
"id" | "createdAt" | "collectionId" | "updatedAt" | "lastPreserved"
|
|
|
|
> {
|
2023-05-27 11:29:39 -05:00
|
|
|
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;
|
2023-10-28 00:42:31 -05:00
|
|
|
userId: number;
|
2023-05-26 23:11:29 -05:00
|
|
|
canCreate: boolean;
|
|
|
|
canUpdate: boolean;
|
|
|
|
canDelete: boolean;
|
2023-10-28 00:42:31 -05:00
|
|
|
user: OptionalExcluding<User, "username" | "name" | "id">;
|
2023-05-26 23:11:29 -05:00
|
|
|
}
|
|
|
|
|
2023-06-16 07:55:21 -05:00
|
|
|
export interface CollectionIncludingMembersAndLinkCount
|
2023-11-07 07:03:35 -06:00
|
|
|
extends Omit<Collection, "id" | "createdAt" | "ownerId" | "updatedAt"> {
|
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-11-15 12:12:06 -06:00
|
|
|
export interface TagIncludingLinkCount extends Tag {
|
|
|
|
_count?: { links: number };
|
|
|
|
}
|
|
|
|
|
2023-05-27 11:53:02 -05:00
|
|
|
export interface AccountSettings extends User {
|
|
|
|
newPassword?: string;
|
2023-08-10 11:16:44 -05:00
|
|
|
whitelistedUsers: string[];
|
2023-11-06 07:25:57 -06:00
|
|
|
subscription?: {
|
|
|
|
active?: boolean;
|
|
|
|
};
|
2023-05-27 11:53:02 -05:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2023-12-15 21:25:39 -06:00
|
|
|
export enum ViewMode {
|
2023-12-21 09:55:07 -06:00
|
|
|
Card = "card",
|
2023-12-16 14:06:26 -06:00
|
|
|
Grid = "grid",
|
2023-12-15 22:57:50 -06:00
|
|
|
List = "list",
|
2023-12-15 21:25:39 -06: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 LinkRequestQuery = {
|
2023-10-23 09:45:48 -05:00
|
|
|
sort: Sort;
|
2023-06-15 07:39:30 -05:00
|
|
|
cursor?: number;
|
2023-06-14 17:34:54 -05:00
|
|
|
collectionId?: number;
|
|
|
|
tagId?: number;
|
|
|
|
pinnedOnly?: boolean;
|
2023-10-23 09:45:48 -05:00
|
|
|
searchQueryString?: string;
|
|
|
|
searchByName?: boolean;
|
|
|
|
searchByUrl?: boolean;
|
|
|
|
searchByDescription?: boolean;
|
2023-11-01 05:01:26 -05:00
|
|
|
searchByTextContent?: boolean;
|
2023-10-23 09:45:48 -05:00
|
|
|
searchByTags?: boolean;
|
2023-06-14 17:34:54 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
export type PublicLinkRequestQuery = {
|
2023-06-15 07:39:30 -05:00
|
|
|
cursor?: number;
|
|
|
|
collectionId: number;
|
2023-06-14 17:34:54 -05:00
|
|
|
};
|
2023-08-10 11:16:44 -05:00
|
|
|
|
|
|
|
interface CollectionIncludingLinks extends Collection {
|
|
|
|
links: LinksIncludingTags[];
|
|
|
|
}
|
|
|
|
|
2023-10-27 23:45:14 -05:00
|
|
|
export interface Backup extends Omit<User, "password" | "id"> {
|
2023-08-10 11:16:44 -05:00
|
|
|
collections: CollectionIncludingLinks[];
|
|
|
|
}
|
2023-09-10 23:20:31 -05:00
|
|
|
|
2023-10-16 17:27:04 -05:00
|
|
|
export type MigrationRequest = {
|
|
|
|
format: MigrationFormat;
|
|
|
|
data: string;
|
|
|
|
};
|
|
|
|
|
|
|
|
export enum MigrationFormat {
|
|
|
|
linkwarden,
|
|
|
|
htmlFile,
|
|
|
|
}
|
|
|
|
|
2023-09-10 23:20:31 -05:00
|
|
|
export enum Plan {
|
|
|
|
monthly,
|
|
|
|
yearly,
|
|
|
|
}
|
2023-10-24 14:57:37 -05:00
|
|
|
|
|
|
|
export type DeleteUserBody = {
|
|
|
|
password: string;
|
|
|
|
cancellation_details?: {
|
|
|
|
comment?: string;
|
|
|
|
feedback?: Stripe.SubscriptionCancelParams.CancellationDetails.Feedback;
|
|
|
|
};
|
|
|
|
};
|
2023-11-19 15:22:27 -06:00
|
|
|
|
|
|
|
export enum ArchivedFormat {
|
2023-11-25 02:19:02 -06:00
|
|
|
png,
|
|
|
|
jpeg,
|
2023-11-19 15:22:27 -06:00
|
|
|
pdf,
|
|
|
|
readability,
|
|
|
|
}
|
2023-11-25 02:19:02 -06:00
|
|
|
|
|
|
|
export enum LinkType {
|
|
|
|
url,
|
|
|
|
pdf,
|
|
|
|
image,
|
|
|
|
}
|
2024-01-13 00:20:06 -06:00
|
|
|
|
|
|
|
export enum KeyExpiry {
|
|
|
|
sevenDays,
|
|
|
|
oneMonth,
|
|
|
|
twoMonths,
|
|
|
|
threeMonths,
|
|
|
|
never,
|
|
|
|
}
|