All files / database/models users.js

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82    1x                                                                                   1x                                                                 1x   1x    
'use strict';
 
module.exports = (sequelize, DataTypes) => {
  /**
   * @swagger
   * definition:
   *   User:
   *     description:
   *       The main entity that creates and executes actions.
   *       Such actions can be creating a Group, inviting other User to a Group, login.
   *
   *     properties:
   *       id:
   *         type: string
   *         format: uuid
   *
   *       firstName:
   *         type: string
   *         example: John
   *
   *       lastName:
   *         type: string
   *         example: Smith
   *
   *       email:
   *         type: string
   *         format: email
   *         example: john@smith.com
   *
   *       hashedPassword:
   *         type: string
   *
   *       createdAt:
   *         type: string
   *         format: date-time
   *
   *       updatedAt:
   *         type: string
   *         format: date-time
   *
   *       deletedAt:
   *         type: string
   *         format: date-time
   */
  const Users = sequelize.define('Users', {
    id: {
      allowNull: false,
      primaryKey: true,
      type: DataTypes.UUID,
      defaultValue: DataTypes.UUIDV4,
    },
    firstName: {
      type: DataTypes.STRING,
    },
    lastName: {
      type: DataTypes.STRING,
    },
    email: {
      type: DataTypes.STRING,
    },
    hashedPassword: {
      type: DataTypes.STRING,
    },
    createdAt: {
      allowNull: false,
      type: DataTypes.DATE,
    },
    updatedAt: {
      allowNull: false,
      type: DataTypes.DATE,
    },
    deletedAt: {
      type: DataTypes.DATE,
      defaultValue: null,
    },
  }, {});
 
  Users.associate = () => {};
 
  return Users;
};