el.xwx.moe/types/global.ts

52 lines
1.6 KiB
TypeScript
Raw Normal View History

2023-04-23 08:26:39 -05:00
// Copyright (C) 2022-present Daniel31x13 <daniel31x13@gmail.com>
// This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 3.
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
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-08 09:35:39 -05:00
export type SearchSettings = {
query: string;
filter: {
name: boolean;
url: boolean;
title: boolean;
collection: boolean;
tags: boolean;
};
};