courseworx/backend/plugins/financial-plugin/models/ExchangeRate.js
mmabdalla 5477297914 v2.0.2 - Complete Plugin Architecture System and Multi-Currency Implementation
Major Features Added:
- Complete Plugin Architecture System with financial plugin
- Multi-currency support with exchange rates
- Course type system (online, classroom, hybrid)
- Attendance tracking and QR code scanning
- Classroom sessions management
- Course sections and content management
- Professional video player with authentication
- Secure media serving system
- Shopping cart and checkout system
- Financial dashboard and earnings tracking
- Trainee progress tracking
- User notes and assignments system

Backend Infrastructure:
- Plugin loader and registry system
- Multi-currency database models
- Secure media middleware
- Course access middleware
- Financial plugin with payment processing
- Database migrations for new features
- API endpoints for all new functionality

Frontend Components:
- Course management interface
- Content creation and editing
- Section management with drag-and-drop
- Professional video player
- QR scanner for attendance
- Shopping cart and checkout flow
- Financial dashboard
- Plugin management interface
- Trainee details and progress views

This represents a major evolution of CourseWorx from a basic LMS to a comprehensive educational platform with plugin architecture.
2025-09-14 04:20:37 +03:00

84 lines
1.5 KiB
JavaScript

const { DataTypes } = require('sequelize');
const { sequelize } = require('../../../config/database');
const ExchangeRate = sequelize.define('ExchangeRate', {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
fromCurrencyId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'currencies',
key: 'id'
}
},
toCurrencyId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'currencies',
key: 'id'
}
},
rate: {
type: DataTypes.DECIMAL(15, 8),
allowNull: false,
validate: {
min: 0.00000001
}
},
effectiveDate: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
},
expiryDate: {
type: DataTypes.DATE,
allowNull: true
},
isActive: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
source: {
type: DataTypes.STRING(20),
allowNull: false,
defaultValue: 'manual',
validate: {
isIn: [['manual', 'api', 'import']]
}
},
notes: {
type: DataTypes.TEXT,
allowNull: true
},
createdBy: {
type: DataTypes.UUID,
allowNull: true,
references: {
model: 'users',
key: 'id'
}
}
}, {
tableName: 'exchange_rates',
indexes: [
{
fields: ['fromCurrencyId', 'toCurrencyId']
},
{
fields: ['effectiveDate']
},
{
fields: ['isActive']
},
{
fields: ['fromCurrencyId', 'toCurrencyId', 'effectiveDate']
}
]
});
module.exports = ExchangeRate;