courseworx/backend/plugins/financial-plugin/models/ExchangeRateHistory.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

92 lines
1.7 KiB
JavaScript

const { DataTypes } = require('sequelize');
const { sequelize } = require('../../../config/database');
const ExchangeRateHistory = sequelize.define('ExchangeRateHistory', {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
exchangeRateId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'exchange_rates',
key: 'id'
}
},
fromCurrencyId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'currencies',
key: 'id'
}
},
toCurrencyId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'currencies',
key: 'id'
}
},
previousRate: {
type: DataTypes.DECIMAL(15, 8),
allowNull: true
},
newRate: {
type: DataTypes.DECIMAL(15, 8),
allowNull: false,
validate: {
min: 0.00000001
}
},
changePercentage: {
type: DataTypes.DECIMAL(8, 4),
allowNull: true
},
changeDate: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW
},
changeReason: {
type: DataTypes.STRING(30),
allowNull: false,
defaultValue: 'manual_update',
validate: {
isIn: [['manual_update', 'api_update', 'scheduled_update', 'correction']]
}
},
changedBy: {
type: DataTypes.UUID,
allowNull: true,
references: {
model: 'users',
key: 'id'
}
},
notes: {
type: DataTypes.TEXT,
allowNull: true
}
}, {
tableName: 'exchange_rate_history',
indexes: [
{
fields: ['exchangeRateId']
},
{
fields: ['fromCurrencyId', 'toCurrencyId']
},
{
fields: ['changeDate']
},
{
fields: ['changeReason']
}
]
});
module.exports = ExchangeRateHistory;