init
This commit is contained in:
40
config/config.development.js
Normal file
40
config/config.development.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 开发/测试环境配置
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
// ============================================
|
||||
// 数据库配置(测试环境)
|
||||
// ============================================
|
||||
"db": {
|
||||
"username": "wms_node",
|
||||
"password": "SLrhewk5eePr5Z7Y",
|
||||
"database": "wms_node",
|
||||
"host": "192.144.167.231",
|
||||
"port": 3306,
|
||||
"dialect": "mysql"
|
||||
},
|
||||
|
||||
// ============================================
|
||||
// 微信配置(测试环境)
|
||||
|
||||
"aliyun": {
|
||||
"accessKeyId": "LTAI5t7kYFnwxKMBUgdQLvVT",
|
||||
"accessKeySecret": "TqXxL6rTYaXDg4RGOgCukyc9gWgl54",
|
||||
"ossUrl": "https://bimwe.oss-cn-shanghai.aliyuncs.com",
|
||||
"bucket": "bimwe",
|
||||
|
||||
},
|
||||
"redis": {
|
||||
"host": "101.132.75.138",
|
||||
"port": "6379",
|
||||
"pwd": "zc123"
|
||||
},
|
||||
"ai": {
|
||||
"apiKey": "",
|
||||
"baseUrl": "https://dashscope.aliyuncs.com/api/v1"
|
||||
},
|
||||
}
|
||||
|
||||
48
config/config.js
Normal file
48
config/config.js
Normal file
@@ -0,0 +1,48 @@
|
||||
// Central config loader. Keep shared (base) config here and move
|
||||
// environment-specific values into config.development.js / config.production.js.
|
||||
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
|
||||
let envConfig = {};
|
||||
try {
|
||||
if (env === 'production') {
|
||||
envConfig = require('./config.production.js');
|
||||
} else {
|
||||
envConfig = require('./config.development.js');
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(`Warning: failed to load ${env} config, using defaults.`);
|
||||
}
|
||||
|
||||
// Shared config (all environments)
|
||||
const baseConfig = {
|
||||
"port": {
|
||||
"node": 9098,
|
||||
"web": 9090
|
||||
},
|
||||
"allowUrls": [
|
||||
"/admin_api/sys_user/login",
|
||||
"/admin_api/sys_user/authorityMenus",
|
||||
"/admin_api/sys_user/register",
|
||||
"/file/",
|
||||
"/sys_file/",
|
||||
"/api/docs",
|
||||
"api/swagger.json",
|
||||
"/api/auth/verify"
|
||||
]
|
||||
};
|
||||
|
||||
const finalConfig = {
|
||||
...baseConfig,
|
||||
...envConfig,
|
||||
// Deep-merge wechat if present
|
||||
wechat: {
|
||||
...(baseConfig.wechat || {}),
|
||||
...(envConfig.wechat || {})
|
||||
}
|
||||
};
|
||||
|
||||
console.log(`Config env: ${env}`);
|
||||
console.log(`Config qywx env: ${finalConfig.qywx?.env || 'unknown'}`);
|
||||
|
||||
module.exports = finalConfig;
|
||||
43
config/config.production.js
Normal file
43
config/config.production.js
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 开发/测试环境配置
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
||||
// ============================================
|
||||
// 数据库配置(测试环境)
|
||||
// ============================================
|
||||
"db": {
|
||||
"username": "wms_node",
|
||||
"password": "SLrhewk5eePr5Z7Y",
|
||||
"database": "wms_node",
|
||||
"host": "192.144.167.231",
|
||||
"port": 3306,
|
||||
"dialect": "mysql"
|
||||
},
|
||||
|
||||
// ============================================
|
||||
// 微信配置(测试环境)
|
||||
|
||||
|
||||
|
||||
|
||||
"aliyun": {
|
||||
"accessKeyId": "LTAI5t7kYFnwxKMBUgdQLvVT",
|
||||
"accessKeySecret": "TqXxL6rTYaXDg4RGOgCukyc9gWgl54",
|
||||
"ossUrl": "https://bimwe.oss-cn-shanghai.aliyuncs.com",
|
||||
"bucket": "bimwe",
|
||||
|
||||
},
|
||||
"redis": {
|
||||
"host": "101.132.75.138",
|
||||
"port": "6379",
|
||||
"pwd": "zc123"
|
||||
},
|
||||
"ai": {
|
||||
"apiKey": "",
|
||||
"baseUrl": "https://dashscope.aliyuncs.com/api/v1"
|
||||
},
|
||||
}
|
||||
|
||||
4
config/custom.schemas.js
Normal file
4
config/custom.schemas.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 自定义 Swagger Schemas(模板项目为空,按需在此定义复合响应结构)
|
||||
*/
|
||||
module.exports = {};
|
||||
124
config/framework.config.js
Normal file
124
config/framework.config.js
Normal file
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* Framework 配置文件
|
||||
* 基于 node-core-framework 的配置
|
||||
*/
|
||||
|
||||
const baseConfig = require('./config.js');
|
||||
const customSchemas = require('./custom.schemas.js');
|
||||
|
||||
module.exports = {
|
||||
// ===== 必需配置 =====
|
||||
env: process.env.NODE_ENV || 'development',
|
||||
"project_key": "app_template",
|
||||
// 数据库配置(必需)
|
||||
db: {
|
||||
username: baseConfig.db.username,
|
||||
password: baseConfig.db.password,
|
||||
database: baseConfig.db.database,
|
||||
host: baseConfig.db.host,
|
||||
port: baseConfig.db.port || 3306,
|
||||
dialect: baseConfig.db.dialect || 'mysql',
|
||||
timezone: '+08:00',
|
||||
pool: {
|
||||
max: 100, // 15 × 4 = 60 连接
|
||||
min: 2,
|
||||
acquire: 60000,
|
||||
idle: 10000
|
||||
},
|
||||
slowSQLThreshold: 1000,
|
||||
logging: (() => {
|
||||
// 启用SQL监控
|
||||
|
||||
return (sql, timing) => {
|
||||
// 调用监控函数
|
||||
|
||||
// 开发环境仍然输出日志
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
console.log(`[SQL] ${timing}ms - ${typeof sql === 'string' ? sql : (sql.sql || JSON.stringify(sql))}`);
|
||||
}
|
||||
};
|
||||
})()
|
||||
},
|
||||
|
||||
// API 路径配置(必需)
|
||||
apiPaths: [
|
||||
{
|
||||
path: './api/controller_front',
|
||||
prefix: '/api',
|
||||
authType: 'applet'
|
||||
},
|
||||
{
|
||||
path: './api/controller_admin',
|
||||
prefix: '/admin_api',
|
||||
authType: 'admin'
|
||||
}
|
||||
],
|
||||
|
||||
"fileConifg": {
|
||||
"vue": {
|
||||
"api": "../../admin/src/api/",
|
||||
"view": "../../admin/src/view/"
|
||||
},
|
||||
"node": {
|
||||
"controller": "../controller_admin/",
|
||||
"model": "../model/"
|
||||
}
|
||||
},
|
||||
|
||||
// API文档配置
|
||||
swagger: {
|
||||
title: '后端 API',
|
||||
version: '1.0.0',
|
||||
description: '模板项目 API 文档',
|
||||
contact: {
|
||||
name: '开发团队',
|
||||
email: 'dev@example.com'
|
||||
}
|
||||
},
|
||||
|
||||
// ===== 建议配置 =====
|
||||
|
||||
// 基础 URL(根据环境区分)
|
||||
baseUrl: (() => {
|
||||
const env = process.env.NODE_ENV || 'production';
|
||||
|
||||
|
||||
|
||||
switch (env) {
|
||||
case 'production':
|
||||
return 'https://example.com'; // 生产环境(请按实际域名修改)
|
||||
case 'development':
|
||||
default:
|
||||
return 'http://localhost:9098'; // 开发环境
|
||||
}
|
||||
})(),
|
||||
|
||||
// 日志路径
|
||||
logPath: './logs',
|
||||
|
||||
// 白名单 URL(不需要认证的接口)
|
||||
allowUrls: baseConfig.allowUrls,
|
||||
|
||||
// 授权文件路径(可选,如果不需要授权验证可以设置为 null)
|
||||
// 授权验证配置
|
||||
license: {
|
||||
licensePath: require('path').join(__dirname, '_license', 'license.lic')
|
||||
},
|
||||
|
||||
|
||||
// Redis 配置
|
||||
redis: baseConfig.redis || null,
|
||||
|
||||
// 模型路径
|
||||
modelPaths: './api/model',
|
||||
|
||||
// ===== 业务配置(从原 config.js 继承)=====
|
||||
|
||||
// 端口配置
|
||||
port: baseConfig.port,
|
||||
|
||||
|
||||
// 自定义 Swagger Schemas
|
||||
customSchemas: customSchemas
|
||||
};
|
||||
|
||||
365
config/model.associations.js
Normal file
365
config/model.associations.js
Normal file
@@ -0,0 +1,365 @@
|
||||
/**
|
||||
* 业务模型关联配置(模板默认为空实现,按需取消注释或补充)
|
||||
* @param {Object} models - 所有模型对象
|
||||
*/
|
||||
module.exports = (models) => {
|
||||
// ========== 仓库主数据 ==========
|
||||
// models["war_warehouse"].hasMany(models["war_laneway"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// sourceKey: "id",
|
||||
// as: "laneways",
|
||||
// });
|
||||
// models["war_laneway"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// models["war_warehouse"].hasMany(models["war_rack"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// sourceKey: "id",
|
||||
// as: "racks",
|
||||
// });
|
||||
// models["war_rack"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// models["war_warehouse"].hasMany(models["war_area"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// sourceKey: "id",
|
||||
// as: "areas",
|
||||
// });
|
||||
// models["war_area"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// models["war_warehouse"].hasMany(models["war_location"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// sourceKey: "id",
|
||||
// as: "locations",
|
||||
// });
|
||||
// models["war_location"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// // 货位从属(可选)
|
||||
// models["war_area"].hasMany(models["war_location"], {
|
||||
// foreignKey: "area_id",
|
||||
// sourceKey: "id",
|
||||
// as: "area_locations",
|
||||
// });
|
||||
// models["war_location"].belongsTo(models["war_area"], {
|
||||
// foreignKey: "area_id",
|
||||
// targetKey: "id",
|
||||
// as: "area",
|
||||
// });
|
||||
|
||||
// models["war_laneway"].hasMany(models["war_location"], {
|
||||
// foreignKey: "laneway_id",
|
||||
// sourceKey: "id",
|
||||
// as: "laneway_locations",
|
||||
// });
|
||||
// models["war_location"].belongsTo(models["war_laneway"], {
|
||||
// foreignKey: "laneway_id",
|
||||
// targetKey: "id",
|
||||
// as: "laneway",
|
||||
// });
|
||||
|
||||
// models["war_rack"].hasMany(models["war_location"], {
|
||||
// foreignKey: "rack_id",
|
||||
// sourceKey: "id",
|
||||
// as: "rack_locations",
|
||||
// });
|
||||
// models["war_location"].belongsTo(models["war_rack"], {
|
||||
// foreignKey: "rack_id",
|
||||
// targetKey: "id",
|
||||
// as: "rack",
|
||||
// });
|
||||
|
||||
// // ========== 托盘主数据 ==========
|
||||
// models["try_tray_type"].hasMany(models["try_tray"], {
|
||||
// foreignKey: "tray_type_id",
|
||||
// sourceKey: "id",
|
||||
// as: "trays",
|
||||
// });
|
||||
// models["try_tray"].belongsTo(models["try_tray_type"], {
|
||||
// foreignKey: "tray_type_id",
|
||||
// targetKey: "id",
|
||||
// as: "tray_type",
|
||||
// });
|
||||
|
||||
// // ========== 合作方与物料主数据 ==========
|
||||
// models["par_customer"].hasMany(models["mat_material"], {
|
||||
// foreignKey: "customer_id",
|
||||
// sourceKey: "id",
|
||||
// as: "materials",
|
||||
// });
|
||||
// models["mat_material"].belongsTo(models["par_customer"], {
|
||||
// foreignKey: "customer_id",
|
||||
// targetKey: "id",
|
||||
// as: "customer",
|
||||
// });
|
||||
|
||||
// models["par_supplier"].hasMany(models["mat_material"], {
|
||||
// foreignKey: "supplier_id",
|
||||
// sourceKey: "id",
|
||||
// as: "materials",
|
||||
// });
|
||||
// models["mat_material"].belongsTo(models["par_supplier"], {
|
||||
// foreignKey: "supplier_id",
|
||||
// targetKey: "id",
|
||||
// as: "supplier",
|
||||
// });
|
||||
|
||||
// models["mat_type"].hasMany(models["mat_material"], {
|
||||
// foreignKey: "material_type_id",
|
||||
// sourceKey: "id",
|
||||
// as: "materials",
|
||||
// });
|
||||
// models["mat_material"].belongsTo(models["mat_type"], {
|
||||
// foreignKey: "material_type_id",
|
||||
// targetKey: "id",
|
||||
// as: "material_type",
|
||||
// });
|
||||
|
||||
// models["mat_measure"].hasMany(models["mat_material"], {
|
||||
// foreignKey: "measure_id",
|
||||
// sourceKey: "id",
|
||||
// as: "materials",
|
||||
// });
|
||||
// models["mat_material"].belongsTo(models["mat_measure"], {
|
||||
// foreignKey: "measure_id",
|
||||
// targetKey: "id",
|
||||
// as: "measure",
|
||||
// });
|
||||
|
||||
// // ========== 条码主数据 ==========
|
||||
// models["mat_material"].hasMany(models["bar_code"], {
|
||||
// foreignKey: "material_id",
|
||||
// sourceKey: "id",
|
||||
// as: "barcodes",
|
||||
// });
|
||||
// models["bar_code"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// models["bar_type"].hasMany(models["bar_code"], {
|
||||
// foreignKey: "bar_type_id",
|
||||
// sourceKey: "id",
|
||||
// as: "barcodes",
|
||||
// });
|
||||
// models["bar_code"].belongsTo(models["bar_type"], {
|
||||
// foreignKey: "bar_type_id",
|
||||
// targetKey: "id",
|
||||
// as: "bar_type",
|
||||
// });
|
||||
|
||||
// if (models["sys_user"]) {
|
||||
// models["bar_code"].belongsTo(models["sys_user"], {
|
||||
// foreignKey: "created_by_user_id",
|
||||
// targetKey: "id",
|
||||
// as: "created_by_user",
|
||||
// });
|
||||
// }
|
||||
|
||||
// // ========== 收货/发货业务 ==========
|
||||
// models["rec_receiving"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["rec_receiving"].hasMany(models["rec_receiving_item"], {
|
||||
// foreignKey: "receiving_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["rec_receiving_item"].belongsTo(models["rec_receiving"], {
|
||||
// foreignKey: "receiving_id",
|
||||
// targetKey: "id",
|
||||
// as: "receiving",
|
||||
// });
|
||||
// models["rec_receiving_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// models["rec_send"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["rec_send"].hasMany(models["rec_send_item"], {
|
||||
// foreignKey: "send_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["rec_send_item"].belongsTo(models["rec_send"], {
|
||||
// foreignKey: "send_id",
|
||||
// targetKey: "id",
|
||||
// as: "send",
|
||||
// });
|
||||
// models["rec_send_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 入库作业 ==========
|
||||
// models["job_inbound"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["job_inbound"].hasMany(models["job_inbound_item"], {
|
||||
// foreignKey: "inbound_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_inbound_item"].belongsTo(models["job_inbound"], {
|
||||
// foreignKey: "inbound_id",
|
||||
// targetKey: "id",
|
||||
// as: "inbound",
|
||||
// });
|
||||
// models["job_inbound_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 出库作业 ==========
|
||||
// models["job_outbound"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["job_outbound"].hasMany(models["job_outbound_item"], {
|
||||
// foreignKey: "outbound_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_outbound_item"].belongsTo(models["job_outbound"], {
|
||||
// foreignKey: "outbound_id",
|
||||
// targetKey: "id",
|
||||
// as: "outbound",
|
||||
// });
|
||||
// models["job_outbound_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 移库 ==========
|
||||
// models["job_move"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["job_move"].hasMany(models["job_move_item"], {
|
||||
// foreignKey: "move_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_move_item"].belongsTo(models["job_move"], {
|
||||
// foreignKey: "move_id",
|
||||
// targetKey: "id",
|
||||
// as: "move",
|
||||
// });
|
||||
// models["job_move_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 调拨 ==========
|
||||
// models["job_allocate"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "from_warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "from_warehouse",
|
||||
// });
|
||||
// models["job_allocate"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "to_warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "to_warehouse",
|
||||
// });
|
||||
// models["job_allocate"].hasMany(models["job_allocate_item"], {
|
||||
// foreignKey: "allocate_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_allocate_item"].belongsTo(models["job_allocate"], {
|
||||
// foreignKey: "allocate_id",
|
||||
// targetKey: "id",
|
||||
// as: "allocate",
|
||||
// });
|
||||
// models["job_allocate_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 报损 ==========
|
||||
// models["job_damage"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
// models["job_damage"].hasMany(models["job_damage_item"], {
|
||||
// foreignKey: "damage_id",
|
||||
// sourceKey: "id",
|
||||
// as: "items",
|
||||
// });
|
||||
// models["job_damage_item"].belongsTo(models["job_damage"], {
|
||||
// foreignKey: "damage_id",
|
||||
// targetKey: "id",
|
||||
// as: "damage",
|
||||
// });
|
||||
// models["job_damage_item"].belongsTo(models["mat_material"], {
|
||||
// foreignKey: "material_id",
|
||||
// targetKey: "id",
|
||||
// as: "material",
|
||||
// });
|
||||
|
||||
// // ========== 盘点 ==========
|
||||
// models["job_count"].belongsTo(models["war_warehouse"], {
|
||||
// foreignKey: "warehouse_id",
|
||||
// targetKey: "id",
|
||||
// as: "warehouse",
|
||||
// });
|
||||
|
||||
// ========== 订阅模块(biz_*)==========
|
||||
const m = models;
|
||||
if (m.biz_user && m.biz_subscription) {
|
||||
m.biz_user.hasMany(m.biz_subscription, { foreignKey: "user_id", as: "subscriptions" });
|
||||
m.biz_subscription.belongsTo(m.biz_user, { foreignKey: "user_id", as: "biz_user" });
|
||||
}
|
||||
if (m.biz_plan && m.biz_subscription) {
|
||||
m.biz_plan.hasMany(m.biz_subscription, { foreignKey: "plan_id", as: "subscriptions" });
|
||||
m.biz_subscription.belongsTo(m.biz_plan, { foreignKey: "plan_id", as: "biz_plan" });
|
||||
}
|
||||
if (m.biz_user && m.biz_api_token) {
|
||||
m.biz_user.hasMany(m.biz_api_token, { foreignKey: "user_id", as: "api_tokens" });
|
||||
m.biz_api_token.belongsTo(m.biz_user, { foreignKey: "user_id", as: "biz_user" });
|
||||
}
|
||||
if (m.biz_plan && m.biz_api_token) {
|
||||
m.biz_plan.hasMany(m.biz_api_token, { foreignKey: "plan_id", as: "api_tokens" });
|
||||
m.biz_api_token.belongsTo(m.biz_plan, { foreignKey: "plan_id", as: "biz_plan" });
|
||||
}
|
||||
if (m.biz_user && m.biz_usage_monthly) {
|
||||
m.biz_user.hasMany(m.biz_usage_monthly, { foreignKey: "user_id", as: "usage_records" });
|
||||
m.biz_usage_monthly.belongsTo(m.biz_user, { foreignKey: "user_id", as: "biz_user" });
|
||||
}
|
||||
if (m.biz_plan && m.biz_usage_monthly) {
|
||||
m.biz_plan.hasMany(m.biz_usage_monthly, { foreignKey: "plan_id", as: "usage_records" });
|
||||
m.biz_usage_monthly.belongsTo(m.biz_plan, { foreignKey: "plan_id", as: "biz_plan" });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user