chore: relocate backend into apps/api ahead of monorepo merge

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-24 12:20:40 +08:00
co-authored by Claude Sonnet 5
parent af44598df6
commit eaa6d2276a
388 changed files with 0 additions and 13998 deletions
@@ -0,0 +1,37 @@
'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('task_completions', {
completion_id: { type: Sequelize.UUID, defaultValue: Sequelize.UUIDV4, primaryKey: true },
task_id: { type: Sequelize.UUID, allowNull: false, references: { model: 'tasks', key: 'task_id' }, onDelete: 'CASCADE' },
user_id: { type: Sequelize.BIGINT, allowNull: false, references: { model: 'users', key: 'user_id' }, onDelete: 'CASCADE' },
note: { type: Sequelize.TEXT, allowNull: true },
response_text: { type: Sequelize.TEXT, allowNull: true },
status: { type: Sequelize.STRING, allowNull: false, defaultValue: 'submitted' },
reviewed_by: { type: Sequelize.BIGINT, allowNull: true },
reviewed_at: { type: Sequelize.DATE, allowNull: true },
review_note: { type: Sequelize.TEXT, allowNull: true },
submitted_at: { type: Sequelize.DATE, defaultValue: Sequelize.NOW, allowNull: false },
createdBy: { type: Sequelize.BIGINT, allowNull: true },
updatedBy: { type: Sequelize.BIGINT, allowNull: true },
deletedBy: { type: Sequelize.BIGINT, allowNull: true },
createdAt: { type: Sequelize.DATE, allowNull: false },
updatedAt: { type: Sequelize.DATE, allowNull: false },
deletedAt: { type: Sequelize.DATE, allowNull: true },
});
await queryInterface.sequelize.query(
`ALTER TABLE task_completions ADD CONSTRAINT check_status
CHECK (status IN ('submitted', 'approved', 'rejected'))`
);
await queryInterface.addIndex('task_completions', { fields: ['task_id'], name: 'idx_tc_task_id' });
await queryInterface.addIndex('task_completions', { fields: ['user_id'], name: 'idx_tc_user_id' });
await queryInterface.addIndex('task_completions', { fields: ['task_id', 'user_id'], name: 'idx_tc_task_user' });
},
async down(queryInterface) {
await queryInterface.dropTable('task_completions');
},
};