You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.7 KiB
129 lines
3.7 KiB
'use strict';
|
|
|
|
module.exports = (dc) => {
|
|
const DataTypes = dc.ORM;
|
|
const ResourceLibraryFile = dc.orm.define(
|
|
'resourceLibraryFile',
|
|
{
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false,
|
|
primaryKey: true,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
field: 'id',
|
|
comment: '文件资源ID',
|
|
},
|
|
aiCenterUserId: {
|
|
type: DataTypes.BIGINT,
|
|
allowNull: false,
|
|
field: 'ai_center_user_id',
|
|
comment: 'ai-center本地用户ID',
|
|
},
|
|
projectName: {
|
|
type: DataTypes.STRING(64),
|
|
allowNull: false,
|
|
defaultValue: '飞小尚',
|
|
field: 'project_name',
|
|
comment: '项目名称',
|
|
},
|
|
fileName: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
field: 'file_name',
|
|
comment: '原始文件名',
|
|
},
|
|
fileFormat: {
|
|
type: DataTypes.STRING(32),
|
|
allowNull: true,
|
|
field: 'file_format',
|
|
comment: '文件扩展名',
|
|
},
|
|
mimeType: {
|
|
type: DataTypes.STRING(255),
|
|
allowNull: true,
|
|
field: 'mime_type',
|
|
comment: '文件MIME类型',
|
|
},
|
|
fileSize: {
|
|
type: DataTypes.BIGINT,
|
|
allowNull: true,
|
|
field: 'file_size',
|
|
comment: '文件大小(字节)',
|
|
},
|
|
url: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
field: 'url',
|
|
comment: '七牛文件链接',
|
|
},
|
|
objectKey: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true,
|
|
field: 'object_key',
|
|
comment: '七牛对象Key',
|
|
},
|
|
storageProvider: {
|
|
type: DataTypes.STRING(32),
|
|
allowNull: false,
|
|
defaultValue: 'qiniu',
|
|
field: 'storage_provider',
|
|
comment: '存储提供方',
|
|
},
|
|
sha256: {
|
|
type: DataTypes.STRING(64),
|
|
allowNull: false,
|
|
field: 'sha256',
|
|
comment: '文件SHA-256摘要',
|
|
},
|
|
sourceType: {
|
|
type: DataTypes.STRING(32),
|
|
allowNull: false,
|
|
field: 'source_type',
|
|
comment: '资源来源类型',
|
|
},
|
|
sourceUploadId: {
|
|
type: DataTypes.STRING(128),
|
|
allowNull: true,
|
|
field: 'source_upload_id',
|
|
comment: '上传记录ID',
|
|
},
|
|
sourceTaskId: {
|
|
type: DataTypes.STRING(128),
|
|
allowNull: true,
|
|
field: 'source_task_id',
|
|
comment: '来源任务ID',
|
|
},
|
|
sourceSessionId: {
|
|
type: DataTypes.STRING(128),
|
|
allowNull: true,
|
|
field: 'source_session_id',
|
|
comment: '来源会话ID',
|
|
},
|
|
createdAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: DataTypes.NOW,
|
|
field: 'created_at',
|
|
comment: '创建时间',
|
|
},
|
|
updatedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: DataTypes.NOW,
|
|
field: 'updated_at',
|
|
comment: '更新时间',
|
|
},
|
|
},
|
|
{
|
|
tableName: 'resource_library_files',
|
|
timestamps: true,
|
|
underscored: true,
|
|
indexes: [
|
|
{ unique: true, fields: ['ai_center_user_id', 'sha256'] },
|
|
{ fields: ['project_name', 'ai_center_user_id', 'created_at'] },
|
|
],
|
|
},
|
|
);
|
|
dc.models.ResourceLibraryFile = ResourceLibraryFile;
|
|
return ResourceLibraryFile;
|
|
};
|
|
|