async populateTamGoals()

in src/app/dashboard/dashboard.component.ts [161:218]


  async populateTamGoals(YEARLY: frequency) {


    const reminderMetaData = await this.api.ListReminderMetaDatas({
      type: {
        eq: YEARLY
      }
    });
    console.log('reminderMetaData', reminderMetaData);
    //now populate the reminders as no customer
    reminderMetaData.items.forEach(async (remindervalue, index) => {
      const reminderuuid = uuidv4();
      console.log('creating')
      await this.api.CreateReminder({
        id: reminderuuid,
        additionalAttribute: 'Not Used',
        customer: 'Team Goals',
        user: this.appcomponent.user.attributes.email,
        start: new Date().toISOString(),
        type: remindervalue.type,
        year: this.year,
        month: 0,
        week: 0
      });

      remindervalue.tasks.items.forEach(async (taskvalue, index) => {
        //console.log('Creating task for  reminder', taskvalue, remindervalue);
        const taskid = uuidv4();
        // todo : Create tasks here and attach to the reminders
        await this.api.CreateTask({
          description: taskvalue.description,
          status: false,
          id: taskid,
          taskReminderId: reminderuuid,
          title: taskvalue.title
        });
        // task create ends here

        // for each task , check if there are any mandatory comments
        //console.log('Need to add if there are any mandatory comment',taskvalue);
        taskvalue.mandatorycomments.items.forEach(async (mandatorycommentvalue, index) => {
          const mandatorycommentid = uuidv4();
          console.log('create mandatory comments for ', mandatorycommentid);

          await this.api.CreateMandatoryComment({
            mandatoryCommentTaskId: taskid,
            title: mandatorycommentvalue.title,
            id: mandatorycommentid,
            addedon: new Date().toISOString()
          });
        });
        // end code to add mandatory comments

      });


    });
  }