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,34 @@
/***********************************************************************************************************************************************************************
* File Name: pending_certificate.mdl.js
* Type of Program: Model
* Description: Holds certificates queued for issuance after a 5-minute delay
* following a passed course assessment. The cron job
* (cron/jobs/issue_certificates.cron.js) runs hourly on the hour
* and processes rows where issue_at <= NOW().
*
* Author: Kenneth Obsequio (@lash0000)
* Date Created: Jun. 24, 2026
***********************************************************************************************************************************************************************/
const { DataTypes } = require('sequelize');
const sequelize = require('../../config/db.config');
const PendingCertificate = sequelize.define('PendingCertificate', {
pending_id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
user_id: { type: DataTypes.BIGINT, allowNull: false },
course_id: { type: DataTypes.BIGINT, allowNull: false },
course_uuid: { type: DataTypes.STRING(36), allowNull: false },
course_title: { type: DataTypes.TEXT, allowNull: true },
passed_at: { type: DataTypes.DATE, allowNull: false },
issue_at: { type: DataTypes.DATE, allowNull: false },
processed_at: { type: DataTypes.DATE, allowNull: true },
}, {
tableName: 'pending_certificates',
timestamps: true,
indexes: [
{ fields: ['user_id'] },
{ fields: ['issue_at'] },
{ unique: true, fields: ['user_id', 'course_id'] },
],
});
module.exports = PendingCertificate;