'use strict' ; import BaseModel from '../bases/BaseModel' ; import { ITasklistData } from 'teambition' ; class TasklistModel extends BaseModel { public getOne ( tasklistId ) { return this . _get < ITasklistData > ( 'tasklist' , tasklistId ) ; } public setOne ( tasklistId , data ) { this . _set ( 'tasklist' , tasklistId , data ) ; } public getTasklistsCollection ( projectId ) { return this . _get < ITasklistData [ ] > ( 'tasklists' , projectId ) ; } public setTasklistsCollection ( projectId , collection ) { let cache = this . getTasklistsCollection ( projectId ) ; if ( ! cache ) { this . _set ( 'tasklists' , projectId , collection ) ; } angular . forEach ( collection , ( tasklist , index ) => { this . setOne ( tasklist . _id , tasklist ) ; } ) ; } } export default new TasklistModel ( ) ;