You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Global-sales/wai-server/models/outbound_messages.js

226 lines
5.1 KiB
JavaScript

const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
return sequelize.define(
'outbound_messages',
{
sn: {
autoIncrement: true,
type: DataTypes.BIGINT,
allowNull: false,
primaryKey: true,
},
direction: {
type: DataTypes.STRING(50),
allowNull: true,
},
evt_id: {
type: DataTypes.STRING(100),
allowNull: true,
},
actionId: {
type: DataTypes.STRING(100),
allowNull: true,
get() {
const rawValue = this.getDataValue('actionId');
return rawValue === null ? '' : rawValue;
},
},
opi_sn: {
type: DataTypes.INTEGER,
allowNull: true,
},
coli_sn: {
type: DataTypes.INTEGER,
allowNull: true,
},
msgtime: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
},
id: {
type: DataTypes.STRING(200),
allowNull: false,
unique: 'outbound_messages_unique',
},
wamid: {
type: DataTypes.STRING(200),
allowNull: true,
},
from: {
type: DataTypes.STRING(100),
allowNull: true,
},
to: {
type: DataTypes.STRING(100),
allowNull: true,
},
customerProfile_id: {
type: DataTypes.STRING(100),
allowNull: true,
},
customerProfile_name: {
type: DataTypes.TEXT,
allowNull: true,
},
msgtype: {
type: DataTypes.STRING(50),
allowNull: true,
},
externalId: {
type: DataTypes.STRING(100),
allowNull: true,
},
msg_status: {
type: DataTypes.STRING(50),
allowNull: true,
comment: '消息状态 read、send等',
get() {
const rawValue = this.getDataValue('msg_status');
return rawValue === null ? '' : rawValue;
},
},
errors_code: {
type: DataTypes.STRING(50),
allowNull: true,
},
errors_title: {
type: DataTypes.TEXT,
allowNull: true,
},
createTime: {
type: DataTypes.DATE,
allowNull: true,
},
updateTime: {
type: DataTypes.DATE,
allowNull: true,
},
sendTime: {
type: DataTypes.DATE,
allowNull: true,
},
deliverTime: {
type: DataTypes.DATE,
allowNull: true,
},
readTime: {
type: DataTypes.DATE,
allowNull: true,
},
regionCode: {
type: DataTypes.STRING(50),
allowNull: true,
},
text_body: {
type: DataTypes.TEXT,
allowNull: true,
},
text_preview_url: {
type: DataTypes.TEXT,
allowNull: true,
},
context_from: {
type: DataTypes.STRING(50),
allowNull: true,
},
context_id: {
type: DataTypes.STRING(200),
allowNull: true,
},
IVADS_link_original: {
type: DataTypes.TEXT,
allowNull: true,
comment: '供应商给的url',
},
IVADS_link: {
type: DataTypes.TEXT,
allowNull: true,
},
IVADS_caption: {
type: DataTypes.STRING(1024),
allowNull: true,
get() {
const rawValue = this.getDataValue('IVADS_caption');
return rawValue === null ? '' : rawValue;
},
},
IVADS_id: {
type: DataTypes.STRING(100),
allowNull: true,
},
IVADS_sha256: {
type: DataTypes.STRING(200),
allowNull: true,
},
IVADS_mime_type: {
type: DataTypes.STRING(255),
allowNull: true,
},
IVADS_filename: {
type: DataTypes.TEXT,
allowNull: true,
get() {
const rawValue = this.getDataValue('IVADS_filename');
return rawValue === null ? '' : rawValue;
},
},
location_latitude: {
type: DataTypes.STRING(50),
allowNull: true,
},
location_longitude: {
type: DataTypes.STRING(50),
allowNull: true,
},
location_name: {
type: DataTypes.TEXT,
allowNull: true,
},
location_address: {
type: DataTypes.TEXT,
allowNull: true,
},
location_url: {
type: DataTypes.TEXT,
allowNull: true,
},
contacts: {
type: DataTypes.TEXT,
allowNull: true,
},
reaction_message_id: {
type: DataTypes.STRING(200),
allowNull: true,
},
reaction_emoji: {
type: DataTypes.TEXT,
allowNull: true,
},
message_origin: {
type: DataTypes.TEXT,
allowNull: true,
},
},
{
sequelize,
tableName: 'outbound_messages',
timestamps: false,
indexes: [
{
name: 'PRIMARY',
unique: true,
using: 'BTREE',
fields: [{ name: 'sn' }],
},
{
name: 'outbound_messages_unique',
unique: true,
using: 'BTREE',
fields: [{ name: 'id' }],
},
],
},
);
};