| /******************************************************************************** |
| * Copyright (c) 2020 Contributors to the Eclipse Foundation |
| * |
| * See the NOTICE file(s) distributed with this work for additional |
| * information regarding copyright ownership. |
| * |
| * This program and the accompanying materials are made available under the |
| * terms of the Eclipse Public License v. 2.0 which is available at |
| * http://www.eclipse.org/legal/epl-2.0. |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| ********************************************************************************/ |
| import { ExternalPerson, InternalPerson } from '@app/shared/models'; |
| import { Injectable } from '@angular/core'; |
| |
| /** |
| * Used to retrieve persons |
| * |
| * @export |
| * @class PersonsService |
| */ |
| @Injectable() |
| export class PersonsService { |
| /** |
| * Transforms external person details recieved from the API into instance of 'ExternalPerson' |
| * |
| * @param externalPerson |
| */ |
| static externalPersonDetailsAdapter(externalPerson: ExternalPerson): ExternalPerson { |
| return new ExternalPerson(externalPerson); |
| } |
| |
| /** |
| * Transforms internal person details recieved from the API into instance of 'InternalPerson' |
| * |
| * @param internalPerson |
| */ |
| static internalPersonDetailsAdapter(internalPerson: InternalPerson): InternalPerson { |
| return new InternalPerson(internalPerson); |
| } |
| } |