message: API: Add processLecturesFor Course.ts schema method
diff: @@ -17,6 +17,7 @@ interface ICourseModel extends ICourse, mongoose.Document {
  exportJSON: (sanitize?: boolean) => Promise<ICourse>;
  checkPrivileges: (user: IUser) => IProperties;
  forDashboard: (user: IUser) => ICourseDashboard;
  + processLecturesFor: (user: IUser) => Promise<this>;
  }
  interface ICourseMongoose extends mongoose.Model<ICourseModel> {
  getSanitized: (user: IUser, courses: ICourseModel[], targets: ICourseObt) => Promise<IProperties[]>;
  @@ -230,6 +231,13 @@ courseSchema.methods.forDashboard = function (user: IUser): ICourseDashboard {
  };
  };
  +courseSchema.methods.processLecturesFor = async function (user: IUser) {
  + this.lectures = await Promise.all(this.lectures.map(async (lecture: ILectureModel) => {
  + return await lecture.processUnitsFor(user);
  + }));
  + return this;
  +};
  +
  function arrayUnion(...arrays: any[]) {
  return [...new Set([].concat(...arrays))];
  }
  