ready to test

Testing

Signed-off-by: Kenneth Obsequio <k80308392@gmail.com>
This commit is contained in:
2026-06-22 10:06:58 +08:00
parent bf48c95467
commit 439bb33f77
189 changed files with 17559 additions and 686 deletions
+25
View File
@@ -0,0 +1,25 @@
'use strict';
const { DataTypes } = require('sequelize');
const sequelize = require('../../config/db.config');
const { Course } = require('./courses.mdl');
const mdl_Product = sequelize.define('Product', {
id: { type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true },
course_id: { type: DataTypes.BIGINT, allowNull: false },
name: { type: DataTypes.STRING(200), allowNull: false },
description: { type: DataTypes.TEXT, allowNull: true },
price: { type: DataTypes.DECIMAL(10, 2), allowNull: false },
currency: { type: DataTypes.STRING(10), allowNull: false, defaultValue: 'USD' },
access_days: { type: DataTypes.INTEGER, allowNull: true },
is_active: { type: DataTypes.BOOLEAN, allowNull: false, defaultValue: true },
}, {
tableName: 'products',
timestamps: true,
paranoid: true,
});
// A course has one product listing; a product belongs to one course
mdl_Product.belongsTo(Course, { foreignKey: 'course_id', as: 'course' });
Course.hasOne(mdl_Product, { foreignKey: 'course_id', as: 'product' });
module.exports = mdl_Product;