- 新增 model: camera, camera_server - 新增 services: camera, cameraServer (systemMethods + systems) - 新增 pack_task_video 表及录制状态管理 - 7 条迁移: 建表→设备字段→端口拆分→状态枚举
101 lines
2.2 KiB
JavaScript
101 lines
2.2 KiB
JavaScript
'use strict';
|
||
|
||
module.exports = app => {
|
||
const { STRING, BIGINT, INTEGER, DATE, TINYINT } = app.Sequelize;
|
||
|
||
const CameraServer = app.model.define('camera_server', {
|
||
id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
primaryKey: true,
|
||
autoIncrement: true,
|
||
comment: '主键ID',
|
||
},
|
||
warehouse_id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
allowNull: false,
|
||
comment: '仓库ID',
|
||
},
|
||
name: {
|
||
type: STRING(100),
|
||
allowNull: false,
|
||
comment: '服务器名称',
|
||
},
|
||
brand: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '品牌(如 Hikvision/Dahua)',
|
||
},
|
||
public_ip: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '公网IP',
|
||
},
|
||
internal_ip: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '内网IP',
|
||
},
|
||
public_port: {
|
||
type: INTEGER.UNSIGNED,
|
||
allowNull: true,
|
||
comment: '远程/公网端口',
|
||
},
|
||
internal_port: {
|
||
type: INTEGER.UNSIGNED,
|
||
allowNull: true,
|
||
comment: '本地/内网端口',
|
||
},
|
||
username: {
|
||
type: STRING(100),
|
||
allowNull: true,
|
||
comment: '登录账号',
|
||
},
|
||
password: {
|
||
type: STRING(200),
|
||
allowNull: true,
|
||
comment: '登录密码',
|
||
},
|
||
status: {
|
||
type: TINYINT,
|
||
allowNull: false,
|
||
defaultValue: 1,
|
||
comment: '状态:0-禁用 1-启用',
|
||
},
|
||
remark: {
|
||
type: STRING(500),
|
||
allowNull: true,
|
||
comment: '备注',
|
||
},
|
||
created_at: {
|
||
type: DATE,
|
||
allowNull: false,
|
||
comment: '创建时间',
|
||
},
|
||
updated_at: {
|
||
type: DATE,
|
||
allowNull: false,
|
||
comment: '更新时间',
|
||
},
|
||
deleted_at: {
|
||
type: DATE,
|
||
allowNull: true,
|
||
comment: '软删除时间',
|
||
},
|
||
}, {
|
||
tableName: 'wms_camera_server',
|
||
timestamps: true,
|
||
createdAt: 'created_at',
|
||
updatedAt: 'updated_at',
|
||
paranoid: true,
|
||
deletedAt: 'deleted_at',
|
||
comment: '录像服务器表',
|
||
indexes: [
|
||
{ name: 'idx_warehouse_id', fields: ['warehouse_id'] },
|
||
{ name: 'idx_status', fields: ['status'] },
|
||
{ name: 'idx_deleted_at', fields: ['deleted_at'] },
|
||
],
|
||
});
|
||
|
||
return CameraServer;
|
||
};
|