mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
chore: relocate backend into apps/api ahead of monorepo merge
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user