Bereinigen und Entfernen von nicht mehr benötigten TinyMCE-Dateien und -Plugins; Aktualisierung der Internationalisierung für Deutsch und Englisch in den Falukant- und Navigationsmodulen; Verbesserung der Statusleiste und Router-Implementierung.

This commit is contained in:
Torsten Schulz (local)
2025-08-21 16:10:21 +02:00
parent 53c748a074
commit 3eb7ae4e93
170 changed files with 3850 additions and 7924 deletions

View File

@@ -97,10 +97,28 @@ import Underground from './falukant/data/underground.js';
import UndergroundType from './falukant/type/underground.js';
import Blog from './community/blog.js';
import BlogPost from './community/blog_post.js';
import MinigameCampaign from './service/minigame_campaign.js';
import MinigameCampaignLevel from './service/minigame_campaign_level.js';
import MinigameUserProgress from './service/minigame_user_progress.js';
// Match3 Models
import Match3Campaign from './match3/campaign.js';
import Match3Level from './match3/level.js';
import Match3Objective from './match3/objective.js';
import Match3UserProgress from './match3/userProgress.js';
import Match3UserLevelProgress from './match3/userLevelProgress.js';
export default function setupAssociations() {
// RoomType 1:n Room
RoomType.hasMany(Room, { foreignKey: 'roomTypeId', as: 'rooms' });
// Minigames associations
MinigameCampaign.hasMany(MinigameCampaignLevel, { foreignKey: 'campaign_id', as: 'levels' });
MinigameCampaignLevel.belongsTo(MinigameCampaign, { foreignKey: 'campaign_id', as: 'campaign' });
User.hasMany(MinigameUserProgress, { foreignKey: 'user_id', as: 'minigameProgress' });
MinigameUserProgress.belongsTo(User, { foreignKey: 'user_id', as: 'user' });
MinigameCampaign.hasMany(MinigameUserProgress, { foreignKey: 'campaign_id', as: 'userProgress' });
MinigameUserProgress.belongsTo(MinigameCampaign, { foreignKey: 'campaign_id', as: 'campaign' });
Room.belongsTo(RoomType, { foreignKey: 'roomTypeId', as: 'roomType' });
// ChatUser <-> ChatRight n:m
ChatUser.belongsToMany(ChatRight, {
@@ -768,4 +786,59 @@ export default function setupAssociations() {
Blog.hasMany(BlogPost, { foreignKey: 'blog_id', as: 'posts' });
BlogPost.belongsTo(User, { foreignKey: 'user_id', as: 'author' });
User.hasMany(BlogPost, { foreignKey: 'user_id', as: 'blogPosts' });
// Match3 associations
Match3Campaign.hasMany(Match3Level, {
foreignKey: 'campaignId',
as: 'levels'
});
Match3Level.belongsTo(Match3Campaign, {
foreignKey: 'campaignId',
as: 'campaign'
});
Match3Level.hasMany(Match3Objective, {
foreignKey: 'levelId',
as: 'objectives'
});
Match3Objective.belongsTo(Match3Level, {
foreignKey: 'levelId',
as: 'level'
});
Match3Campaign.hasMany(Match3UserProgress, {
foreignKey: 'campaignId',
as: 'userProgress'
});
Match3UserProgress.belongsTo(Match3Campaign, {
foreignKey: 'campaignId',
as: 'campaign'
});
User.hasMany(Match3UserProgress, {
foreignKey: 'userId',
as: 'match3Progress'
});
Match3UserProgress.belongsTo(User, {
foreignKey: 'userId',
as: 'user'
});
Match3UserProgress.hasMany(Match3UserLevelProgress, {
foreignKey: 'userProgressId',
as: 'levelProgress'
});
Match3UserLevelProgress.belongsTo(Match3UserProgress, {
foreignKey: 'userProgressId',
as: 'userProgress'
});
Match3Level.hasMany(Match3UserLevelProgress, {
foreignKey: 'levelId',
as: 'userProgress'
});
Match3UserLevelProgress.belongsTo(Match3Level, {
foreignKey: 'levelId',
as: 'level'
});
}

View File

@@ -86,6 +86,18 @@ import Credit from './falukant/data/credit.js';
import DebtorsPrism from './falukant/data/debtors_prism.js';
import HealthActivity from './falukant/log/health_activity.js';
// Minigames (service)
import MinigameCampaign from './service/minigame_campaign.js';
import MinigameCampaignLevel from './service/minigame_campaign_level.js';
import MinigameUserProgress from './service/minigame_user_progress.js';
// Match3 Models
import Match3Campaign from './match3/campaign.js';
import Match3Level from './match3/level.js';
import Match3Objective from './match3/objective.js';
import Match3UserProgress from './match3/userProgress.js';
import Match3UserLevelProgress from './match3/userLevelProgress.js';
// — Politische Ämter (Politics) —
import PoliticalOfficeType from './falukant/type/political_office_type.js';
import PoliticalOfficeRequirement from './falukant/predefine/political_office_prerequisite.js';
@@ -194,6 +206,14 @@ const models = {
Credit,
DebtorsPrism,
HealthActivity,
MinigameCampaign,
MinigameCampaignLevel,
MinigameUserProgress,
Match3Campaign,
Match3Level,
Match3Objective,
Match3UserProgress,
Match3UserLevelProgress,
PoliticalOfficeType,
PoliticalOfficeRequirement,
PoliticalOfficeBenefitType,

View File

@@ -0,0 +1,40 @@
import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const Campaign = sequelize.define('Campaign', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
name: {
type: DataTypes.STRING(255),
allowNull: false
},
description: {
type: DataTypes.TEXT,
allowNull: true
},
isActive: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
order: {
type: DataTypes.INTEGER,
defaultValue: 1
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
}, {
tableName: 'match3_campaigns',
schema: 'match3',
timestamps: true
});
export default Campaign;

View File

@@ -0,0 +1,61 @@
import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const Level = sequelize.define('Level', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
campaignId: {
type: DataTypes.INTEGER,
allowNull: false
},
name: {
type: DataTypes.STRING(255),
allowNull: false
},
description: {
type: DataTypes.TEXT,
allowNull: true
},
order: {
type: DataTypes.INTEGER,
defaultValue: 1
},
boardSize: {
type: DataTypes.INTEGER,
defaultValue: 8
},
tileTypes: {
type: DataTypes.JSON,
allowNull: false,
defaultValue: ['gem', 'star', 'heart', 'diamond', 'circle', 'square']
},
moveLimit: {
type: DataTypes.INTEGER,
allowNull: true
},
timeLimit: {
type: DataTypes.INTEGER,
allowNull: true
},
isActive: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
}, {
tableName: 'match3_levels',
schema: 'match3',
timestamps: true
});
export default Level;

View File

@@ -0,0 +1,52 @@
import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const Objective = sequelize.define('Objective', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
levelId: {
type: DataTypes.INTEGER,
allowNull: false
},
type: {
type: DataTypes.ENUM('score', 'matches', 'moves', 'time', 'special'),
allowNull: false
},
description: {
type: DataTypes.STRING(500),
allowNull: false
},
target: {
type: DataTypes.INTEGER,
allowNull: false
},
operator: {
type: DataTypes.ENUM('>=', '<=', '=', '>', '<'),
defaultValue: '>='
},
order: {
type: DataTypes.INTEGER,
defaultValue: 1
},
isRequired: {
type: DataTypes.BOOLEAN,
defaultValue: true
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
}, {
tableName: 'match3_objectives',
schema: 'match3',
timestamps: true
});
export default Objective;

View File

@@ -0,0 +1,78 @@
import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const UserLevelProgress = sequelize.define('UserLevelProgress', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
userProgressId: {
type: DataTypes.INTEGER,
allowNull: false
},
levelId: {
type: DataTypes.INTEGER,
allowNull: false
},
score: {
type: DataTypes.INTEGER,
defaultValue: 0
},
moves: {
type: DataTypes.INTEGER,
defaultValue: 0
},
time: {
type: DataTypes.INTEGER,
defaultValue: 0
},
stars: {
type: DataTypes.INTEGER,
defaultValue: 0
},
isCompleted: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
attempts: {
type: DataTypes.INTEGER,
defaultValue: 1
},
bestScore: {
type: DataTypes.INTEGER,
defaultValue: 0
},
bestMoves: {
type: DataTypes.INTEGER,
defaultValue: 0
},
bestTime: {
type: DataTypes.INTEGER,
defaultValue: 0
},
completedAt: {
type: DataTypes.DATE,
allowNull: true
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
}, {
tableName: 'match3_user_level_progress',
schema: 'match3',
timestamps: true,
indexes: [
{
unique: true,
fields: ['userProgressId', 'levelId']
}
]
});
export default UserLevelProgress;

View File

@@ -0,0 +1,62 @@
import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const UserProgress = sequelize.define('UserProgress', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
userId: {
type: DataTypes.STRING(255),
allowNull: false
},
campaignId: {
type: DataTypes.INTEGER,
allowNull: false
},
totalScore: {
type: DataTypes.INTEGER,
defaultValue: 0
},
totalStars: {
type: DataTypes.INTEGER,
defaultValue: 0
},
levelsCompleted: {
type: DataTypes.INTEGER,
defaultValue: 0
},
currentLevel: {
type: DataTypes.INTEGER,
defaultValue: 1
},
isCompleted: {
type: DataTypes.BOOLEAN,
defaultValue: false
},
lastPlayed: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
createdAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
},
updatedAt: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW
}
}, {
tableName: 'match3_user_progress',
schema: 'match3',
timestamps: true,
indexes: [
{
unique: true,
fields: ['userId', 'campaignId']
}
]
});
export default UserProgress;

View File

@@ -0,0 +1,24 @@
import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const MinigameCampaign = sequelize.define('minigame_campaign', {
code: {
type: DataTypes.STRING,
allowNull: false,
unique: true,
},
title: {
type: DataTypes.STRING,
allowNull: false,
},
description: {
type: DataTypes.TEXT,
allowNull: true,
},
}, {
tableName: 'minigame_campaign',
schema: 'service',
underscored: true,
});
export default MinigameCampaign;

View File

@@ -0,0 +1,25 @@
import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const MinigameCampaignLevel = sequelize.define('minigame_campaign_level', {
campaignId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'campaign_id'
},
index: { // 1-based level number
type: DataTypes.INTEGER,
allowNull: false,
},
config: {
type: DataTypes.JSONB,
allowNull: false,
defaultValue: {}
},
}, {
tableName: 'minigame_campaign_level',
schema: 'service',
underscored: true,
});
export default MinigameCampaignLevel;

View File

@@ -0,0 +1,41 @@
import { sequelize } from '../../utils/sequelize.js';
import { DataTypes } from 'sequelize';
const MinigameUserProgress = sequelize.define('minigame_user_progress', {
userId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'user_id'
},
campaignId: {
type: DataTypes.INTEGER,
allowNull: false,
field: 'campaign_id'
},
levelIndex: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 1,
field: 'level_index'
},
stars: { // 0..3
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
bestScore: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
field: 'best_score'
}
}, {
tableName: 'minigame_user_progress',
schema: 'service',
underscored: true,
indexes: [
{ unique: true, fields: ['user_id', 'campaign_id'] }
]
});
export default MinigameUserProgress;