refactor: service address
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import type {
|
||||
ServiceLocation,
|
||||
ServiceModelInterface
|
||||
} from "@/types/service";
|
||||
import { ServiceAddressObject } from './address';
|
||||
import { Identity } from './identity';
|
||||
import { Location } from './location';
|
||||
import { MutationProxy } from './mutation-proxy';
|
||||
@@ -118,20 +119,20 @@ export class ServiceObject implements ServiceModelInterface {
|
||||
return this._data.capabilities ?? {};
|
||||
}
|
||||
|
||||
get primaryAddress(): string | null {
|
||||
return this._data.primaryAddress ?? null;
|
||||
get primaryAddress(): ServiceAddressObject | null {
|
||||
return this._data.primaryAddress ? ServiceAddressObject.fromJson(this._data.primaryAddress) : null;
|
||||
}
|
||||
|
||||
set primaryAddress(value: string | null) {
|
||||
this._data.primaryAddress = value;
|
||||
set primaryAddress(value: ServiceAddressObject | null) {
|
||||
this._data.primaryAddress = value ? value.toJson() : null;
|
||||
}
|
||||
|
||||
get secondaryAddresses(): string[] {
|
||||
return this._data.secondaryAddresses ?? [];
|
||||
get secondaryAddresses(): ServiceAddressObject[] {
|
||||
return (this._data.secondaryAddresses ?? []).map(entry => ServiceAddressObject.fromJson(entry));
|
||||
}
|
||||
|
||||
set secondaryAddresses(value: string[] | null) {
|
||||
this._data.secondaryAddresses = value;
|
||||
set secondaryAddresses(value: ServiceAddressObject[] | null) {
|
||||
this._data.secondaryAddresses = value ? value.map(entry => entry.toJson()) : null;
|
||||
}
|
||||
|
||||
/** Mutable Properties */
|
||||
|
||||
Reference in New Issue
Block a user