Files
yourpart3/backend/models/falukant/data/user.js
Torsten Schulz (local) 360bb59a4e
All checks were successful
Deploy to production / deploy (push) Successful in 2m50s
feat(user): add certificate production tracking and update localization
- Introduced a new field `certificateProductionsCountSince` in the `FalukantUser` model to track the date from which production logs are counted for certificate requirements.
- Updated the `FalukantService` to utilize the new field for calculating completed productions since the specified date.
- Enhanced the UI to display the count of productions since the last promotion, with corresponding translations added for multiple languages including Cebuano, German, English, Spanish, and French.
- Implemented a method to delete old production logs, ensuring efficient data management while maintaining necessary historical records for certificate calculations.
2026-04-09 08:19:19 +02:00

58 lines
1.4 KiB
JavaScript

import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../../utils/sequelize.js';
import RegionData from './region.js';
class FalukantUser extends Model { }
FalukantUser.init({
userId: {
type: DataTypes.INTEGER,
allowNull: false,
unique: true},
money: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00},
creditAmount: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00},
todayCreditTaken: {
type: DataTypes.DECIMAL(10, 2),
allowNull: false,
defaultValue: 0.00},
creditInterestRate: {
type: DataTypes.DECIMAL(5, 2),
allowNull: false,
defaultValue: 0.00},
certificate: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1},
certificateProductionsCountSince: {
type: DataTypes.DATE,
allowNull: true
},
mainBranchRegionId: {
type: DataTypes.INTEGER,
allowNull: true
},
lastNobilityAdvanceAt: {
type: DataTypes.DATE,
allowNull: true
},
lastPoliticalDailySalaryOn: {
type: DataTypes.DATEONLY,
allowNull: true,
field: 'last_political_daily_salary_on'
}
}, {
sequelize,
modelName: 'FalukantUser',
tableName: 'falukant_user',
schema: 'falukant_data',
timestamps: true,
underscored: true});
export default FalukantUser;