@itleanchatbot/shared-models-js-postgres 2.8.20 → 2.8.22

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": "2.8.20",
3
+ "version": "2.8.22",
4
4
  "description": "Shared Models JS Postgres",
5
5
  "main": "index.js",
6
6
  "license": "ISC",
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ const { DIALOG_NODE_TYPES } = require('./../models/dialogNodes')
4
+ const { replaceEnum } = require('./../presenters/database/migrationHelpers')
5
+
6
+ module.exports = {
7
+ async up (queryInterface) {
8
+ await replaceEnum(
9
+ queryInterface,
10
+ 'DialogNodes',
11
+ 'type',
12
+ DIALOG_NODE_TYPES.CALLBACK,
13
+ DIALOG_NODE_TYPES.NODE,
14
+ DIALOG_NODE_TYPES.FOLDER,
15
+ DIALOG_NODE_TYPES.TRANSHIP,
16
+ DIALOG_NODE_TYPES.FAQ,
17
+ DIALOG_NODE_TYPES.END_SESSION
18
+
19
+ )
20
+ },
21
+
22
+ async down (queryInterface) {
23
+ await replaceEnum(
24
+ queryInterface,
25
+ 'DialogNodes',
26
+ 'type',
27
+ DIALOG_NODE_TYPES.NODE,
28
+ DIALOG_NODE_TYPES.FOLDER,
29
+ DIALOG_NODE_TYPES.TRANSHIP,
30
+ DIALOG_NODE_TYPES.FAQ,
31
+ DIALOG_NODE_TYPES.END_SESSION,
32
+ )
33
+ }
34
+ };
@@ -0,0 +1,19 @@
1
+ 'use strict'
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, Sequelize) => {
5
+ await queryInterface.addIndex('Attendances', {
6
+ name: 'leanbot_attendances_01',
7
+ fields: ['LineId', 'createdAt']
8
+ })
9
+
10
+ await queryInterface.addIndex('TranshipConversations', {
11
+ name: 'leanbot_transhipConversations_01',
12
+ fields: ['AttendanceId', 'action', 'createdAt']
13
+ })
14
+ },
15
+ down: async queryInterface => {
16
+ await queryInterface.removeIndex('TranshipConversations', 'leanbot_transhipConversations_01')
17
+ await queryInterface.removeIndex('Attendances', 'leanbot_attendances_01')
18
+ }
19
+ }
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+ const { replaceEnum } = require('./../presenters/database/migrationHelpers')
3
+ module.exports = {
4
+ async up (queryInterface) {
5
+ await replaceEnum(
6
+ queryInterface,
7
+ 'BotIterables',
8
+ 'action',
9
+ 'bot',
10
+ 'client',
11
+ 'callback',
12
+ )
13
+ },
14
+
15
+ async down (queryInterface) {
16
+ await replaceEnum(
17
+ queryInterface,
18
+ 'BotIterables',
19
+ 'action',
20
+ 'bot',
21
+ 'client'
22
+ )
23
+ }
24
+ };
@@ -10,7 +10,7 @@ exports.model = (sequelize, DataType) => {
10
10
  },
11
11
  action:{
12
12
  type: DataType.ENUM({
13
- values: ['bot', 'client'],
13
+ values: ['bot', 'client', 'callback'],
14
14
  }),
15
15
  allowNull: false,
16
16
  },
@@ -1,8 +1,13 @@
1
1
  const DIALOG_NODE_TYPES = {
2
2
  NODE: 'node',
3
3
  FOLDER: 'folder',
4
+ CALLBACK: 'callback',
5
+ FAQ: 'faq',
6
+ TRANSHIP: 'tranship',
7
+ END_SESSION: 'end_session',
4
8
  }
5
- const DIALOG_NODE_TYPE = [DIALOG_NODE_TYPES.NODE, DIALOG_NODE_TYPES.FOLDER]
9
+
10
+ const DIALOG_NODE_TYPE = [DIALOG_NODE_TYPES.NODE, DIALOG_NODE_TYPES.FOLDER, DIALOG_NODE_TYPES.CALLBACK, DIALOG_NODE_TYPES.FAQ, DIALOG_NODE_TYPES.TRANSHIP, DIALOG_NODE_TYPES.END_SESSION]
6
11
  const DialogNodesModel = (sequelize, Sequelize) => {
7
12
  const DialogNodes = sequelize.define('DialogNodes', {
8
13
  name: {