- Introduced new endpoints for retrieving and executing reputation actions in FalukantController and falukantRouter. - Implemented service methods in FalukantService to handle reputation actions, including daily limits and action execution logic. - Updated the frontend ReputationView component to display available actions and their details, including cost and potential reputation gain. - Added translations for reputation actions in both German and English locales. - Enhanced initialization logic to set up reputation action types in the database.
60 lines
1.3 KiB
JavaScript
60 lines
1.3 KiB
JavaScript
import { Model, DataTypes } from 'sequelize';
|
|
import { sequelize } from '../../../utils/sequelize.js';
|
|
|
|
class ReputationActionLog extends Model {}
|
|
|
|
ReputationActionLog.init(
|
|
{
|
|
falukantUserId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'falukant_user_id',
|
|
},
|
|
actionTypeId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'action_type_id',
|
|
},
|
|
cost: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
},
|
|
baseGain: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'base_gain',
|
|
},
|
|
gain: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
},
|
|
timesUsedBefore: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'times_used_before',
|
|
},
|
|
actionTimestamp: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
|
|
field: 'action_timestamp',
|
|
},
|
|
},
|
|
{
|
|
sequelize,
|
|
modelName: 'ReputationActionLog',
|
|
tableName: 'reputation_action',
|
|
schema: 'falukant_log',
|
|
timestamps: false,
|
|
underscored: true,
|
|
indexes: [
|
|
{ fields: ['falukant_user_id', 'action_type_id'] },
|
|
{ fields: ['action_timestamp'] },
|
|
],
|
|
}
|
|
);
|
|
|
|
export default ReputationActionLog;
|
|
|
|
|