message: API: Add forTeacher User.ts schema method
diff: @@ -3,6 +3,7 @@ import * as bcrypt from 'bcrypt';
  import {IUser} from '../../../shared/models/IUser';
  import {IUserSubSafeBase} from '../../../shared/models/IUserSubSafeBase';
  import {IUserSubSafe} from '../../../shared/models/IUserSubSafe';
  +import {IUserSubTeacher} from '../../../shared/models/IUserSubTeacher';
  import {NativeError} from 'mongoose';
  import * as crypto from 'crypto';
  import {isNullOrUndefined} from 'util';
  @@ -16,6 +17,7 @@ interface IUserModel extends IUser, mongoose.Document {
  checkPrivileges: () => IProperties;
  forSafeBase: () => IUserSubSafeBase;
  forSafe: () => IUserSubSafe;
  + forTeacher: () => IUserSubTeacher;
  authenticationToken: string;
  resetPasswordToken: string;
  resetPasswordExpires: Date;
  @@ -199,6 +201,16 @@ userSchema.methods.forSafe = function (): IUserSubSafe {
  };
  };
  +userSchema.methods.forTeacher = function (): IUserSubTeacher {
  + const {
  + uid, email
  + } = this;
  + return {
  + ...this.forSafeBase(),
  + uid, email
  + };
  +};
  +
  userSchema.statics.checkPrivileges = function (user: IUser): IProperties {
  const userIsAdmin: boolean = user.role === 'admin';
  const userIsTeacher: boolean = user.role === 'teacher';
  