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
type OptionalExcluding < T , TRequired extends keyof T > = Partial < T > &
Pick < T , TRequired > ;
2023-03-05 15:03:20 -06:00
2023-03-10 13:25:33 -06:00
export interface ExtendedLink extends Link {
2023-03-05 15:03:20 -06:00
tags : Tag [ ] ;
2023-03-10 13:25:33 -06:00
collection : Collection ;
2023-03-05 15:03:20 -06:00
}
export interface NewLink {
name : string ;
url : string ;
2023-03-28 02:31:50 -05:00
tags : Tag [ ] ;
2023-03-08 15:31:24 -06:00
collection : {
2023-03-28 02:31:50 -05:00
id : number | undefined ;
name : string | undefined ;
ownerId : number | undefined ;
2023-03-05 15:03:20 -06:00
} ;
}
2023-04-24 16:30:40 -05:00
export interface NewCollection {
name : string ;
description : string ;
2023-04-26 15:40:48 -05:00
members : {
name : string ;
email : string ;
canCreate : boolean ;
canUpdate : boolean ;
canDelete : boolean ;
} [ ] ;
}
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 ;
createdAt? : Date ;
members : Member [ ] ;
2023-04-24 16:30:40 -05:00
}
2023-05-08 09:35:39 -05:00
export type SearchSettings = {
query : string ;
filter : {
name : boolean ;
url : boolean ;
title : boolean ;
collection : boolean ;
tags : boolean ;
} ;
} ;
2023-05-20 14:25:00 -05:00
2023-05-22 07:20:48 -05:00
export interface AccountSettings extends User {
profilePic : string | null ;
2023-05-22 15:29:24 -05:00
oldPassword? : string ;
newPassword? : string ;
2023-05-22 07:20:48 -05:00
}