feat(sprint4): achievements, community goals, hall of fame, profile
Some checks failed
CI/CD — Build & Deploy / Build & Deploy (push) Failing after 37s

4 modules: achievement (15 succès, 5 catégories, 3 paliers), community
(objectifs collectifs + boosts globaux), halloffame (classement mensuel),
profile (titre actif + badges + % progression).

Event-driven: combat/forge/craft émettent des events via @nestjs/event-emitter.
Character entity: +activeTitle, +totalGoldEarned.
Seeds: 15 achievements + 3 community goals.
This commit is contained in:
2026-03-24 14:51:53 +01:00
parent 77052d9219
commit 8ee50805ea
30 changed files with 1078 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
import { Injectable, BadRequestException, NotFoundException } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { EventEmitter2 } from '@nestjs/event-emitter';
import { CharacterItem } from '../item/character-item.entity';
import { Character } from '../character/entities/character.entity';
import { User } from '../user/user.entity';
@@ -24,6 +25,7 @@ export class ForgeService {
private readonly charItemRepository: Repository<CharacterItem>,
@InjectRepository(Character)
private readonly characterRepository: Repository<Character>,
private readonly eventEmitter: EventEmitter2,
) {}
async upgradeItem(charItemId: string, user: User) {
@@ -46,6 +48,18 @@ export class ForgeService {
charItem.forgeLevel = targetLevel;
await this.charItemRepository.save(charItem);
// Emit achievement & community events
this.eventEmitter.emit('achievement.check', {
characterId: char.id,
type: 'forge_upgrades',
increment: 1,
});
this.eventEmitter.emit('community.contribute', {
characterId: char.id,
type: 'total_forge_upgrades',
increment: 1,
});
const statLabel = charItem.item.type === 'weapon'
? `+${FORGE_BONUS_PER_LEVEL} ATK`
: `+${FORGE_BONUS_PER_LEVEL} DEF`;