All files / app/models/profile-picture profile-pic.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 0/0
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 361x 1x                 1x                       1x                       1x  
import {Model, DataTypes} from 'sequelize';
import {default as sequelize} from '@db';
 
/**
 * This model represents the binary data for the profile picture
 * of a user.
 *
 * The data is in a separate table to avoid loading the data
 * every time the user data is loaded.
 */
export class ProfilePic extends Model {
  /**
   * Binary data of the profile picture.
   */
  public data!: string;
 
  /**
   * Primary key of the user to which the profile pictures belongs.
   */
  public readonly userId!: number;
}
 
ProfilePic.init({
  data: {
    type: DataTypes.BLOB,
    allowNull: false,
  },
}, {
  sequelize,
  modelName: 'profilePics',
  timestamps: false,
});
 
 
export default ProfilePic;