Files
InvestPlay/apps/api/src/modules/gamification/gamification.resolver.ts
Lefteris Notas e75f913f1c
Some checks failed
CI / Lint (push) Has been cancelled
CI / TypeCheck (push) Has been cancelled
CI / Test (push) Has been cancelled
Deploy / Docker Build & Push (map[context:. dockerfile:apps/api/Dockerfile name:api]) (push) Has been cancelled
Deploy / Docker Build & Push (map[context:. dockerfile:apps/cms/Dockerfile name:cms]) (push) Has been cancelled
Deploy / Docker Build & Push (map[context:. dockerfile:apps/web/Dockerfile name:web]) (push) Has been cancelled
CI / Build (push) Has been cancelled
Deploy / Deploy (push) Has been cancelled
feat: complete Phase 1 foundation scaffold
- Monorepo: Turborepo + pnpm workspaces with 7 apps/packages
- Backend: NestJS scaffold with 9 modules (auth, tenant, curriculum, simulation, portfolio, ai-coach, analytics, classroom, gamification)
- Frontend: React 18 + Vite + TailwindCSS + shadcn/ui with 10 pages, 14 UI primitives, 3 Zustand stores
- Database: Prisma schema with 19 models, 13 enums, seed script, multi-tenant ready
- Docker: Dev, production, and Portainer Compose files with Traefik reverse proxy
- Configuration: .env.example (47 vars), Zod validation, frontend-safe env exposure
- i18n: English + Greek locale files (10 files), ICU MessageFormat, react-i18next
- Shared packages: @investplay/types, @investplay/ui, @investplay/i18n, @investplay/utils
- CI/CD: GitHub Actions (lint, typecheck, test, build, deploy, PR checks)
- Documentation: CONTEXT.md, ARCHITECTURE.md (10 Mermaid diagrams), API.md, LOCALIZATION.md, DEVELOPMENT-ROADMAP.md
- Infrastructure: Dockerfiles (dev + prod), nginx configs, backup/healthcheck scripts
- Security: JWT auth guards, role-based access, rate limiting, Helmet, CORS, PII sanitization
2026-06-12 19:32:57 +03:00

41 lines
1.3 KiB
TypeScript

import { UseGuards } from "@nestjs/common";
import { Resolver, Query, Args, Int } from "@nestjs/graphql";
import { GamificationService } from "./gamification.service.js";
import { GqlJwtGuard } from "../../common/guards/gql-jwt.guard.js";
import { CurrentUser } from "../../common/decorators/current-user.decorator.js";
import { CurrentTenant } from "../../common/decorators/current-tenant.decorator.js";
@Resolver()
@UseGuards(GqlJwtGuard)
export class GamificationResolver {
constructor(private readonly gamificationService: GamificationService) {}
@Query(() => Object)
async userXP(@CurrentUser() user: { id: string }) {
return this.gamificationService.getUserXP(user.id);
}
@Query(() => Object)
async userLevel(@CurrentUser() user: { id: string }) {
return this.gamificationService.getUserLevel(user.id);
}
@Query(() => [Object])
async badges(@CurrentUser() user: { id: string }) {
return this.gamificationService.getBadges(user.id);
}
@Query(() => Object)
async streak(@CurrentUser() user: { id: string }) {
return this.gamificationService.checkStreak(user.id);
}
@Query(() => [Object])
async leaderboard(
@CurrentTenant() tenantId: string,
@Args("limit", { type: () => Int, nullable: true, defaultValue: 20 }) limit: number,
) {
return this.gamificationService.getLeaderboard(tenantId, limit);
}
}