feat: constants
This commit is contained in:
@ -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.
|
||||
|
@ -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"
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"UNSET": 0,
|
||||
"LOW": 1,
|
||||
"MEDIUM": 2,
|
||||
"HIGH": 3,
|
||||
"URGENT": 4,
|
||||
"DO_NOW": 5
|
||||
}
|
8
src/models/constants/priorities.ts
Normal file
8
src/models/constants/priorities.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export const PRIORITIES = {
|
||||
'UNSET': 0,
|
||||
'LOW': 1,
|
||||
'MEDIUM': 2,
|
||||
'HIGH': 3,
|
||||
'URGENT': 4,
|
||||
'DO_NOW': 5,
|
||||
} as const
|
@ -1,12 +0,0 @@
|
||||
[
|
||||
"subtask",
|
||||
"parenttask",
|
||||
"related",
|
||||
"duplicates",
|
||||
"blocking",
|
||||
"blocked",
|
||||
"precedes",
|
||||
"follows",
|
||||
"copiedfrom",
|
||||
"copiedto"
|
||||
]
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"READ": 0,
|
||||
"READ_WRITE": 1,
|
||||
"ADMIN": 2
|
||||
}
|
7
src/models/constants/rights.ts
Normal file
7
src/models/constants/rights.ts
Normal 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]
|
@ -1,5 +0,0 @@
|
||||
{
|
||||
"REPEAT_MODE_DEFAULT": 0,
|
||||
"REPEAT_MODE_MONTH": 1,
|
||||
"REPEAT_MODE_FROM_CURRENT_DATE": 2
|
||||
}
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user