refactor: minor code cleanup
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -9,11 +9,11 @@ import type {
|
||||
CollectionPropertiesInterface,
|
||||
CollectionPropertiesModelInterface
|
||||
} from "@/types/collection";
|
||||
import { clonePlain } from './clone-plain';
|
||||
import type {
|
||||
CollectionIdentifier,
|
||||
ServiceIdentifier
|
||||
} from "@/types/common";
|
||||
import { clonePlain } from './clone-plain';
|
||||
|
||||
export class CollectionObject implements CollectionModelInterface {
|
||||
|
||||
@@ -28,7 +28,7 @@ export class CollectionObject implements CollectionModelInterface {
|
||||
service: '' as ServiceIdentifier,
|
||||
collection: null as CollectionIdentifier | null,
|
||||
identifier: '' as CollectionIdentifier,
|
||||
properties: { '@type': 'people:addressbook', content: [], label: '', description: null, rank: null, visibility: null, color: null },
|
||||
properties: new CollectionPropertiesObject().toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -40,12 +40,8 @@ export class CollectionObject implements CollectionModelInterface {
|
||||
|
||||
toJson(): CollectionInterface {
|
||||
const json = this._properties
|
||||
? {
|
||||
...this._data,
|
||||
properties: this._properties.toJson(),
|
||||
}
|
||||
? { ...this._data, properties: this._properties.toJson() }
|
||||
: this._data;
|
||||
|
||||
return clonePlain(json);
|
||||
}
|
||||
|
||||
@@ -83,6 +79,8 @@ export class CollectionObject implements CollectionModelInterface {
|
||||
return this._data.modified;
|
||||
}
|
||||
|
||||
/** Mutable Properties */
|
||||
|
||||
get properties(): CollectionPropertiesObject {
|
||||
if (this._properties) {
|
||||
return this._properties;
|
||||
|
||||
Reference in New Issue
Block a user