refactor: minor code cleanup

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-28 12:22:15 -04:00
parent 5fbc217edb
commit 85faaa3747
2 changed files with 15 additions and 24 deletions
+5 -7
View File
@@ -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;