Cleanup code & make sure it has a common code style
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import {defaults, omitBy, isNil} from 'lodash'
|
||||
import {objectToCamelCase} from '../helpers/case'
|
||||
import {defaults, isNil, omitBy} from 'lodash'
|
||||
import {objectToCamelCase} from '@/helpers/case'
|
||||
|
||||
export default class AbstractModel {
|
||||
|
||||
|
@ -32,6 +32,6 @@ export default class FileModel extends AbstractModel {
|
||||
it++
|
||||
}
|
||||
|
||||
return Number(Math.round(size+'e2')+'e-2') + ' ' + sizes[it]
|
||||
return Number(Math.round(size + 'e2') + 'e-2') + ' ' + sizes[it]
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import AbstractModel from './abstractModel'
|
||||
import UserModel from './user'
|
||||
import {colorIsDark} from '../helpers/colorIsDark'
|
||||
import {colorIsDark} from '@/helpers/colorIsDark'
|
||||
|
||||
export default class LabelModel extends AbstractModel {
|
||||
constructor(data) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import AbstractModel from "./abstractModel";
|
||||
import AbstractModel from './abstractModel'
|
||||
|
||||
export default class LabelTask extends AbstractModel {
|
||||
defaults() {
|
||||
|
@ -3,28 +3,28 @@ import UserModel from './user'
|
||||
|
||||
export default class ListModel extends AbstractModel {
|
||||
|
||||
constructor(data) {
|
||||
// The constructor of AbstractModel handles all the default parsing.
|
||||
super(data)
|
||||
constructor(data) {
|
||||
// The constructor of AbstractModel handles all the default parsing.
|
||||
super(data)
|
||||
|
||||
this.sharedBy = new UserModel(this.sharedBy)
|
||||
this.sharedBy = new UserModel(this.sharedBy)
|
||||
|
||||
this.created = new Date(this.created)
|
||||
this.updated = new Date(this.updated)
|
||||
}
|
||||
this.created = new Date(this.created)
|
||||
this.updated = new Date(this.updated)
|
||||
}
|
||||
|
||||
// Default attributes that define the "empty" state.
|
||||
defaults() {
|
||||
return {
|
||||
id: 0,
|
||||
hash: '',
|
||||
right: 0,
|
||||
sharedBy: UserModel,
|
||||
sharingType: 0,
|
||||
listId: 0,
|
||||
// Default attributes that define the "empty" state.
|
||||
defaults() {
|
||||
return {
|
||||
id: 0,
|
||||
hash: '',
|
||||
right: 0,
|
||||
sharedBy: UserModel,
|
||||
sharingType: 0,
|
||||
listId: 0,
|
||||
|
||||
created: null,
|
||||
updated: null,
|
||||
}
|
||||
}
|
||||
created: null,
|
||||
updated: null,
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,7 @@ import TaskModel from './task'
|
||||
import UserModel from './user'
|
||||
|
||||
export default class ListModel extends AbstractModel {
|
||||
|
||||
|
||||
constructor(data) {
|
||||
super(data)
|
||||
|
||||
@ -15,7 +15,7 @@ export default class ListModel extends AbstractModel {
|
||||
this.tasks = this.tasks.map(t => {
|
||||
return new TaskModel(t)
|
||||
})
|
||||
|
||||
|
||||
this.owner = new UserModel(this.owner)
|
||||
|
||||
this.created = new Date(this.created)
|
||||
|
@ -1,12 +1,12 @@
|
||||
import AbstractModel from "./abstractModel";
|
||||
import AbstractModel from './abstractModel'
|
||||
|
||||
export default class PasswordResetModel extends AbstractModel {
|
||||
constructor(data) {
|
||||
super(data)
|
||||
|
||||
|
||||
this.token = localStorage.getItem('passwordResetToken')
|
||||
}
|
||||
|
||||
|
||||
defaults() {
|
||||
return {
|
||||
token: '',
|
||||
|
@ -1,16 +1,16 @@
|
||||
import AbstractModel from './abstractModel'
|
||||
|
||||
export default class TaskAssigneeModel extends AbstractModel {
|
||||
constructor(data) {
|
||||
super(data)
|
||||
this.created = new Date(this.created)
|
||||
}
|
||||
constructor(data) {
|
||||
super(data)
|
||||
this.created = new Date(this.created)
|
||||
}
|
||||
|
||||
defaults() {
|
||||
return {
|
||||
created: null,
|
||||
userId: 0,
|
||||
taskId: 0,
|
||||
}
|
||||
}
|
||||
defaults() {
|
||||
return {
|
||||
created: null,
|
||||
userId: 0,
|
||||
taskId: 0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ export default class TaskRelationModel extends AbstractModel {
|
||||
this.createdBy = new UserModel(this.createdBy)
|
||||
this.created = new Date(this.created)
|
||||
}
|
||||
|
||||
|
||||
defaults() {
|
||||
return {
|
||||
id: 0,
|
||||
|
@ -5,7 +5,7 @@ import TeamMemberModel from './teamMember'
|
||||
export default class TeamModel extends AbstractModel {
|
||||
constructor(data) {
|
||||
super(data)
|
||||
|
||||
|
||||
// Make the members to usermodels
|
||||
this.members = this.members.map(m => {
|
||||
return new TeamMemberModel(m)
|
||||
|
@ -7,7 +7,7 @@ export default class TeamListModel extends TeamShareBaseModel {
|
||||
super.defaults(),
|
||||
{
|
||||
listId: 0,
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ export default class TeamMemberModel extends UserModel {
|
||||
{
|
||||
admin: false,
|
||||
teamId: 0,
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ export default class TeamNamespaceModel extends TeamShareBaseModel {
|
||||
super.defaults(),
|
||||
{
|
||||
namespaceId: 0,
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
@ -15,9 +15,9 @@ export default class TeamShareBaseModel extends AbstractModel {
|
||||
return {
|
||||
teamId: 0,
|
||||
right: 0,
|
||||
|
||||
|
||||
created: null,
|
||||
updated: null
|
||||
updated: null,
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ export default class UserListModel extends UserShareBaseModel {
|
||||
super.defaults(),
|
||||
{
|
||||
listId: 0,
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import UserShareBaseModel from "./userShareBase";
|
||||
import UserShareBaseModel from './userShareBase'
|
||||
import {merge} from 'lodash'
|
||||
|
||||
// This class extends the user share model with a 'rights' parameter which is used in sharing
|
||||
@ -8,7 +8,7 @@ export default class UserNamespaceModel extends UserShareBaseModel {
|
||||
super.defaults(),
|
||||
{
|
||||
namespaceId: 0,
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ export default class UserShareBaseModel extends AbstractModel {
|
||||
return {
|
||||
userId: '',
|
||||
right: 0,
|
||||
|
||||
|
||||
created: null,
|
||||
updated: null,
|
||||
}
|
||||
|
Reference in New Issue
Block a user