wip: add modelTypes
This commit is contained in:
parent
c1f5f92fa1
commit
3ecd28ad1a
|
@ -92,7 +92,7 @@ import {useStore} from '@/store'
|
||||||
import {useRouter} from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
|
|
||||||
import {QUICK_ACTIONS_ACTIVE} from '@/store/mutation-types'
|
import {QUICK_ACTIONS_ACTIVE} from '@/store/mutation-types'
|
||||||
import {RIGHTS as Rights} from '@/models/constants/rights'
|
import {RIGHTS as Rights} from '@/modelTypes/constants/rights'
|
||||||
|
|
||||||
import Update from '@/components/home/update.vue'
|
import Update from '@/components/home/update.vue'
|
||||||
import ListSettingsDropdown from '@/components/list/list-settings-dropdown.vue'
|
import ListSettingsDropdown from '@/components/list/list-settings-dropdown.vue'
|
||||||
|
|
|
@ -180,7 +180,7 @@ import {ref, watch, computed, shallowReactive} from 'vue'
|
||||||
import {useStore} from '@/store'
|
import {useStore} from '@/store'
|
||||||
import {useI18n} from 'vue-i18n'
|
import {useI18n} from 'vue-i18n'
|
||||||
|
|
||||||
import {RIGHTS} from '@/models/constants/rights'
|
import {RIGHTS} from '@/modelTypes/constants/rights'
|
||||||
import LinkShareModel, { type ILinkShare } from '@/models/linkShare'
|
import LinkShareModel, { type ILinkShare } from '@/models/linkShare'
|
||||||
|
|
||||||
import LinkShareService from '@/services/linkShare'
|
import LinkShareService from '@/services/linkShare'
|
||||||
|
|
|
@ -160,7 +160,7 @@ import TeamListModel, { type ITeamList } from '@/models/teamList'
|
||||||
import TeamService from '@/services/team'
|
import TeamService from '@/services/team'
|
||||||
import TeamModel, { type ITeam } from '@/models/team'
|
import TeamModel, { type ITeam } from '@/models/team'
|
||||||
|
|
||||||
import {RIGHTS} from '@/models/constants/rights'
|
import {RIGHTS} from '@/modelTypes/constants/rights'
|
||||||
import Multiselect from '@/components/input/multiselect.vue'
|
import Multiselect from '@/components/input/multiselect.vue'
|
||||||
import Nothing from '@/components/misc/nothing.vue'
|
import Nothing from '@/components/misc/nothing.vue'
|
||||||
import {success} from '@/message'
|
import {success} from '@/message'
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
import type {Right} from './constants/rights'
|
||||||
|
|
||||||
|
export interface IAbstract {
|
||||||
|
maxRight: Right | null
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
// import type {IAbstract} from './IAbstract'
|
||||||
|
|
||||||
|
export type AvatarProvider = 'default' | 'initials' | 'gravatar' | 'marble' | 'upload'
|
||||||
|
|
||||||
|
// export interface IAvatar /* extends IAbstract */ {
|
||||||
|
export interface IAvatar {
|
||||||
|
avatarProvider: AvatarProvider
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import type {IAbstract} from './IAbstract'
|
||||||
|
|
||||||
|
export interface ICaldavToken /* extends IAbstract */ {
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
created: Date;
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import type {IAbstract} from './IAbstract'
|
||||||
|
|
||||||
|
export interface IEmailUpdate /* extends IAbstract */ {
|
||||||
|
newEmail: string
|
||||||
|
password: string
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type {IAbstract} from './IAbstract'
|
||||||
|
|
||||||
|
export interface IFile /* extends IAbstract */ {
|
||||||
|
id: number
|
||||||
|
mime: string
|
||||||
|
name: string
|
||||||
|
size: number
|
||||||
|
|
||||||
|
created: Date
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import type {IAbstract} from './IAbstract'
|
||||||
|
|
||||||
|
export interface ILabelTask /* extends IAbstract */ {
|
||||||
|
id: number
|
||||||
|
taskId: number
|
||||||
|
labelId: number
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
isFavorite: boolean
|
||||||
|
subscription: ISubscription
|
||||||
|
position: number
|
||||||
|
backgroundBlurHash: string
|
||||||
|
|
||||||
|
created: Date
|
||||||
|
updated: Date
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
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'
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import type {IAbstract} from './IAbstract'
|
||||||
|
|
||||||
|
export interface IPasswordReset /* extends IAbstract */ {
|
||||||
|
token: string
|
||||||
|
newPassword: string
|
||||||
|
email: string
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import type {IAbstract} from './IAbstract'
|
||||||
|
|
||||||
|
export interface IPasswordUpdate /* extends IAbstract */ {
|
||||||
|
newPassword: string
|
||||||
|
oldPassword: string
|
||||||
|
}
|
|
@ -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: 0
|
||||||
|
title: string
|
||||||
|
description: string
|
||||||
|
filters: IFilter
|
||||||
|
|
||||||
|
owner: IUser
|
||||||
|
created: Date
|
||||||
|
updated: Date
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,57 @@
|
||||||
|
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 {IRepeats} from '@/types/IRepeats'
|
||||||
|
|
||||||
|
export const TASK_REPEAT_MODES = {
|
||||||
|
'REPEAT_MODE_DEFAULT': 0,
|
||||||
|
'REPEAT_MODE_MONTH': 1,
|
||||||
|
'REPEAT_MODE_FROM_CURRENT_DATE': 2,
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export type TaskRepeatMode = typeof TASK_REPEAT_MODES[keyof typeof TASK_REPEAT_MODES]
|
||||||
|
|
||||||
|
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 | IRepeats
|
||||||
|
repeatFromCurrentDate: boolean
|
||||||
|
repeatMode: TaskRepeatMode
|
||||||
|
reminderDates: Date[]
|
||||||
|
parentTaskId: ITask['id']
|
||||||
|
hexColor: string
|
||||||
|
percentDone: number
|
||||||
|
relatedTasks: { [relationKind: string]: ITask } // FIXME: use relationKinds
|
||||||
|
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']
|
||||||
|
}
|
|
@ -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']
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import type {ITeamShareBase} from './ITeamShareBase'
|
||||||
|
import type {IList} from './IList'
|
||||||
|
|
||||||
|
export interface ITeamList extends ITeamShareBase {
|
||||||
|
listId: IList['id']
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import type {IUser} from './IUser'
|
||||||
|
import type {IList} from './IList'
|
||||||
|
|
||||||
|
export interface ITeamMember extends IUser {
|
||||||
|
admin: boolean
|
||||||
|
teamId: IList['id']
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import type {ITeamShareBase} from './ITeamShareBase'
|
||||||
|
import type {INamespace} from './INamespace'
|
||||||
|
|
||||||
|
export interface ITeamNamespace extends ITeamShareBase {
|
||||||
|
namespaceId: INamespace['id']
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
import type {IAbstract} from './IAbstract'
|
||||||
|
|
||||||
|
export interface ITotp /* extends IAbstract */ {
|
||||||
|
secret: string
|
||||||
|
enabled: boolean
|
||||||
|
url: string
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import type {IUserShareBase} from './IUserShareBase'
|
||||||
|
import type {IList} from './IList'
|
||||||
|
|
||||||
|
export interface IUserList extends IUserShareBase {
|
||||||
|
listId: IList['id']
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
import type {IUserShareBase} from './IUserShareBase'
|
||||||
|
import type {INamespace} from './INamespace'
|
||||||
|
|
||||||
|
export interface IUserNamespace extends IUserShareBase {
|
||||||
|
namespaceId: INamespace['id']
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -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
|
||||||
|
}
|
|
@ -1,12 +1,9 @@
|
||||||
import {objectToCamelCase} from '@/helpers/case'
|
import {objectToCamelCase} from '@/helpers/case'
|
||||||
import {omitBy, isNil} from '@/helpers/utils'
|
import {omitBy, isNil} from '@/helpers/utils'
|
||||||
import type {Right} from '@/models/constants/rights'
|
import type {Right} from '@/modelTypes/constants/rights'
|
||||||
|
import type {IAbstract} from '@/modelTypes/IAbstract'
|
||||||
|
|
||||||
export interface IAbstract {
|
export default class AbstractModel<Model extends IAbstract = IAbstract> {
|
||||||
maxRight: Right | null
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class AbstractModel implements IAbstract {
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The max right the user has on this object, as returned by the x-max-right header from the api.
|
* The max right the user has on this object, as returned by the x-max-right header from the api.
|
||||||
|
@ -19,18 +16,25 @@ export default class AbstractModel implements IAbstract {
|
||||||
constructor(data : Object = {}) {
|
constructor(data : Object = {}) {
|
||||||
data = objectToCamelCase(data)
|
data = objectToCamelCase(data)
|
||||||
|
|
||||||
|
console.log('AbstractModel:')
|
||||||
|
console.log(this.title)
|
||||||
|
console.log(this.defaults().title)
|
||||||
|
console.log(data.title)
|
||||||
|
console.log(omitBy(data, isNil).title)
|
||||||
|
|
||||||
// Put all data in our model while overriding those with a value of null or undefined with their defaults
|
// Put all data in our model while overriding those with a value of null or undefined with their defaults
|
||||||
Object.assign(
|
Object.assign(
|
||||||
this,
|
this,
|
||||||
this.defaults(),
|
this.defaults(),
|
||||||
omitBy(data, isNil),
|
omitBy(data, isNil),
|
||||||
)
|
)
|
||||||
|
console.log(this.title)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default attributes that define the "empty" state.
|
* Default attributes that define the "empty" state.
|
||||||
*/
|
*/
|
||||||
defaults(): Object {
|
defaults(): Model {
|
||||||
return {}
|
return {} as Model
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,9 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, {type IUser} from './user'
|
import UserModel from './user'
|
||||||
import FileModel, {type IFile} from './file'
|
import FileModel from './file'
|
||||||
|
import type { IUser } from '@/modelTypes/IUser'
|
||||||
export interface IAttachment extends AbstractModel {
|
import type { IFile } from '@/modelTypes/IFile'
|
||||||
id: number
|
import type { IAttachment } from '@/modelTypes/IAttachment'
|
||||||
taskId: number
|
|
||||||
createdBy: IUser
|
|
||||||
file: IFile
|
|
||||||
created: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class AttachmentModel extends AbstractModel implements IAttachment {
|
export default class AttachmentModel extends AbstractModel implements IAttachment {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
@ -17,7 +12,7 @@ export default class AttachmentModel extends AbstractModel implements IAttachmen
|
||||||
file: IFile
|
file: IFile
|
||||||
created: Date
|
created: Date
|
||||||
|
|
||||||
constructor(data) {
|
constructor(data: Partial<IAttachment>) {
|
||||||
super(data)
|
super(data)
|
||||||
this.createdBy = new UserModel(this.createdBy)
|
this.createdBy = new UserModel(this.createdBy)
|
||||||
this.file = new FileModel(this.file)
|
this.file = new FileModel(this.file)
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
import type { IAvatar } from '@/modelTypes/IAvatar'
|
||||||
export type AvatarProvider = 'default' | 'initials' | 'gravatar' | 'marble' | 'upload'
|
|
||||||
|
|
||||||
export interface IAvatar extends AbstractModel {
|
|
||||||
avatarProvider: AvatarProvider
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class AvatarModel extends AbstractModel implements IAvatar {
|
export default class AvatarModel extends AbstractModel implements IAvatar {
|
||||||
declare avatarProvider: AvatarProvider
|
declare avatarProvider: IAvatar['avatarProvider']
|
||||||
|
|
||||||
defaults() {
|
defaults() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,15 +1,5 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
import type {IBackgroundImage} from '@/modelTypes/IBackgroundImage'
|
||||||
export interface IBackgroundImage extends AbstractModel {
|
|
||||||
id: number
|
|
||||||
url: string
|
|
||||||
thumb: string
|
|
||||||
info: {
|
|
||||||
author: string
|
|
||||||
authorName: string
|
|
||||||
}
|
|
||||||
blurHash: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class BackgroundImageModel extends AbstractModel implements IBackgroundImage {
|
export default class BackgroundImageModel extends AbstractModel implements IBackgroundImage {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from './user'
|
import UserModel from './user'
|
||||||
import TaskModel, { type ITask } from './task'
|
import TaskModel from './task'
|
||||||
|
|
||||||
export interface IBucket extends AbstractModel {
|
import type {IBucket} from '@/modelTypes/IBucket'
|
||||||
id: number
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
title: string
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
listId: number
|
|
||||||
limit: number
|
|
||||||
tasks: ITask[]
|
|
||||||
isDoneBucket: boolean
|
|
||||||
position: number
|
|
||||||
|
|
||||||
createdBy: IUser
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class BucketModel extends AbstractModel implements IBucket {
|
export default class BucketModel extends AbstractModel implements IBucket {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
|
||||||
export interface ICaldavToken extends AbstractModel {
|
import type {ICaldavToken} from '@/modelTypes/ICaldavToken'
|
||||||
id: number;
|
|
||||||
created: Date;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class CaldavTokenModel extends AbstractModel implements ICaldavToken {
|
export default class CaldavTokenModel extends AbstractModel implements ICaldavToken {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
|
||||||
interface IEmailUpdate extends AbstractModel {
|
import type {IEmailUpdate} from '@/modelTypes/IEmailUpdate'
|
||||||
newEmail: string
|
|
||||||
password: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class EmailUpdateModel extends AbstractModel implements IEmailUpdate {
|
export default class EmailUpdateModel extends AbstractModel implements IEmailUpdate {
|
||||||
declare newEmail: string
|
declare newEmail: string
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
import type {IFile} from '@/modelTypes/IFile'
|
||||||
export interface IFile extends AbstractModel {
|
|
||||||
id: number
|
|
||||||
mime: string
|
|
||||||
name: string
|
|
||||||
size: number
|
|
||||||
created: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class FileModel extends AbstractModel implements IFile {
|
export default class FileModel extends AbstractModel implements IFile {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,22 +1,13 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from './user'
|
import UserModel from './user'
|
||||||
|
|
||||||
|
import type {ILabel} from '@/modelTypes/ILabel'
|
||||||
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
|
|
||||||
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
||||||
|
|
||||||
const DEFAULT_LABEL_BACKGROUND_COLOR = 'e8e8e8'
|
const DEFAULT_LABEL_BACKGROUND_COLOR = 'e8e8e8'
|
||||||
|
|
||||||
export interface ILabel extends AbstractModel {
|
|
||||||
id: number
|
|
||||||
title: string
|
|
||||||
hexColor: string
|
|
||||||
description: string
|
|
||||||
createdBy: IUser
|
|
||||||
listId: number
|
|
||||||
textColor: string
|
|
||||||
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class LabelModel extends AbstractModel implements ILabel {
|
export default class LabelModel extends AbstractModel implements ILabel {
|
||||||
declare id: number
|
declare id: number
|
||||||
declare title: string
|
declare title: string
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
|
||||||
export interface ILabelTask extends AbstractModel {
|
import type { ILabelTask } from '@/modelTypes/ILabelTask'
|
||||||
id: number
|
|
||||||
taskId: number
|
|
||||||
labelId: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class LabelTask extends AbstractModel implements ILabelTask {
|
export default class LabelTask extends AbstractModel implements ILabelTask {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,19 +1,9 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from './user'
|
import UserModel from './user'
|
||||||
import {RIGHTS, type Right} from '@/models/constants/rights'
|
|
||||||
|
|
||||||
export interface ILinkShare extends AbstractModel {
|
import {RIGHTS, type Right} from '@/modelTypes/constants/rights'
|
||||||
id: number
|
import type {ILinkShare} from '@/modelTypes/ILinkShare'
|
||||||
hash: string
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
right: Right
|
|
||||||
sharedBy: IUser
|
|
||||||
sharingType: number // FIXME: use correct numbers
|
|
||||||
listId: number
|
|
||||||
name: string
|
|
||||||
password: string
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class LinkShareModel extends AbstractModel implements ILinkShare {
|
export default class LinkShareModel extends AbstractModel implements ILinkShare {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,37 +1,22 @@
|
||||||
import AbstractModel from '@/models/abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import TaskModel, { type ITask } from '@/models/task'
|
import TaskModel from '@/models/task'
|
||||||
import UserModel, { type IUser } from '@/models/user'
|
import UserModel from '@/models/user'
|
||||||
import SubscriptionModel, { type ISubscription } from '@/models/subscription'
|
import SubscriptionModel from '@/models/subscription'
|
||||||
import type { INamespace } from '@/models/namespace'
|
|
||||||
|
import type {IList} from '@/modelTypes/IList'
|
||||||
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
|
import type {INamespace} from '@/modelTypes/INamespace'
|
||||||
|
import type {ISubscription} from '@/modelTypes/ISubscription'
|
||||||
|
|
||||||
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
||||||
|
|
||||||
export interface IList extends AbstractModel {
|
|
||||||
id: number
|
|
||||||
title: string
|
|
||||||
description: string
|
|
||||||
owner: IUser
|
|
||||||
tasks: ITask[]
|
|
||||||
namespaceId: INamespace['id']
|
|
||||||
isArchived: boolean
|
|
||||||
hexColor: string
|
|
||||||
identifier: string
|
|
||||||
backgroundInformation: any
|
|
||||||
isFavorite: boolean
|
|
||||||
subscription: ISubscription
|
|
||||||
position: number
|
|
||||||
backgroundBlurHash: string
|
|
||||||
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class ListModel extends AbstractModel implements IList {
|
export default class ListModel extends AbstractModel implements IList {
|
||||||
declare id: number
|
declare id: number
|
||||||
declare title: string
|
declare title: string
|
||||||
declare description: string
|
declare description: string
|
||||||
owner: IUser
|
owner: IUser
|
||||||
tasks: ITask[]
|
declare tasks: ITask[]
|
||||||
declare namespaceId: INamespace['id']
|
declare namespaceId: INamespace['id']
|
||||||
declare isArchived: boolean
|
declare isArchived: boolean
|
||||||
declare hexColor: string
|
declare hexColor: string
|
||||||
|
@ -51,9 +36,9 @@ export default class ListModel extends AbstractModel implements IList {
|
||||||
this.owner = new UserModel(this.owner)
|
this.owner = new UserModel(this.owner)
|
||||||
|
|
||||||
// Make all tasks to task models
|
// Make all tasks to task models
|
||||||
this.tasks = this.tasks.map(t => {
|
this.tasks = this.tasks?.map(t => {
|
||||||
return new TaskModel(t)
|
return new TaskModel(t)
|
||||||
})
|
}) || []
|
||||||
|
|
||||||
if (this.hexColor !== '' && this.hexColor.substring(0, 1) !== '#') {
|
if (this.hexColor !== '' && this.hexColor.substring(0, 1) !== '#') {
|
||||||
this.hexColor = '#' + this.hexColor
|
this.hexColor = '#' + this.hexColor
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import ListModel, { type IList } from './list'
|
import ListModel from './list'
|
||||||
import type { INamespace } from './namespace'
|
|
||||||
|
|
||||||
export interface IListDuplicate extends AbstractModel {
|
import type {IListDuplicate} from '@/modelTypes/IListDuplicate'
|
||||||
listId: number
|
import type {INamespace} from '@/modelTypes/INamespace'
|
||||||
namespaceId: INamespace['id']
|
import type {IList} from '@/modelTypes/IList'
|
||||||
list: IList
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class ListDuplicateModel extends AbstractModel implements IListDuplicate {
|
export default class ListDuplicateModel extends AbstractModel implements IListDuplicate {
|
||||||
declare listId: number
|
declare listId: number
|
||||||
|
|
|
@ -1,28 +1,19 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import ListModel, { type IList } from './list'
|
import ListModel from './list'
|
||||||
import UserModel, { type IUser } from './user'
|
import UserModel from './user'
|
||||||
import SubscriptionModel, { type ISubscription } from '@/models/subscription'
|
import SubscriptionModel from '@/models/subscription'
|
||||||
|
|
||||||
export interface INamespace extends AbstractModel {
|
import type {INamespace} from '@/modelTypes/INamespace'
|
||||||
id: number
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
title: string
|
import type {IList} from '@/modelTypes/IList'
|
||||||
description: string
|
import type {ISubscription} from '@/modelTypes/ISubscription'
|
||||||
owner: IUser
|
|
||||||
lists: IList[]
|
|
||||||
isArchived: boolean
|
|
||||||
hexColor: string
|
|
||||||
subscription: ISubscription
|
|
||||||
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class NamespaceModel extends AbstractModel implements INamespace {
|
export default class NamespaceModel extends AbstractModel implements INamespace {
|
||||||
declare id: number
|
declare id: number
|
||||||
declare title: string
|
declare title: string
|
||||||
declare description: string
|
declare description: string
|
||||||
owner: IUser
|
owner: IUser
|
||||||
lists: IList[]
|
declare lists: IList[]
|
||||||
declare isArchived: boolean
|
declare isArchived: boolean
|
||||||
declare hexColor: string
|
declare hexColor: string
|
||||||
declare subscription: ISubscription
|
declare subscription: ISubscription
|
||||||
|
@ -37,9 +28,9 @@ export default class NamespaceModel extends AbstractModel implements INamespace
|
||||||
this.hexColor = '#' + this.hexColor
|
this.hexColor = '#' + this.hexColor
|
||||||
}
|
}
|
||||||
|
|
||||||
this.lists = this.lists.map(l => {
|
this.lists = this.lists?.map(l => {
|
||||||
return new ListModel(l)
|
return new ListModel(l)
|
||||||
})
|
}) || []
|
||||||
|
|
||||||
this.owner = new UserModel(this.owner)
|
this.owner = new UserModel(this.owner)
|
||||||
|
|
||||||
|
|
|
@ -1,59 +1,17 @@
|
||||||
import AbstractModel from '@/models/abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
||||||
import UserModel, { type IUser } from '@/models/user'
|
import UserModel from '@/models/user'
|
||||||
import TaskModel, { type ITask } from '@/models/task'
|
import TaskModel from '@/models/task'
|
||||||
import TaskCommentModel, { type ITaskComment } from '@/models/taskComment'
|
import TaskCommentModel from '@/models/taskComment'
|
||||||
import ListModel from '@/models/list'
|
import ListModel from '@/models/list'
|
||||||
import TeamModel, { type ITeam } from '@/models/team'
|
import TeamModel from '@/models/team'
|
||||||
|
|
||||||
export const NOTIFICATION_NAMES = {
|
import {NOTIFICATION_NAMES, type INotification} from '@/modelTypes/INotification'
|
||||||
'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
|
|
||||||
}
|
|
||||||
|
|
||||||
interface NotificationMemberAdded extends Notification {
|
|
||||||
member: IUser
|
|
||||||
team: ITeam
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface INotification extends AbstractModel {
|
|
||||||
id: number
|
|
||||||
name: string
|
|
||||||
notification: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded
|
|
||||||
read: boolean
|
|
||||||
readAt: Date | null
|
|
||||||
|
|
||||||
created: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class NotificationModel extends AbstractModel implements INotification {
|
export default class NotificationModel extends AbstractModel implements INotification {
|
||||||
declare id: number
|
declare id: number
|
||||||
declare name: string
|
declare name: string
|
||||||
declare notification: NotificationTask | NotificationAssigned | NotificationDeleted | NotificationCreated | NotificationMemberAdded
|
declare notification: INotification['notification']
|
||||||
declare read: boolean
|
declare read: boolean
|
||||||
readAt: Date | null
|
readAt: Date | null
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
|
||||||
export interface IPasswordReset extends AbstractModel {
|
import type {IPasswordReset} from '@/modelTypes/IPasswordReset'
|
||||||
token: string
|
|
||||||
newPassword: string
|
|
||||||
email: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class PasswordResetModel extends AbstractModel implements IPasswordReset {
|
export default class PasswordResetModel extends AbstractModel implements IPasswordReset {
|
||||||
token: string
|
token: string
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
import AbstractModel from '@/models/abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
|
||||||
export interface IPasswordUpdate extends AbstractModel {
|
import type {IPasswordUpdate} from '@/modelTypes/IPasswordUpdate'
|
||||||
newPassword: string
|
|
||||||
oldPassword: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class PasswordUpdateModel extends AbstractModel implements IPasswordUpdate {
|
export default class PasswordUpdateModel extends AbstractModel implements IPasswordUpdate {
|
||||||
declare newPassword: string
|
declare newPassword: string
|
||||||
|
|
|
@ -1,38 +1,14 @@
|
||||||
import AbstractModel from '@/models/abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from '@/models/user'
|
import UserModel from '@/models/user'
|
||||||
|
|
||||||
export interface ISavedFilter extends AbstractModel {
|
import type {ISavedFilter} from '@/modelTypes/ISavedFilter'
|
||||||
id: 0
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
title: string
|
|
||||||
description: string
|
|
||||||
filters: {
|
|
||||||
sortBy: ('done' | 'id')[]
|
|
||||||
orderBy: ('asc' | 'desc')[]
|
|
||||||
filterBy: 'done'[]
|
|
||||||
filterValue: 'false'[]
|
|
||||||
filterComparator: 'equals'[]
|
|
||||||
filterConcat: 'and'
|
|
||||||
filterIncludeNulls: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
owner: IUser
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class SavedFilterModel extends AbstractModel implements ISavedFilter {
|
export default class SavedFilterModel extends AbstractModel implements ISavedFilter {
|
||||||
declare id: 0
|
declare id: 0
|
||||||
declare title: string
|
declare title: string
|
||||||
declare description: string
|
declare description: string
|
||||||
declare filters: {
|
declare filters: ISavedFilter['filters']
|
||||||
sortBy: ('done' | 'id')[]
|
|
||||||
orderBy: ('asc' | 'desc')[]
|
|
||||||
filterBy: 'done'[]
|
|
||||||
filterValue: 'false'[]
|
|
||||||
filterComparator: 'equals'[]
|
|
||||||
filterConcat: 'and'
|
|
||||||
filterIncludeNulls: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
owner: IUser
|
owner: IUser
|
||||||
created: Date
|
created: Date
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
import AbstractModel from '@/models/abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from '@/models/user'
|
import UserModel from '@/models/user'
|
||||||
|
|
||||||
export interface ISubscription extends AbstractModel {
|
import type {ISubscription} from '@/modelTypes/ISubscription'
|
||||||
id: number
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
entity: string // FIXME: correct type?
|
|
||||||
entityId: number // FIXME: correct type?
|
|
||||||
user: IUser
|
|
||||||
|
|
||||||
created: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class SubscriptionModel extends AbstractModel implements ISubscription {
|
export default class SubscriptionModel extends AbstractModel implements ISubscription {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,63 +1,32 @@
|
||||||
import type { Priority } from '@/models/constants/priorities'
|
|
||||||
|
|
||||||
import AbstractModel from '@/models/abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from '@/models/user'
|
import UserModel from '@/models/user'
|
||||||
import LabelModel, { type ILabel } from '@/models/label'
|
import LabelModel from '@/models/label'
|
||||||
import AttachmentModel, {type IAttachment} from '@/models/attachment'
|
import AttachmentModel from '@/models/attachment'
|
||||||
import SubscriptionModel, { type ISubscription } from '@/models/subscription'
|
import SubscriptionModel from '@/models/subscription'
|
||||||
import type { IList } from '@/models/list'
|
|
||||||
import type {IRepeats} from '@/types/IRepeats'
|
import type {Priority} from '@/modelTypes/constants/priorities'
|
||||||
|
import {TASK_REPEAT_MODES, type ITask, type TaskRepeatMode} from '@/modelTypes/ITask'
|
||||||
|
import type {ILabel} from '@/modelTypes/ILabel'
|
||||||
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
|
import type {IAttachment} from '@/modelTypes/IAttachment'
|
||||||
|
import type {IList} from '@/modelTypes/IList'
|
||||||
|
import type {ISubscription} from '@/modelTypes/ISubscription'
|
||||||
|
import type {IBucket} from '@/modelTypes/IBucket'
|
||||||
|
|
||||||
|
import type {IRepeats} from '@/types/IRepeats'
|
||||||
|
|
||||||
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
||||||
import type { IBucket } from './bucket'
|
|
||||||
|
|
||||||
const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype
|
const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype
|
||||||
export const TASK_DEFAULT_COLOR = '#1973ff'
|
export const TASK_DEFAULT_COLOR = '#1973ff'
|
||||||
|
|
||||||
export const TASK_REPEAT_MODES = {
|
export function getHexColor(hexColor: string) {
|
||||||
'REPEAT_MODE_DEFAULT': 0,
|
if (hexColor === '' || hexColor === '#') {
|
||||||
'REPEAT_MODE_MONTH': 1,
|
return TASK_DEFAULT_COLOR
|
||||||
'REPEAT_MODE_FROM_CURRENT_DATE': 2,
|
}
|
||||||
} as const
|
|
||||||
|
|
||||||
export type TaskRepeatMode = typeof TASK_REPEAT_MODES[keyof typeof TASK_REPEAT_MODES]
|
return hexColor
|
||||||
|
|
||||||
export interface ITask extends AbstractModel {
|
|
||||||
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 | IRepeats
|
|
||||||
repeatFromCurrentDate: boolean
|
|
||||||
repeatMode: TaskRepeatMode
|
|
||||||
reminderDates: Date[]
|
|
||||||
parentTaskId: ITask['id']
|
|
||||||
hexColor: string
|
|
||||||
percentDone: number
|
|
||||||
relatedTasks: { [relationKind: string]: ITask } // FIXME: use relationKinds
|
|
||||||
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']
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class TaskModel extends AbstractModel implements ITask {
|
export default class TaskModel extends AbstractModel implements ITask {
|
||||||
|
@ -98,20 +67,23 @@ export default class TaskModel extends AbstractModel implements ITask {
|
||||||
declare bucketId: IBucket['id']
|
declare bucketId: IBucket['id']
|
||||||
|
|
||||||
constructor(data: Partial<ITask>) {
|
constructor(data: Partial<ITask>) {
|
||||||
super(data)
|
console.log({titleData: data?.title})
|
||||||
|
const result = super(data)
|
||||||
|
console.log({titleResult: result?.title})
|
||||||
|
console.log({titleSuper: this?.title})
|
||||||
|
|
||||||
this.id = Number(this.id)
|
this.id = Number(this.id)
|
||||||
this.title = this.title?.trim()
|
this.title = this.title?.trim()
|
||||||
this.doneAt = parseDateOrNull(this.doneAt)
|
this.doneAt = parseDateOrNull(this.doneAt)
|
||||||
|
|
||||||
this.labels = this.labels
|
this.labels = this.labels
|
||||||
.map(l => new LabelModel(l))
|
?.map(l => new LabelModel(l))
|
||||||
.sort((f, s) => f.title > s.title ? 1 : -1)
|
.sort((f, s) => f.title > s.title ? 1 : -1) || []
|
||||||
|
|
||||||
// Parse the assignees into user models
|
// Parse the assignees into user models
|
||||||
this.assignees = this.assignees.map(a => {
|
this.assignees = this.assignees?.map(a => {
|
||||||
return new UserModel(a)
|
return new UserModel(a)
|
||||||
})
|
}) || []
|
||||||
|
|
||||||
this.dueDate = parseDateOrNull(this.dueDate)
|
this.dueDate = parseDateOrNull(this.dueDate)
|
||||||
this.startDate = parseDateOrNull(this.startDate)
|
this.startDate = parseDateOrNull(this.startDate)
|
||||||
|
@ -120,7 +92,7 @@ export default class TaskModel extends AbstractModel implements ITask {
|
||||||
// Parse the repeat after into something usable
|
// Parse the repeat after into something usable
|
||||||
this.parseRepeatAfter()
|
this.parseRepeatAfter()
|
||||||
|
|
||||||
this.reminderDates = this.reminderDates.map(d => new Date(d))
|
this.reminderDates = this.reminderDates?.map(d => new Date(d)) || []
|
||||||
|
|
||||||
// Cancel all scheduled notifications for this task to be sure to only have available notifications
|
// Cancel all scheduled notifications for this task to be sure to only have available notifications
|
||||||
this.cancelScheduledNotifications().then(() => {
|
this.cancelScheduledNotifications().then(() => {
|
||||||
|
@ -140,7 +112,7 @@ export default class TaskModel extends AbstractModel implements ITask {
|
||||||
})
|
})
|
||||||
|
|
||||||
// Make all attachments to attachment models
|
// Make all attachments to attachment models
|
||||||
this.attachments = this.attachments.map(a => new AttachmentModel(a))
|
this.attachments = this.attachments?.map(a => new AttachmentModel(a)) || []
|
||||||
|
|
||||||
// Set the task identifier to empty if the list does not have one
|
// Set the task identifier to empty if the list does not have one
|
||||||
if (this.identifier === `-${this.index}`) {
|
if (this.identifier === `-${this.index}`) {
|
||||||
|
@ -152,6 +124,7 @@ export default class TaskModel extends AbstractModel implements ITask {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.createdBy = new UserModel(this.createdBy)
|
this.createdBy = new UserModel(this.createdBy)
|
||||||
|
// console.log(JSON.parse(JSON.stringify(this)), this.created)
|
||||||
this.created = new Date(this.created)
|
this.created = new Date(this.created)
|
||||||
this.updated = new Date(this.updated)
|
this.updated = new Date(this.updated)
|
||||||
|
|
||||||
|
@ -207,11 +180,7 @@ export default class TaskModel extends AbstractModel implements ITask {
|
||||||
}
|
}
|
||||||
|
|
||||||
getHexColor() {
|
getHexColor() {
|
||||||
if (this.hexColor === '' || this.hexColor === '#') {
|
return getHexColor(this.hexColor)
|
||||||
return TASK_DEFAULT_COLOR
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.hexColor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////
|
/////////////////
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import type { ITask } from './task'
|
|
||||||
import type { IUser } from './user'
|
|
||||||
|
|
||||||
export interface ITaskAssignee extends AbstractModel {
|
import type {ITaskAssignee} from '@/modelTypes/ITaskAssignee'
|
||||||
created: Date
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
userId: IUser['id']
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
taskId: ITask['id']
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class TaskAssigneeModel extends AbstractModel implements ITaskAssignee {
|
export default class TaskAssigneeModel extends AbstractModel implements ITaskAssignee {
|
||||||
created: Date
|
created: Date
|
||||||
|
|
|
@ -1,16 +1,9 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from './user'
|
import UserModel from './user'
|
||||||
import type { ITask } from './task'
|
|
||||||
|
|
||||||
export interface ITaskComment extends AbstractModel {
|
import type {ITaskComment} from '@/modelTypes/ITaskComment'
|
||||||
id: number
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
taskId: ITask['id']
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
comment: string
|
|
||||||
author: IUser
|
|
||||||
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class TaskCommentModel extends AbstractModel implements ITaskComment {
|
export default class TaskCommentModel extends AbstractModel implements ITaskComment {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,39 +1,17 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from './user'
|
import UserModel from './user'
|
||||||
import type { ITask } from './task'
|
|
||||||
|
|
||||||
export const RELATION_KIND = {
|
import type {ITaskRelation} from '@/modelTypes/ITaskRelation'
|
||||||
'SUBTASK': 'subtask',
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
'PARENTTASK': 'parenttask',
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
'RELATED': 'related',
|
|
||||||
'DUPLICATES': 'duplicates',
|
|
||||||
'BLOCKING': 'blocking',
|
|
||||||
'BLOCKED': 'blocked',
|
|
||||||
'PROCEDES': 'precedes',
|
|
||||||
'FOLLOWS': 'follows',
|
|
||||||
'COPIEDFROM': 'copiedfrom',
|
|
||||||
'COPIEDTO': 'copiedto',
|
|
||||||
} as const
|
|
||||||
|
|
||||||
export const RELATION_KINDS = [...Object.values(RELATION_KIND)] as const
|
import type {IRelationKind} from '@/types/IRelationKind'
|
||||||
|
|
||||||
export type RelationKind = typeof RELATION_KINDS[number]
|
|
||||||
|
|
||||||
export interface ITaskRelation extends AbstractModel {
|
|
||||||
id: number
|
|
||||||
otherTaskId: ITask['id']
|
|
||||||
taskId: ITask['id']
|
|
||||||
relationKind: RelationKind
|
|
||||||
|
|
||||||
createdBy: IUser
|
|
||||||
created: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class TaskRelationModel extends AbstractModel implements ITaskRelation {
|
export default class TaskRelationModel extends AbstractModel implements ITaskRelation {
|
||||||
declare id: number
|
declare id: number
|
||||||
declare otherTaskId: ITask['id']
|
declare otherTaskId: ITask['id']
|
||||||
declare taskId: ITask['id']
|
declare taskId: ITask['id']
|
||||||
declare relationKind: RelationKind
|
declare relationKind: IRelationKind
|
||||||
|
|
||||||
createdBy: IUser
|
createdBy: IUser
|
||||||
created: Date
|
created: Date
|
||||||
|
|
|
@ -1,19 +1,11 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserModel, { type IUser } from './user'
|
import UserModel from './user'
|
||||||
import TeamMemberModel, { type ITeamMember } from './teamMember'
|
import TeamMemberModel from './teamMember'
|
||||||
import {RIGHTS, type Right} from '@/models/constants/rights'
|
|
||||||
|
|
||||||
export interface ITeam extends AbstractModel {
|
import {RIGHTS, type Right} from '@/modelTypes/constants/rights'
|
||||||
id: number
|
import type {ITeam} from '@/modelTypes/ITeam'
|
||||||
name: string
|
import type {ITeamMember} from '@/modelTypes/ITeamMember'
|
||||||
description: string
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
members: ITeamMember[]
|
|
||||||
right: Right
|
|
||||||
|
|
||||||
createdBy: IUser
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class TeamModel extends AbstractModel implements ITeam {
|
export default class TeamModel extends AbstractModel implements ITeam {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import TeamShareBaseModel from './teamShareBase'
|
import TeamShareBaseModel from './teamShareBase'
|
||||||
import type { IList } from './list'
|
|
||||||
|
|
||||||
export interface ITeamList extends TeamShareBaseModel {
|
import type {ITeamList} from '@/modelTypes/ITeamList'
|
||||||
listId: IList['id']
|
import type {IList} from '@/modelTypes/IList'
|
||||||
}
|
|
||||||
|
|
||||||
export default class TeamListModel extends TeamShareBaseModel implements ITeamList {
|
export default class TeamListModel extends TeamShareBaseModel implements ITeamList {
|
||||||
declare listId: IList['id']
|
declare listId: IList['id']
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import UserModel from './user'
|
import UserModel from './user'
|
||||||
import type { IList } from './list'
|
|
||||||
|
|
||||||
export interface ITeamMember extends UserModel {
|
import type {ITeamMember} from '@/modelTypes/ITeamMember'
|
||||||
admin: boolean
|
import type {IList} from '@/modelTypes/IList'
|
||||||
teamId: IList['id']
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class TeamMemberModel extends UserModel implements ITeamMember {
|
export default class TeamMemberModel extends UserModel implements ITeamMember {
|
||||||
declare admin: boolean
|
declare admin: boolean
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import TeamShareBaseModel from './teamShareBase'
|
import TeamShareBaseModel from './teamShareBase'
|
||||||
import type { INamespace } from './namespace'
|
|
||||||
|
|
||||||
export interface ITeamNamespace extends TeamShareBaseModel {
|
import type {ITeamNamespace} from '@/modelTypes/ITeamNamespace'
|
||||||
namespaceId: INamespace['id']
|
import type {INamespace} from '@/modelTypes/INamespace'
|
||||||
}
|
|
||||||
|
|
||||||
export default class TeamNamespaceModel extends TeamShareBaseModel implements ITeamNamespace {
|
export default class TeamNamespaceModel extends TeamShareBaseModel implements ITeamNamespace {
|
||||||
declare namespaceId: INamespace['id']
|
declare namespaceId: INamespace['id']
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import {RIGHTS, type Right} from '@/models/constants/rights'
|
|
||||||
import type { ITeam } from './team'
|
|
||||||
|
|
||||||
export interface ITeamShareBase extends AbstractModel {
|
import {RIGHTS, type Right} from '@/modelTypes/constants/rights'
|
||||||
teamId: ITeam['id']
|
import type {ITeamShareBase} from '@/modelTypes/ITeamShareBase'
|
||||||
right: Right
|
import type {ITeam} from '@/modelTypes/ITeam'
|
||||||
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a base class for common team sharing model.
|
* This class is a base class for common team sharing model.
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
|
|
||||||
export interface ITotp extends AbstractModel {
|
import type {ITotp} from '@/modelTypes/ITotp'
|
||||||
secret: string
|
|
||||||
enabled: boolean
|
|
||||||
url: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class TotpModel extends AbstractModel implements ITotp{
|
export default class TotpModel extends AbstractModel implements ITotp {
|
||||||
declare secret: string
|
declare secret: string
|
||||||
declare enabled: boolean
|
declare enabled: boolean
|
||||||
declare url: string
|
declare url: string
|
||||||
|
|
|
@ -1,16 +1,8 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import UserSettingsModel, { type IUserSettings } from '@/models/userSettings'
|
import UserSettingsModel from '@/models/userSettings'
|
||||||
|
|
||||||
export interface IUser extends AbstractModel {
|
import type { IUser } from '@/modelTypes/IUser'
|
||||||
id: number
|
import type { IUserSettings } from '@/modelTypes/IUserSettings'
|
||||||
email: string
|
|
||||||
username: string
|
|
||||||
name: string
|
|
||||||
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
settings: IUserSettings
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class UserModel extends AbstractModel implements IUser {
|
export default class UserModel extends AbstractModel implements IUser {
|
||||||
declare id: number
|
declare id: number
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import UserShareBaseModel from './userShareBase'
|
import UserShareBaseModel from './userShareBase'
|
||||||
import type { IList } from './list'
|
|
||||||
|
|
||||||
export interface IUserList extends UserShareBaseModel {
|
import type {IUserList} from '@/modelTypes/IUserList'
|
||||||
listId: IList['id']
|
import type {IList} from '@/modelTypes/IList'
|
||||||
}
|
|
||||||
|
|
||||||
// This class extends the user share model with a 'rights' parameter which is used in sharing
|
// This class extends the user share model with a 'rights' parameter which is used in sharing
|
||||||
export default class UserListModel extends UserShareBaseModel implements IUserList {
|
export default class UserListModel extends UserShareBaseModel implements IUserList {
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import UserShareBaseModel from './userShareBase'
|
import UserShareBaseModel from './userShareBase'
|
||||||
import type { INamespace } from './namespace'
|
|
||||||
|
|
||||||
export interface IUserNamespace extends UserShareBaseModel {
|
import type {INamespace} from '@/modelTypes/INamespace'
|
||||||
namespaceId: INamespace['id']
|
import type {IUserNamespace} from '@/modelTypes/IUserNamespace'
|
||||||
}
|
|
||||||
|
|
||||||
// This class extends the user share model with a 'rights' parameter which is used in sharing
|
// This class extends the user share model with a 'rights' parameter which is used in sharing
|
||||||
export default class UserNamespaceModel extends UserShareBaseModel implements IUserNamespace {
|
export default class UserNamespaceModel extends UserShareBaseModel implements IUserNamespace {
|
||||||
|
|
|
@ -1,17 +1,8 @@
|
||||||
|
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import type { IList } from './list'
|
|
||||||
|
|
||||||
export interface IUserSettings extends AbstractModel {
|
import type {IUserSettings} from '@/modelTypes/IUserSettings'
|
||||||
name: string
|
import type {IList} from '@/modelTypes/IList'
|
||||||
emailRemindersEnabled: boolean
|
|
||||||
discoverableByName: boolean
|
|
||||||
discoverableByEmail: boolean
|
|
||||||
overdueTasksRemindersEnabled: boolean
|
|
||||||
defaultListId: undefined | IList['id']
|
|
||||||
weekStart: 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
||||||
timezone: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class UserSettingsModel extends AbstractModel implements IUserSettings {
|
export default class UserSettingsModel extends AbstractModel implements IUserSettings {
|
||||||
declare name: string
|
declare name: string
|
||||||
|
@ -20,7 +11,7 @@ export default class UserSettingsModel extends AbstractModel implements IUserSet
|
||||||
declare discoverableByEmail: boolean
|
declare discoverableByEmail: boolean
|
||||||
declare overdueTasksRemindersEnabled: boolean
|
declare overdueTasksRemindersEnabled: boolean
|
||||||
declare defaultListId: undefined | IList['id']
|
declare defaultListId: undefined | IList['id']
|
||||||
declare weekStart: 0 | 1 | 2 | 3 | 4 | 5 | 6
|
declare weekStart: IUserSettings['weekStart']
|
||||||
declare timezone: string
|
declare timezone: string
|
||||||
|
|
||||||
defaults() {
|
defaults() {
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
import AbstractModel from './abstractModel'
|
import AbstractModel from './abstractModel'
|
||||||
import {RIGHTS, type Right} from '@/models/constants/rights'
|
|
||||||
import type { IUser } from './user'
|
|
||||||
|
|
||||||
export interface IUserShareBase extends AbstractModel {
|
import {RIGHTS, type Right} from '@/modelTypes/constants/rights'
|
||||||
userId: IUser['id']
|
import type {IUserShareBase} from '@/modelTypes/IUserShareBase'
|
||||||
right: Right
|
import type {IUser} from '@/modelTypes/IUser'
|
||||||
|
|
||||||
created: Date
|
|
||||||
updated: Date
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class UserShareBaseModel extends AbstractModel implements IUserShareBase {
|
export default class UserShareBaseModel extends AbstractModel implements IUserShareBase {
|
||||||
declare userId: IUser['id']
|
declare userId: IUser['id']
|
||||||
|
|
|
@ -2,7 +2,7 @@ import axios , { type Method } from 'axios'
|
||||||
import {objectToSnakeCase} from '@/helpers/case'
|
import {objectToSnakeCase} from '@/helpers/case'
|
||||||
import {getToken} from '@/helpers/auth'
|
import {getToken} from '@/helpers/auth'
|
||||||
import AbstractModel, { type IAbstract } from '@/models/abstractModel'
|
import AbstractModel, { type IAbstract } from '@/models/abstractModel'
|
||||||
import type { Right } from '@/models/constants/rights'
|
import type { Right } from '@/modelTypes/constants/rights'
|
||||||
import type { IFile } from '@/models/file'
|
import type { IFile } from '@/models/file'
|
||||||
|
|
||||||
interface Paths {
|
interface Paths {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import type {InjectionKey} from 'vue'
|
import type {InjectionKey} from 'vue'
|
||||||
import {createStore, useStore as baseUseStore, Store} from 'vuex'
|
import {createStore, useStore as baseUseStore, Store} from 'vuex'
|
||||||
|
|
||||||
|
|
||||||
import {getBlobFromBlurHash} from '../helpers/getBlobFromBlurHash'
|
import {getBlobFromBlurHash} from '../helpers/getBlobFromBlurHash'
|
||||||
import {
|
import {
|
||||||
BACKGROUND,
|
BACKGROUND,
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type { Module } from 'vuex'
|
||||||
import {findIndexById} from '@/helpers/utils'
|
import {findIndexById} from '@/helpers/utils'
|
||||||
|
|
||||||
import type { AttachmentState, RootStoreState } from '@/store/types'
|
import type { AttachmentState, RootStoreState } from '@/store/types'
|
||||||
import type { IAttachment } from '@/models/attachment'
|
import type { IAttachment } from '@/modelTypes/IAttachment'
|
||||||
|
|
||||||
const store : Module<AttachmentState, RootStoreState> = {
|
const store : Module<AttachmentState, RootStoreState> = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {success} from '@/message'
|
||||||
import {redirectToProvider} from '@/helpers/redirectToProvider'
|
import {redirectToProvider} from '@/helpers/redirectToProvider'
|
||||||
import type { RootStoreState, AuthState, Info} from '@/store/types'
|
import type { RootStoreState, AuthState, Info} from '@/store/types'
|
||||||
import {AUTH_TYPES} from '@/store/types'
|
import {AUTH_TYPES} from '@/store/types'
|
||||||
import type { IUserSettings } from '@/models/userSettings'
|
import type { IUserSettings } from '@/modelTypes/IUserSettings'
|
||||||
|
|
||||||
|
|
||||||
const defaultSettings = settings => {
|
const defaultSettings = settings => {
|
||||||
|
|
|
@ -9,9 +9,9 @@ import BucketService from '../../services/bucket'
|
||||||
import {setLoading} from '../helper'
|
import {setLoading} from '../helper'
|
||||||
import TaskCollectionService from '@/services/taskCollection'
|
import TaskCollectionService from '@/services/taskCollection'
|
||||||
import type { RootStoreState, KanbanState } from '@/store/types'
|
import type { RootStoreState, KanbanState } from '@/store/types'
|
||||||
import type { ITask } from '@/models/task'
|
import type { ITask } from '@/modelTypes/ITask'
|
||||||
import type { IList } from '@/models/list'
|
import type { IList } from '@/modelTypes/IList'
|
||||||
import type { IBucket } from '@/models/bucket'
|
import type { IBucket } from '@/modelTypes/IBucket'
|
||||||
|
|
||||||
const TASKS_PER_BUCKET = 25
|
const TASKS_PER_BUCKET = 25
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {setLoading} from '@/store/helper'
|
||||||
import type { LabelState, RootStoreState } from '@/store/types'
|
import type { LabelState, RootStoreState } from '@/store/types'
|
||||||
import {getLabelsByIds, filterLabelsByQuery} from '@/helpers/labels'
|
import {getLabelsByIds, filterLabelsByQuery} from '@/helpers/labels'
|
||||||
import {createNewIndexer} from '@/indexes'
|
import {createNewIndexer} from '@/indexes'
|
||||||
import type { ILabel } from '@/models/label'
|
import type { ILabel } from '@/modelTypes/ILabel'
|
||||||
|
|
||||||
const {add, remove, update} = createNewIndexer('labels', ['title', 'description'])
|
const {add, remove, update} = createNewIndexer('labels', ['title', 'description'])
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {setLoading} from '@/store/helper'
|
||||||
import {removeListFromHistory} from '@/modules/listHistory'
|
import {removeListFromHistory} from '@/modules/listHistory'
|
||||||
import {createNewIndexer} from '@/indexes'
|
import {createNewIndexer} from '@/indexes'
|
||||||
import type {ListState, RootStoreState} from '@/store/types'
|
import type {ListState, RootStoreState} from '@/store/types'
|
||||||
import type {IList} from '@/models/list'
|
import type {IList} from '@/modelTypes/IList'
|
||||||
|
|
||||||
const {add, remove, search, update} = createNewIndexer('lists', ['title', 'description'])
|
const {add, remove, search, update} = createNewIndexer('lists', ['title', 'description'])
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ import NamespaceService from '../../services/namespace'
|
||||||
import {setLoading} from '@/store/helper'
|
import {setLoading} from '@/store/helper'
|
||||||
import {createNewIndexer} from '@/indexes'
|
import {createNewIndexer} from '@/indexes'
|
||||||
import type {NamespaceState, RootStoreState} from '@/store/types'
|
import type {NamespaceState, RootStoreState} from '@/store/types'
|
||||||
import type {INamespace} from '@/models/namespace'
|
import type {INamespace} from '@/modelTypes/INamespace'
|
||||||
import type {IList} from '@/models/list'
|
import type {IList} from '@/modelTypes/IList'
|
||||||
|
|
||||||
const {add, remove, search, update} = createNewIndexer('namespaces', ['title', 'description'])
|
const {add, remove, search, update} = createNewIndexer('namespaces', ['title', 'description'])
|
||||||
|
|
||||||
|
|
|
@ -4,22 +4,27 @@ import {formatISO} from 'date-fns'
|
||||||
|
|
||||||
import TaskService from '@/services/task'
|
import TaskService from '@/services/task'
|
||||||
import TaskAssigneeService from '@/services/taskAssignee'
|
import TaskAssigneeService from '@/services/taskAssignee'
|
||||||
import TaskAssigneeModel from '@/models/taskAssignee'
|
|
||||||
import LabelTaskModel from '@/models/labelTask'
|
|
||||||
import LabelTaskService from '@/services/labelTask'
|
import LabelTaskService from '@/services/labelTask'
|
||||||
|
import UserService from '@/services/user'
|
||||||
|
|
||||||
import {HAS_TASKS} from '../mutation-types'
|
import {HAS_TASKS} from '../mutation-types'
|
||||||
import {setLoading} from '../helper'
|
import {setLoading} from '../helper'
|
||||||
import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode'
|
import {getQuickAddMagicMode} from '@/helpers/quickAddMagicMode'
|
||||||
|
|
||||||
import {parseTaskText} from '@/modules/parseTaskText'
|
import {parseTaskText} from '@/modules/parseTaskText'
|
||||||
import TaskModel, { type ITask } from '@/models/task'
|
|
||||||
|
import TaskAssigneeModel from '@/models/taskAssignee'
|
||||||
|
import LabelTaskModel from '@/models/labelTask'
|
||||||
|
import TaskModel from '@/models/task'
|
||||||
import LabelTask from '@/models/labelTask'
|
import LabelTask from '@/models/labelTask'
|
||||||
import LabelModel, { type ILabel } from '@/models/label'
|
import LabelModel from '@/models/label'
|
||||||
import UserService from '@/services/user'
|
|
||||||
|
import type {ILabel} from '@/modelTypes/ILabel'
|
||||||
|
import type {ITask} from '@/modelTypes/ITask'
|
||||||
|
import type { IUser } from '@/modelTypes/IUser'
|
||||||
|
import type { IAttachment } from '@/modelTypes/IAttachment'
|
||||||
|
import type { IList } from '@/modelTypes/IList'
|
||||||
|
|
||||||
import type { RootStoreState, TaskState } from '@/store/types'
|
import type { RootStoreState, TaskState } from '@/store/types'
|
||||||
import type { IUser } from '@/models/user'
|
|
||||||
import type { IAttachment } from '@/models/attachment'
|
|
||||||
import type { IList } from '@/models/list'
|
|
||||||
|
|
||||||
// IDEA: maybe use a small fuzzy search here to prevent errors
|
// IDEA: maybe use a small fuzzy search here to prevent errors
|
||||||
function findPropertyByValue(object, key, value) {
|
function findPropertyByValue(object, key, value) {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import type { IBucket } from '@/models/bucket'
|
import type { IBucket } from '@/modelTypes/IBucket'
|
||||||
import type { IUserSettings } from '@/models/userSettings'
|
import type { IUserSettings } from '@/modelTypes/IUserSettings'
|
||||||
import type { IList } from '@/models/list'
|
import type { IList } from '@/modelTypes/IList'
|
||||||
import type { IAttachment } from '@/models/attachment'
|
import type { IAttachment } from '@/modelTypes/IAttachment'
|
||||||
import type { ILabel } from '@/models/label'
|
import type { ILabel } from '@/modelTypes/ILabel'
|
||||||
import type { INamespace } from '@/models/namespace'
|
import type { INamespace } from '@/modelTypes/INamespace'
|
||||||
|
|
||||||
export interface RootStoreState {
|
export interface RootStoreState {
|
||||||
loading: boolean,
|
loading: boolean,
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
export interface IFilter {
|
||||||
|
sortBy: ('done' | 'id')[]
|
||||||
|
orderBy: ('asc' | 'desc')[]
|
||||||
|
filterBy: 'done'[]
|
||||||
|
filterValue: 'false'[]
|
||||||
|
filterComparator: 'equals'[]
|
||||||
|
filterConcat: 'and'
|
||||||
|
filterIncludeNulls: boolean
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
export const RELATION_KIND = {
|
||||||
|
'SUBTASK': 'subtask',
|
||||||
|
'PARENTTASK': 'parenttask',
|
||||||
|
'RELATED': 'related',
|
||||||
|
'DUPLICATES': 'duplicates',
|
||||||
|
'BLOCKING': 'blocking',
|
||||||
|
'BLOCKED': 'blocked',
|
||||||
|
'PROCEDES': 'precedes',
|
||||||
|
'FOLLOWS': 'follows',
|
||||||
|
'COPIEDFROM': 'copiedfrom',
|
||||||
|
'COPIEDTO': 'copiedto',
|
||||||
|
} as const
|
||||||
|
|
||||||
|
export const RELATION_KINDS = [...Object.values(RELATION_KIND)] as const
|
||||||
|
|
||||||
|
export type IRelationKind = typeof RELATION_KINDS[number]
|
|
@ -230,7 +230,7 @@ import cloneDeep from 'lodash.clonedeep'
|
||||||
|
|
||||||
import BucketModel from '../../models/bucket'
|
import BucketModel from '../../models/bucket'
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import {RIGHTS as Rights} from '@/models/constants/rights'
|
import {RIGHTS as Rights} from '@/modelTypes/constants/rights'
|
||||||
import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
|
||||||
import ListWrapper from './ListWrapper.vue'
|
import ListWrapper from './ListWrapper.vue'
|
||||||
import FilterPopup from '@/components/list/partials/filter-popup.vue'
|
import FilterPopup from '@/components/list/partials/filter-popup.vue'
|
||||||
|
|
|
@ -144,7 +144,7 @@ import EditTask from '@/components/tasks/edit-task.vue'
|
||||||
import AddTask from '@/components/tasks/add-task.vue'
|
import AddTask from '@/components/tasks/add-task.vue'
|
||||||
import SingleTaskInList from '@/components/tasks/partials/singleTaskInList.vue'
|
import SingleTaskInList from '@/components/tasks/partials/singleTaskInList.vue'
|
||||||
import { useTaskList } from '@/composables/taskList'
|
import { useTaskList } from '@/composables/taskList'
|
||||||
import {RIGHTS as Rights} from '@/models/constants/rights'
|
import {RIGHTS as Rights} from '@/modelTypes/constants/rights'
|
||||||
import FilterPopup from '@/components/list/partials/filter-popup.vue'
|
import FilterPopup from '@/components/list/partials/filter-popup.vue'
|
||||||
import {HAS_TASKS} from '@/store/mutation-types'
|
import {HAS_TASKS} from '@/store/mutation-types'
|
||||||
import Nothing from '@/components/misc/nothing.vue'
|
import Nothing from '@/components/misc/nothing.vue'
|
||||||
|
@ -156,7 +156,7 @@ import {calculateItemPosition} from '../../helpers/calculateItemPosition'
|
||||||
import type { ITask } from '@/models/task'
|
import type { ITask } from '@/models/task'
|
||||||
|
|
||||||
function sortTasks(tasks: ITask[]) {
|
function sortTasks(tasks: ITask[]) {
|
||||||
if (tasks === null || tasks === []) {
|
if (tasks === null || Array.isArray(tasks) && tasks.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
return tasks.sort((a, b) => {
|
return tasks.sort((a, b) => {
|
||||||
|
|
|
@ -428,7 +428,7 @@ import TaskService from '../../services/task'
|
||||||
import TaskModel, { type ITask } from '@/models/task'
|
import TaskModel, { type ITask } from '@/models/task'
|
||||||
|
|
||||||
import { PRIORITIES as priorites } from '@/models/constants/priorities'
|
import { PRIORITIES as priorites } from '@/models/constants/priorities'
|
||||||
import {RIGHTS as rights} from '@/models/constants/rights'
|
import {RIGHTS as rights} from '@/modelTypes/constants/rights'
|
||||||
|
|
||||||
import PrioritySelect from '../../components/tasks/partials/prioritySelect.vue'
|
import PrioritySelect from '../../components/tasks/partials/prioritySelect.vue'
|
||||||
import PercentDoneSelect from '../../components/tasks/partials/percentDoneSelect.vue'
|
import PercentDoneSelect from '../../components/tasks/partials/percentDoneSelect.vue'
|
||||||
|
|
|
@ -170,7 +170,7 @@ import {useStore} from '@/store'
|
||||||
import TeamService from '@/services/team'
|
import TeamService from '@/services/team'
|
||||||
import TeamMemberService from '@/services/teamMember'
|
import TeamMemberService from '@/services/teamMember'
|
||||||
import UserService from '@/services/user'
|
import UserService from '@/services/user'
|
||||||
import {RIGHTS as Rights} from '@/models/constants/rights'
|
import {RIGHTS as Rights} from '@/modelTypes/constants/rights'
|
||||||
|
|
||||||
import Multiselect from '@/components/input/multiselect.vue'
|
import Multiselect from '@/components/input/multiselect.vue'
|
||||||
import {useRoute, useRouter} from 'vue-router'
|
import {useRoute, useRouter} from 'vue-router'
|
||||||
|
|
Reference in New Issue