feat: flatten and reorder after all
This commit is contained in:

committed by
kolaente

parent
eb7667e27e
commit
50575ffd68
@ -5,15 +5,13 @@ export default class AbstractModel {
|
||||
|
||||
/**
|
||||
* The max right the user has on this object, as returned by the x-max-right header from the api.
|
||||
* @type {number|null}
|
||||
*/
|
||||
maxRight = null
|
||||
maxRight: number | null = null
|
||||
|
||||
/**
|
||||
* The abstract constructor takes an object and merges its data with the default data of this model.
|
||||
* @param data
|
||||
*/
|
||||
constructor(data) {
|
||||
constructor(data : Object = {}) {
|
||||
data = objectToCamelCase(data)
|
||||
|
||||
// Put all data in our model while overriding those with a value of null or undefined with their defaults
|
||||
@ -26,9 +24,8 @@ export default class AbstractModel {
|
||||
|
||||
/**
|
||||
* Default attributes that define the "empty" state.
|
||||
* @return {{}}
|
||||
*/
|
||||
defaults() {
|
||||
defaults(): Object {
|
||||
return {}
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import AbstractModel from './abstractModel'
|
||||
|
||||
export default class CaldavTokenModel extends AbstractModel {
|
||||
constructor(data) {
|
||||
super(data)
|
||||
this.created = new Date(this.created)
|
||||
}
|
||||
|
||||
defaults() {
|
||||
return {
|
||||
id: 0,
|
||||
created: null,
|
||||
}
|
||||
}
|
||||
}
|
14
src/models/caldavToken.ts
Normal file
14
src/models/caldavToken.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import AbstractModel from './abstractModel'
|
||||
|
||||
export default class CaldavTokenModel extends AbstractModel {
|
||||
id = 0
|
||||
created : undefined | Date = undefined
|
||||
|
||||
constructor(data? : Object) {
|
||||
super(data)
|
||||
|
||||
if (this.created) {
|
||||
this.created = new Date(this.created)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user