import { SafeHtml } from '@angular/platform-browser' ; import { Attachment } from './attachment.model' ; import { Category } from './category.model' ; import { Comment } from './comment.model' ; import { User } from './user.model' ; export class Task { public comments : Comment [ ] ; public attachments : Attachment [ ] ; public assignees : User [ ] ; public categories : Category [ ] ; public html : SafeHtml ; public filtered : boolean ; public hideFiltered : boolean ; constructor ( public id = 0 , public title = '' , public description = '' , public color = '#ffffe0' , public due_date = '' , public points = 0 , public position = 0 , public column_id = 0 , commentArray = [ ] , attachmentArray = [ ] , assigneeArray = [ ] , categoryArray = [ ] ) { this . comments = [ ] ; this . attachments = [ ] ; this . assignees = [ ] ; this . categories = [ ] ; commentArray . forEach ( ( comment ) => { this . comments . push ( new Comment ( + comment . id , comment . text , + comment . user_id , + comment . task_id , + comment . timestamp , + comment . is_edited === 1 ) ) ; } ) ; attachmentArray . forEach ( ( attachment ) => { this . attachments . push ( new Attachment ( + attachment . id , attachment . filename , attachment . diskfilename , attachment . name , attachment . type , + attachment . user_id , + attachment . timestamp , + attachment . task_id ) ) ; } ) ; assigneeArray . forEach ( ( user ) => { this . assignees . push ( new User ( + user . default_board_id , user . email , + user . id , user . last_login , + user . security_level , + user . user_option_id , user . username , user . board_access , user . collapsed ) ) ; } ) ; categoryArray . forEach ( ( category ) => { this . categories . push ( new Category ( + category . id , category . name , category . default_task_color , + category . board_id ) ) ; } ) ; } }