botserver/deploy/core.gbapp/models/GBModel.ts

224 lines
5.2 KiB
TypeScript
Raw Normal View History

2018-04-21 02:59:30 -03:00
/*****************************************************************************\
| ( )_ _ |
| _ _ _ __ _ _ __ ___ ___ _ _ | ,_)(_) ___ ___ _ |
| ( '_`\ ( '__)/'_` ) /'_ `\/' _ ` _ `\ /'_` )| | | |/',__)/' _ `\ /'_`\ |
| | (_) )| | ( (_| |( (_) || ( ) ( ) |( (_| || |_ | |\__, \| ( ) |( (_) ) |
| | ,__/'(_) `\__,_)`\__ |(_) (_) (_)`\__,_)`\__)(_)(____/(_) (_)`\___/' |
| | | ( )_) | |
| (_) \___/' |
| |
| General Bots Copyright (c) Pragmatismo.io. All rights reserved. |
| Licensed under the AGPL-3.0. |
| |
| According to our dual licensing model, this program can be used either |
| under the terms of the GNU Affero General Public License, version 3, |
| or under a proprietary license. |
| |
| The texts of the GNU Affero General Public License with an additional |
| permission and of our proprietary license can be found at and |
| in the LICENSE file you have received along with this program. |
| |
| This program is distributed in the hope that it will be useful, |
2018-09-11 19:40:53 -03:00
| but WITHOUT ANY WARRANTY, without even the implied warranty of |
2018-04-21 02:59:30 -03:00
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU Affero General Public License for more details. |
| |
| "General Bots" is a registered trademark of Pragmatismo.io. |
| The licensing of the program under the AGPLv3 does not imply a |
| trademark license. Therefore any rights, title and interest in |
| our trademarks remain entirely with us. |
| |
\*****************************************************************************/
2018-09-11 19:40:53 -03:00
"use strict"
2018-04-21 02:59:30 -03:00
import {
DataTypes,
DataTypeUUIDv4,
DataTypeDate,
DataTypeDecimal
2018-09-11 19:40:53 -03:00
} from "sequelize"
2018-04-21 02:59:30 -03:00
import {
Sequelize,
Table,
Column,
Model,
HasMany,
BelongsTo,
BelongsToMany,
Length,
ForeignKey,
CreatedAt,
UpdatedAt,
DataType,
PrimaryKey,
AutoIncrement
2018-09-11 19:40:53 -03:00
} from "sequelize-typescript"
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
import { IGBInstance } from "botlib"
2018-04-21 02:59:30 -03:00
@Table
export class GuaribasInstance extends Model<GuaribasInstance> implements IGBInstance {
@PrimaryKey
@AutoIncrement
@Column
2018-09-11 19:40:53 -03:00
instanceId: number
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column applicationPrincipal: string
2018-09-04 15:09:52 -03:00
@Column
2018-09-11 19:40:53 -03:00
whoAmIVideo: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column botId: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column title: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column description: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column version: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column enabledAdmin: boolean
2018-04-21 02:59:30 -03:00
/* Services section on bot.json */
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column engineName: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column marketplaceId: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column textAnalyticsKey: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column textAnalyticsServerUrl: string
2018-09-11 19:40:53 -03:00
@Column marketplacePassword: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column webchatKey: string
2018-09-11 19:40:53 -03:00
@Column whatsappBotKey: string
2018-09-11 19:40:53 -03:00
@Column whatsappServiceKey: string
2018-09-11 19:40:53 -03:00
@Column whatsappServiceNumber: string
2018-09-11 19:40:53 -03:00
@Column whatsappServiceUrl: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column whatsappServiceWebhookUrl: string
2018-09-11 19:40:53 -03:00
@Column speechKey: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column spellcheckerKey: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column theme: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column ui: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column kb: string
@Column
2018-09-11 19:40:53 -03:00
nlpAppId: string
@Column
2018-09-11 19:40:53 -03:00
nlpSubscriptionKey: string
@Column
@Column({ type: DataType.STRING(512) })
2018-09-11 19:40:53 -03:00
nlpServerUrl: string
2018-09-11 19:40:53 -03:00
@Column searchHost: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column searchKey: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column searchIndex: string
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column searchIndexer: string
2018-04-21 02:59:30 -03:00
/* Settings section of bot.json */
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column(DataType.FLOAT) nlpVsSearch: number
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column(DataType.FLOAT) searchScore: number
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column(DataType.FLOAT) nlpScore: number
2018-04-21 02:59:30 -03:00
@Column
@CreatedAt
2018-09-11 19:40:53 -03:00
createdAt: Date
@Column
@UpdatedAt
2018-09-11 19:40:53 -03:00
updatedAt: Date
2018-04-21 02:59:30 -03:00
}
@Table
export class GuaribasPackage extends Model<GuaribasPackage> {
@PrimaryKey
@AutoIncrement
@Column
2018-09-11 19:40:53 -03:00
packageId: number
@Column
2018-09-11 19:40:53 -03:00
packageName: string
@ForeignKey(() => GuaribasInstance)
@Column
2018-09-11 19:40:53 -03:00
instanceId: number
2018-04-21 02:59:30 -03:00
@BelongsTo(() => GuaribasInstance)
2018-09-11 19:40:53 -03:00
instance: GuaribasInstance
2018-04-21 02:59:30 -03:00
@Column
@CreatedAt
2018-09-11 19:40:53 -03:00
createdAt: Date
2018-04-21 02:59:30 -03:00
@Column
@UpdatedAt
2018-09-11 19:40:53 -03:00
updatedAt: Date
2018-04-21 02:59:30 -03:00
}
@Table
export class GuaribasChannel extends Model<GuaribasChannel> {
@PrimaryKey
@AutoIncrement
@Column
2018-09-11 19:40:53 -03:00
channelId: number
2018-09-11 19:40:53 -03:00
@Column title: string
@Column
@CreatedAt
2018-09-11 19:40:53 -03:00
createdAt: Date
@Column
@UpdatedAt
2018-09-11 19:40:53 -03:00
updatedAt: Date
2018-04-21 02:59:30 -03:00
}
@Table
export class GuaribasException extends Model<GuaribasException> {
@PrimaryKey
@AutoIncrement
@Column
2018-09-11 19:40:53 -03:00
exceptionId: number
2018-04-21 02:59:30 -03:00
2018-09-11 19:40:53 -03:00
@Column message: string
2018-04-21 02:59:30 -03:00
@ForeignKey(() => GuaribasInstance)
@Column
2018-09-11 19:40:53 -03:00
instanceId: number
2018-04-21 02:59:30 -03:00
@BelongsTo(() => GuaribasInstance)
2018-09-11 19:40:53 -03:00
instance: GuaribasInstance
@Column
@CreatedAt
2018-09-11 19:40:53 -03:00
createdAt: Date
2018-04-21 02:59:30 -03:00
@Column
@UpdatedAt
2018-09-11 19:40:53 -03:00
updatedAt: Date
}