'use strict' ; import BaseModel from '../bases/BaseModel' ; import { ILinkedData } from 'teambition' ; class ObjectLinkModel extends BaseModel { public set ( link ) { this . _set ( 'link' , link . _id , link ) ; } public update ( parentType , parentId , patch ) { this . _updateObj ( `${ parentType }:link` , parentId , patch ) ; } public setLinks ( parentType , parentId , links ) { angular . forEach ( links , ( link ) => { this . set ( link ) ; } ) ; this . _set ( `${ parentType }:link` , parentId , links ) ; } public getLinks ( parentType , parentId ) { return this . _get < ILinkedData [ ] > ( `${ parentType }:link` , parentId ) ; } } export default new ObjectLinkModel ( ) ;