This commit is contained in:
张成
2026-03-18 14:18:41 +08:00
parent 54341f0a0b
commit 5b671d320b
21 changed files with 4404 additions and 42 deletions

15
server/models/index.js Normal file
View File

@@ -0,0 +1,15 @@
import { Sequelize } from 'sequelize';
import { get_sequelize_options } from '../config/database.js';
import { define_crawl_run_record } from './crawl_run_record.js';
import { define_schedule_task } from './schedule_task.js';
const sequelize_options = get_sequelize_options();
const { database, username, password, ...rest } = sequelize_options;
export const sequelize = new Sequelize(database, username, password, rest);
export const crawl_run_record = define_crawl_run_record(sequelize);
export const schedule_task = define_schedule_task(sequelize);
schedule_task.hasMany(crawl_run_record, { foreignKey: 'schedule_task_id', as: 'records' });
crawl_run_record.belongsTo(schedule_task, { foreignKey: 'schedule_task_id', as: 'schedule_task' });