@itleanchatbot/shared-models-js-postgres 1.1.54 → 1.1.55

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itleanchatbot/shared-models-js-postgres",
3
- "version": "1.1.54",
3
+ "version": "1.1.55",
4
4
  "description": "Shared Models JS Postgres",
5
5
  "main": "index.js",
6
6
  "license": "ISC",
@@ -14,26 +14,38 @@ exports.AttendanceScaleOffsModel = (sequelize, DataTypes) => {
14
14
  allowNull: false,
15
15
  type: DataTypes.DATEONLY,
16
16
  get(field) {
17
+ const isRecorrent = this.getDataValue('isRecorrent')
17
18
  const date = this.getDataValue(field)
18
- return new Date(date).toISOString().substring(0, 10)
19
+ if(!isRecorrent) return new Date(date).toISOString().substring(0, 10)
20
+ return new Date().getUTCFullYear() + new Date(date).toISOString().substring(4, 10)
19
21
  },
20
22
  },
21
23
  hourInit: {
22
- allowNull: false,
24
+ allowNull: true,
23
25
  type: DataTypes.TIME,
24
26
  get(field) {
25
27
  const hourInit = this.getDataValue(field)
28
+ if(!hourInit) return hourInit
26
29
  return hourInit.substring(0, 5)
27
30
  },
28
31
  },
29
32
  hourFinish: {
30
- allowNull: false,
33
+ allowNull: true,
31
34
  type: DataTypes.TIME,
32
35
  get(field) {
33
36
  const hourFinish = this.getDataValue(field)
37
+ if(!hourFinish) return hourFinish
34
38
  return hourFinish.substring(0, 5)
35
39
  },
36
40
  },
41
+ isRecorrent: {
42
+ allowNull: true,
43
+ type: DataTypes.BOOLEAN
44
+ },
45
+ allExpedientOff: {
46
+ allowNull: true,
47
+ type: DataTypes.BOOLEAN
48
+ },
37
49
  })
38
50
 
39
51
  AttendanceScale.associate = (models) => {