feat: Einführung von Umgebungsvariablen und Startskripten für die Backend-Anwendung
- Hinzufügen eines zentralen Skripts zum Laden von Umgebungsvariablen aus einer .env-Datei. - Implementierung von Start- und Entwicklungs-Skripten in der package.json für eine vereinfachte Ausführung der Anwendung. - Bereinigung und Entfernung nicht mehr benötigter Minigame-Modelle und -Services zur Verbesserung der Codebasis. - Anpassungen an den Datenbankmodellen zur Unterstützung von neuen Assoziationen und zur Verbesserung der Lesbarkeit.
This commit is contained in:
@@ -97,30 +97,15 @@ 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 Campaign 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';
|
||||
import Match3TileType from './match3/tileType.js';
|
||||
import Match3LevelTileType from './match3/levelTileType.js';
|
||||
import Objective from './match3/objective.js';
|
||||
import UserProgress from './match3/userProgress.js';
|
||||
import UserLevelProgress 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, {
|
||||
@@ -789,77 +774,16 @@ export default function setupAssociations() {
|
||||
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'
|
||||
});
|
||||
|
||||
// Match3 Tile Type associations
|
||||
Match3Level.hasMany(Match3LevelTileType, {
|
||||
foreignKey: 'levelId',
|
||||
as: 'levelTileTypes'
|
||||
});
|
||||
Match3LevelTileType.belongsTo(Match3Level, {
|
||||
foreignKey: 'levelId',
|
||||
as: 'level'
|
||||
});
|
||||
|
||||
Match3TileType.hasMany(Match3LevelTileType, {
|
||||
foreignKey: 'tileTypeId',
|
||||
as: 'levelTileTypes'
|
||||
});
|
||||
Match3LevelTileType.belongsTo(Match3TileType, {
|
||||
foreignKey: 'tileTypeId',
|
||||
as: 'tileType'
|
||||
});
|
||||
// Match3 Campaign & Levels
|
||||
Campaign.hasMany(Match3Level, { foreignKey: 'campaignId', as: 'levels' });
|
||||
Match3Level.belongsTo(Campaign, { foreignKey: 'campaignId', as: 'campaign' });
|
||||
Match3Level.hasMany(Objective, { foreignKey: 'levelId', as: 'objectives' });
|
||||
Objective.belongsTo(Match3Level, { foreignKey: 'levelId', as: 'level' });
|
||||
// User progress tracking
|
||||
Campaign.hasMany(UserProgress, { foreignKey: 'campaignId', as: 'userProgressEntries' });
|
||||
UserProgress.belongsTo(Campaign, { foreignKey: 'campaignId', as: 'campaign' });
|
||||
UserProgress.hasMany(UserLevelProgress, { foreignKey: 'userProgressId', as: 'levelProgress' });
|
||||
UserLevelProgress.belongsTo(UserProgress, { foreignKey: 'userProgressId', as: 'userProgress' });
|
||||
Match3Level.hasMany(UserLevelProgress, { foreignKey: 'levelId', as: 'userLevelProgress' });
|
||||
UserLevelProgress.belongsTo(Match3Level, { foreignKey: 'levelId', as: 'level' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user