1
0

feat: constants

This commit is contained in:
Dominik Pschenitschni
2022-06-23 03:14:58 +02:00
parent af630d3b8c
commit 8fb00653e4
27 changed files with 61 additions and 94 deletions

View File

@ -1,12 +1,13 @@
import {objectToCamelCase} from '@/helpers/case'
import {omitBy, isNil} from '@/helpers/utils'
import type {Right} from '@/models/constants/rights'
export default class AbstractModel {
/**
* The max right the user has on this object, as returned by the x-max-right header from the api.
*/
maxRight: number | null = null
maxRight: Right | null = null
/**
* The abstract constructor takes an object and merges its data with the default data of this model.

View File

@ -1,7 +0,0 @@
{
"TASK_COMMENT": "task.comment",
"TASK_ASSIGNED": "task.assigned",
"TASK_DELETED": "task.deleted",
"LIST_CREATED": "list.created",
"TEAM_MEMBER_ADDED": "team.member.added"
}

View File

@ -1,8 +0,0 @@
{
"UNSET": 0,
"LOW": 1,
"MEDIUM": 2,
"HIGH": 3,
"URGENT": 4,
"DO_NOW": 5
}

View File

@ -0,0 +1,8 @@
export const PRIORITIES = {
'UNSET': 0,
'LOW': 1,
'MEDIUM': 2,
'HIGH': 3,
'URGENT': 4,
'DO_NOW': 5,
} as const

View File

@ -1,12 +0,0 @@
[
"subtask",
"parenttask",
"related",
"duplicates",
"blocking",
"blocked",
"precedes",
"follows",
"copiedfrom",
"copiedto"
]

View File

@ -1,5 +0,0 @@
{
"READ": 0,
"READ_WRITE": 1,
"ADMIN": 2
}

View File

@ -0,0 +1,7 @@
export const RIGHTS = {
'READ': 0,
'READ_WRITE': 1,
'ADMIN': 2,
} as const
export type Right = typeof RIGHTS[keyof typeof RIGHTS]

View File

@ -1,5 +0,0 @@
{
"REPEAT_MODE_DEFAULT": 0,
"REPEAT_MODE_MONTH": 1,
"REPEAT_MODE_FROM_CURRENT_DATE": 2
}

View File

@ -1,5 +1,6 @@
import AbstractModel from './abstractModel'
import UserModel from './user'
import {RIGHTS, type Right} from '@/models/constants/rights'
export default class LinkShareModel extends AbstractModel {
id: number
@ -28,7 +29,7 @@ export default class LinkShareModel extends AbstractModel {
return {
id: 0,
hash: '',
right: 0,
right: RIGHTS.READ,
sharedBy: UserModel,
sharingType: 0,
listId: 0,

View File

@ -1,6 +1,7 @@
import AbstractModel from './abstractModel'
import UserModel from './user'
import TeamMemberModel from './teamMember'
import {RIGHTS, type Right} from '@/models/constants/rights'
export default class TeamModel extends AbstractModel {
id: 0
@ -32,7 +33,7 @@ export default class TeamModel extends AbstractModel {
name: '',
description: '',
members: [],
right: 0,
right: RIGHTS.READ,
createdBy: {},
created: null,

View File

@ -1,6 +1,6 @@
import AbstractModel from './abstractModel'
import type TeamModel from './team'
import type {Right} from '@/models/constants/rights'
import {RIGHTS, type Right} from '@/models/constants/rights'
/**
* This class is a base class for common team sharing model.
@ -22,7 +22,7 @@ export default class TeamShareBaseModel extends AbstractModel {
defaults() {
return {
teamId: 0,
right: 0,
right: RIGHTS.READ,
created: null,
updated: null,

View File

@ -1,6 +1,6 @@
import AbstractModel from './abstractModel'
import type UserModel from './user'
import type {Right} from '@/models/constants/rights'
import {RIGHTS, type Right} from '@/models/constants/rights'
export default class UserShareBaseModel extends AbstractModel {
userId: UserModel['id']
@ -18,7 +18,7 @@ export default class UserShareBaseModel extends AbstractModel {
defaults() {
return {
userId: '',
right: 0,
right: RIGHTS.READ,
created: null,
updated: null,