feat: add modelTypes
This commit is contained in:
5
src/modelTypes/IAbstract.ts
Normal file
5
src/modelTypes/IAbstract.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import type {Right} from '@/constants/rights'
|
||||
|
||||
export interface IAbstract {
|
||||
maxRight: Right | null // FIXME: should this be readonly?
|
||||
}
|
11
src/modelTypes/IAttachment.ts
Normal file
11
src/modelTypes/IAttachment.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IFile} from './IFile'
|
||||
import type {IUser} from './IUser'
|
||||
|
||||
export interface IAttachment extends IAbstract {
|
||||
id: number
|
||||
taskId: number
|
||||
createdBy: IUser
|
||||
file: IFile
|
||||
created: Date
|
||||
}
|
7
src/modelTypes/IAvatar.ts
Normal file
7
src/modelTypes/IAvatar.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export type AvatarProvider = 'default' | 'initials' | 'gravatar' | 'marble' | 'upload'
|
||||
|
||||
export interface IAvatar extends IAbstract {
|
||||
avatarProvider: AvatarProvider
|
||||
}
|
12
src/modelTypes/IBackgroundImage.ts
Normal file
12
src/modelTypes/IBackgroundImage.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface IBackgroundImage extends IAbstract {
|
||||
id: number
|
||||
url: string
|
||||
thumb: string
|
||||
info: {
|
||||
author: string
|
||||
authorName: string
|
||||
}
|
||||
blurHash: string
|
||||
}
|
17
src/modelTypes/IBucket.ts
Normal file
17
src/modelTypes/IBucket.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type {ITask} from './ITask'
|
||||
|
||||
export interface IBucket extends IAbstract {
|
||||
id: number
|
||||
title: string
|
||||
listId: number
|
||||
limit: number
|
||||
tasks: ITask[]
|
||||
isDoneBucket: boolean
|
||||
position: number
|
||||
|
||||
createdBy: IUser
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
7
src/modelTypes/ICaldavToken.ts
Normal file
7
src/modelTypes/ICaldavToken.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface ICaldavToken extends IAbstract {
|
||||
id: number;
|
||||
|
||||
created: Date;
|
||||
}
|
6
src/modelTypes/IEmailUpdate.ts
Normal file
6
src/modelTypes/IEmailUpdate.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface IEmailUpdate extends IAbstract {
|
||||
newEmail: string
|
||||
password: string
|
||||
}
|
10
src/modelTypes/IFile.ts
Normal file
10
src/modelTypes/IFile.ts
Normal file
@ -0,0 +1,10 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface IFile extends IAbstract {
|
||||
id: number
|
||||
mime: string
|
||||
name: string
|
||||
size: number
|
||||
|
||||
created: Date
|
||||
}
|
15
src/modelTypes/ILabel.ts
Normal file
15
src/modelTypes/ILabel.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
|
||||
export interface ILabel extends IAbstract {
|
||||
id: number
|
||||
title: string
|
||||
hexColor: string
|
||||
description: string
|
||||
createdBy: IUser
|
||||
listId: number
|
||||
textColor: string
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
7
src/modelTypes/ILabelTask.ts
Normal file
7
src/modelTypes/ILabelTask.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface ILabelTask extends IAbstract {
|
||||
id: number
|
||||
taskId: number
|
||||
labelId: number
|
||||
}
|
17
src/modelTypes/ILinkShare.ts
Normal file
17
src/modelTypes/ILinkShare.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type { Right } from '@/constants/rights'
|
||||
|
||||
export interface ILinkShare extends IAbstract {
|
||||
id: number
|
||||
hash: string
|
||||
right: Right
|
||||
sharedBy: IUser
|
||||
sharingType: number // FIXME: use correct numbers
|
||||
listId: number
|
||||
name: string
|
||||
password: string
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
26
src/modelTypes/IList.ts
Normal file
26
src/modelTypes/IList.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {ITask} from './ITask'
|
||||
import type {IUser} from './IUser'
|
||||
import type {ISubscription} from './ISubscription'
|
||||
import type {INamespace} from './INamespace'
|
||||
|
||||
|
||||
export interface IList extends IAbstract {
|
||||
id: number
|
||||
title: string
|
||||
description: string
|
||||
owner: IUser
|
||||
tasks: ITask[]
|
||||
namespaceId: INamespace['id']
|
||||
isArchived: boolean
|
||||
hexColor: string
|
||||
identifier: string
|
||||
backgroundInformation: any // FIXME: improve type
|
||||
isFavorite: boolean
|
||||
subscription: ISubscription
|
||||
position: number
|
||||
backgroundBlurHash: string
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
9
src/modelTypes/IListDuplicate.ts
Normal file
9
src/modelTypes/IListDuplicate.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IList} from './IList'
|
||||
import type {INamespace} from './INamespace'
|
||||
|
||||
export interface IListDuplicate extends IAbstract {
|
||||
listId: number
|
||||
namespaceId: INamespace['id']
|
||||
list: IList
|
||||
}
|
18
src/modelTypes/INamespace.ts
Normal file
18
src/modelTypes/INamespace.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IList} from './IList'
|
||||
import type {IUser} from './IUser'
|
||||
import type {ISubscription} from './ISubscription'
|
||||
|
||||
export interface INamespace extends IAbstract {
|
||||
id: number
|
||||
title: string
|
||||
description: string
|
||||
owner: IUser
|
||||
lists: IList[]
|
||||
isArchived: boolean
|
||||
hexColor: string
|
||||
subscription: ISubscription
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
51
src/modelTypes/INotification.ts
Normal file
51
src/modelTypes/INotification.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type {ITask} from './ITask'
|
||||
import type {ITaskComment} from './ITaskComment'
|
||||
import type {ITeam} from './ITeam'
|
||||
import type { IList } from './IList'
|
||||
|
||||
export const NOTIFICATION_NAMES = {
|
||||
'TASK_COMMENT': 'task.comment',
|
||||
'TASK_ASSIGNED': 'task.assigned',
|
||||
'TASK_DELETED': 'task.deleted',
|
||||
'LIST_CREATED': 'list.created',
|
||||
'TEAM_MEMBER_ADDED': 'team.member.added',
|
||||
} as const
|
||||
|
||||
interface Notification {
|
||||
doer: IUser
|
||||
}
|
||||
interface NotificationTask extends Notification {
|
||||
task: ITask
|
||||
comment: ITaskComment
|
||||
}
|
||||
|
||||
interface NotificationAssigned extends Notification {
|
||||
task: ITask
|
||||
assignee: IUser
|
||||
}
|
||||
|
||||
interface NotificationDeleted extends Notification {
|
||||
task: ITask
|
||||
}
|
||||
|
||||
interface NotificationCreated extends Notification {
|
||||
task: ITask
|
||||
list: IList
|
||||
}
|
||||
|
||||
interface NotificationMemberAdded extends Notification {
|
||||
member: IUser
|
||||
team: ITeam
|
||||
}
|
||||
|
||||
export interface INotification extends IAbstract {
|
||||
id: number
|
||||
name: string
|
||||
notification: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded
|
||||
read: boolean
|
||||
readAt: Date | null
|
||||
|
||||
created: Date
|
||||
}
|
7
src/modelTypes/IPasswordReset.ts
Normal file
7
src/modelTypes/IPasswordReset.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface IPasswordReset extends IAbstract {
|
||||
token: string
|
||||
newPassword: string
|
||||
email: string
|
||||
}
|
6
src/modelTypes/IPasswordUpdate.ts
Normal file
6
src/modelTypes/IPasswordUpdate.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface IPasswordUpdate extends IAbstract {
|
||||
newPassword: string
|
||||
oldPassword: string
|
||||
}
|
14
src/modelTypes/ISavedFilter.ts
Normal file
14
src/modelTypes/ISavedFilter.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type {IFilter} from '@/types/IFilter'
|
||||
|
||||
export interface ISavedFilter extends IAbstract {
|
||||
id: number
|
||||
title: string
|
||||
description: string
|
||||
filters: IFilter
|
||||
|
||||
owner: IUser
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
11
src/modelTypes/ISubscription.ts
Normal file
11
src/modelTypes/ISubscription.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
|
||||
export interface ISubscription extends IAbstract {
|
||||
id: number
|
||||
entity: string // FIXME: correct type?
|
||||
entityId: number // FIXME: correct type?
|
||||
user: IUser
|
||||
|
||||
created: Date
|
||||
}
|
50
src/modelTypes/ITask.ts
Normal file
50
src/modelTypes/ITask.ts
Normal file
@ -0,0 +1,50 @@
|
||||
import type { Priority } from '@/constants/priorities'
|
||||
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type {ILabel} from './ILabel'
|
||||
import type {IAttachment} from './IAttachment'
|
||||
import type {ISubscription} from './ISubscription'
|
||||
import type {IList} from './IList'
|
||||
import type {IBucket} from './IBucket'
|
||||
|
||||
import type {IRelationKind} from '@/types/IRelationKind'
|
||||
import type {IRepeatAfter} from '@/types/IRepeatAfter'
|
||||
import type {IRepeatMode} from '@/types/IRepeatMode'
|
||||
export interface ITask extends IAbstract {
|
||||
id: number
|
||||
title: string
|
||||
description: string
|
||||
done: boolean
|
||||
doneAt: Date | null
|
||||
priority: Priority
|
||||
labels: ILabel[]
|
||||
assignees: IUser[]
|
||||
|
||||
dueDate: Date | null
|
||||
startDate: Date | null
|
||||
endDate: Date | null
|
||||
repeatAfter: number | IRepeatAfter
|
||||
repeatFromCurrentDate: boolean
|
||||
repeatMode: IRepeatMode
|
||||
reminderDates: Date[]
|
||||
parentTaskId: ITask['id']
|
||||
hexColor: string
|
||||
percentDone: number
|
||||
relatedTasks: Partial<Record<IRelationKind, ITask>>,
|
||||
attachments: IAttachment[]
|
||||
identifier: string
|
||||
index: number
|
||||
isFavorite: boolean
|
||||
subscription: ISubscription
|
||||
|
||||
position: number
|
||||
kanbanPosition: number
|
||||
|
||||
createdBy: IUser
|
||||
created: Date
|
||||
updated: Date
|
||||
|
||||
listId: IList['id'] // Meta, only used when creating a new task
|
||||
bucketId: IBucket['id']
|
||||
}
|
9
src/modelTypes/ITaskAssignee.ts
Normal file
9
src/modelTypes/ITaskAssignee.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {ITask} from './ITask'
|
||||
import type {IUser} from './IUser'
|
||||
|
||||
export interface ITaskAssignee extends IAbstract {
|
||||
created: Date
|
||||
userId: IUser['id']
|
||||
taskId: ITask['id']
|
||||
}
|
13
src/modelTypes/ITaskComment.ts
Normal file
13
src/modelTypes/ITaskComment.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type {ITask} from './ITask'
|
||||
|
||||
export interface ITaskComment extends IAbstract {
|
||||
id: number
|
||||
taskId: ITask['id']
|
||||
comment: string
|
||||
author: IUser
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
15
src/modelTypes/ITaskRelation.ts
Normal file
15
src/modelTypes/ITaskRelation.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type {ITask} from './ITask'
|
||||
|
||||
import type {IRelationKind} from '@/types/IRelationKind'
|
||||
|
||||
export interface ITaskRelation extends IAbstract {
|
||||
id: number
|
||||
otherTaskId: ITask['id']
|
||||
taskId: ITask['id']
|
||||
relationKind: IRelationKind
|
||||
|
||||
createdBy: IUser
|
||||
created: Date
|
||||
}
|
16
src/modelTypes/ITeam.ts
Normal file
16
src/modelTypes/ITeam.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type {ITeamMember} from './ITeamMember'
|
||||
import type {Right} from '@/constants/rights'
|
||||
|
||||
export interface ITeam extends IAbstract {
|
||||
id: number
|
||||
name: string
|
||||
description: string
|
||||
members: ITeamMember[]
|
||||
right: Right
|
||||
|
||||
createdBy: IUser
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
6
src/modelTypes/ITeamList.ts
Normal file
6
src/modelTypes/ITeamList.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import type {ITeamShareBase} from './ITeamShareBase'
|
||||
import type {IList} from './IList'
|
||||
|
||||
export interface ITeamList extends ITeamShareBase {
|
||||
listId: IList['id']
|
||||
}
|
7
src/modelTypes/ITeamMember.ts
Normal file
7
src/modelTypes/ITeamMember.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type {IUser} from './IUser'
|
||||
import type {IList} from './IList'
|
||||
|
||||
export interface ITeamMember extends IUser {
|
||||
admin: boolean
|
||||
teamId: IList['id']
|
||||
}
|
6
src/modelTypes/ITeamNamespace.ts
Normal file
6
src/modelTypes/ITeamNamespace.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import type {ITeamShareBase} from './ITeamShareBase'
|
||||
import type {INamespace} from './INamespace'
|
||||
|
||||
export interface ITeamNamespace extends ITeamShareBase {
|
||||
namespaceId: INamespace['id']
|
||||
}
|
11
src/modelTypes/ITeamShareBase.ts
Normal file
11
src/modelTypes/ITeamShareBase.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {ITeam} from './ITeam'
|
||||
import type {Right} from '@/constants/rights'
|
||||
|
||||
export interface ITeamShareBase extends IAbstract {
|
||||
teamId: ITeam['id']
|
||||
right: Right
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
7
src/modelTypes/ITotp.ts
Normal file
7
src/modelTypes/ITotp.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
|
||||
export interface ITotp extends IAbstract {
|
||||
secret: string
|
||||
enabled: boolean
|
||||
url: string
|
||||
}
|
13
src/modelTypes/IUser.ts
Normal file
13
src/modelTypes/IUser.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUserSettings} from './IUserSettings'
|
||||
|
||||
export interface IUser extends IAbstract {
|
||||
id: number
|
||||
email: string
|
||||
username: string
|
||||
name: string
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
settings: IUserSettings
|
||||
}
|
6
src/modelTypes/IUserList.ts
Normal file
6
src/modelTypes/IUserList.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import type {IUserShareBase} from './IUserShareBase'
|
||||
import type {IList} from './IList'
|
||||
|
||||
export interface IUserList extends IUserShareBase {
|
||||
listId: IList['id']
|
||||
}
|
6
src/modelTypes/IUserNamespace.ts
Normal file
6
src/modelTypes/IUserNamespace.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import type {IUserShareBase} from './IUserShareBase'
|
||||
import type {INamespace} from './INamespace'
|
||||
|
||||
export interface IUserNamespace extends IUserShareBase {
|
||||
namespaceId: INamespace['id']
|
||||
}
|
14
src/modelTypes/IUserSettings.ts
Normal file
14
src/modelTypes/IUserSettings.ts
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IList} from './IList'
|
||||
|
||||
export interface IUserSettings extends IAbstract {
|
||||
name: string
|
||||
emailRemindersEnabled: boolean
|
||||
discoverableByName: boolean
|
||||
discoverableByEmail: boolean
|
||||
overdueTasksRemindersEnabled: boolean
|
||||
defaultListId: undefined | IList['id']
|
||||
weekStart: 0 | 1 | 2 | 3 | 4 | 5 | 6
|
||||
timezone: string
|
||||
}
|
11
src/modelTypes/IUserShareBase.ts
Normal file
11
src/modelTypes/IUserShareBase.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import type {IAbstract} from './IAbstract'
|
||||
import type {IUser} from './IUser'
|
||||
import type {Right} from '@/constants/rights'
|
||||
|
||||
export interface IUserShareBase extends IAbstract {
|
||||
userId: IUser['id']
|
||||
right: Right
|
||||
|
||||
created: Date
|
||||
updated: Date
|
||||
}
|
Reference in New Issue
Block a user