Refactor Notification model to remove VIRTUAL field definition for characterName and implement a getter method for improved data handling and synchronization.
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
import { Model, DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../../utils/sequelize.js';
|
||||
|
||||
class Notification extends Model { }
|
||||
class Notification extends Model {
|
||||
// Getter für characterName - wird nicht synchronisiert, da es kein Datenbankfeld ist
|
||||
get characterName() {
|
||||
return this.getDataValue('character_name') || null;
|
||||
}
|
||||
}
|
||||
|
||||
Notification.init({
|
||||
userId: {
|
||||
@@ -15,12 +20,6 @@ Notification.init({
|
||||
allowNull: true,
|
||||
field: 'character_name'
|
||||
},
|
||||
characterName: {
|
||||
type: DataTypes.VIRTUAL,
|
||||
get() {
|
||||
return this.getDataValue('character_name') || null;
|
||||
}
|
||||
},
|
||||
shown: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
|
||||
Reference in New Issue
Block a user