1
0

feat: improve types

This commit is contained in:
Dominik Pschenitschni
2022-07-20 21:15:35 +02:00
parent 42e72d14a4
commit c9e85cb52b
14 changed files with 52 additions and 45 deletions

View File

@ -5,4 +5,6 @@ export const PRIORITIES = {
'HIGH': 3,
'URGENT': 4,
'DO_NOW': 5,
} as const
} as const
export type Priority = typeof PRIORITIES[keyof typeof PRIORITIES]

View File

@ -6,6 +6,7 @@ import AttachmentModel from './attachment'
import SubscriptionModel from '@/models/subscription'
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
import type ListModel from './list'
import type { Priority } from './constants/priorities'
const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype
export const TASK_DEFAULT_COLOR = '#1973ff'
@ -29,7 +30,7 @@ export default class TaskModel extends AbstractModel {
description: string
done: boolean
doneAt: Date | null
priority: 0
priority: Priority
labels: LabelModel[]
assignees: UserModel[]

View File

@ -2,18 +2,20 @@ import AbstractModel from './abstractModel'
import UserModel from './user'
import type TaskModel from './task'
export const RELATION_KINDS = [
'subtask',
'parenttask',
'related',
'duplicates',
'blocking',
'blocked',
'precedes',
'follows',
'copiedfrom',
'copiedto',
] as const
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 RelationKind = typeof RELATION_KINDS[number]