Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 27 additions & 32 deletions api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Main backend API service for the CORE game website.

This NestJS service serves as the primary backend, handling:

- User authentication and management
- Team and event/tournament management
- Match results and statistics
- Database operations (PostgreSQL)
- RabbitMQ microservice communication
* User authentication and management
* Team and event/tournament management
* Match results and statistics
* Database operations (PostgreSQL)
* RabbitMQ microservice communication

## Getting Started

Expand Down Expand Up @@ -58,47 +58,42 @@ brew install pnpm

### Production

- **Build:** `pnpm build`
- **Start:** `pnpm start:prod`
* **Build:** `pnpm build`
* **Start:** `pnpm start:prod`

## Environment Variables

### Database (Required)

- `DB_HOST` - PostgreSQL host
- `DB_PORT` - PostgreSQL port
- `DB_USER` - Database username
- `DB_PASSWORD` - Database password
- `DB_NAME` - Database name
- `DB_SCHEMA` - Database schema
- `DB_URL` - Alternative database connection URL overwrites the other database connection variables
- `DB_SSL_REQUIRED` - Enable SSL connection (true/false)
* `DB_HOST` - PostgreSQL host
* `DB_PORT` - PostgreSQL port
* `DB_USER` - Database username
* `DB_PASSWORD` - Database password
* `DB_NAME` - Database name
* `DB_SCHEMA` - Database schema
* `DB_URL` - Alternative database connection URL overwrites the other database connection variables
* `DB_SSL_REQUIRED` - Enable SSL connection (true/false)

### External Services (Required)

- `RABBITMQ_URL` - RabbitMQ connection URL
- `API_SECRET_ENCRYPTION_KEY` - Key for encrypting sensitive data
* `RABBITMQ_URL` - RabbitMQ connection URL
* `API_SECRET_ENCRYPTION_KEY` - Key for encrypting sensitive data

### Optional

- `PORT` - Server port (default: 4000)
- `NODE_ENV` - Environment (development/production)
* `PORT` - Server port (default: 4000)
* `NODE_ENV` - Environment (development/production)

## Database Management

### Migrations

- **Generate:** `pnpm migration:generate migration_name`
* **Generate:** `pnpm migration:generate migration_name`
Compares your current TypeScript entities with the database and automatically generates the necessary SQL (e.g., adding or removing columns). **Use this for most schema changes.**
- **Create:** `pnpm migration:create migration_name`
* **Create:** `pnpm migration:create migration_name`
Creates an empty migration template. **Use this only for manual SQL changes** (e.g., seeding data, creating complex views, or custom indexes) that TypeORM cannot detect automatically.
- **Run:** `pnpm migration:run-local` (local) / `pnpm migration:run` (production)
- **Revert:** `pnpm migration:revert-local` (local) / `pnpm migration:revert` (production)

### Seeding

- **Seed Users and Teams:** `pnpm seed:users <eventId>`
Generates 90 users and 30 teams (3 members each) and assigns them to the specified event. This is useful for testing group phases and bracket logic.
* **Run:** `pnpm migration:run-local` (local) / `pnpm migration:run` (production)
* **Revert:** `pnpm migration:revert-local` (local) / `pnpm migration:revert` (production)

## API Documentation

Expand All @@ -109,10 +104,10 @@ When running in development mode, Swagger documentation is available at:

This service runs as both:

- **REST API** - HTTP endpoints for frontend communication
- **Microservice** - RabbitMQ message consumer for:
- `game_results` - Match result processing
- `github-service-results` - GitHub operation results
* **REST API** - HTTP endpoints for frontend communication
* **Microservice** - RabbitMQ message consumer for:
* `game_results` - Match result processing
* `github-service-results` - GitHub operation results

## Environment Variables

Expand Down
3 changes: 1 addition & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@
"migration:generate": "sh -c 'npm run typeorm:ts -- -d ./typeOrm.config.ts migration:generate ./db/migrations/\"$0\"'",
"migration:create": "sh -c 'npm run typeorm:ts -- migration:create ./db/migrations/\"$0\"'",
"migration:revert": "npm run typeorm -- -d ./dist/typeOrm.config.js migration:revert",
"migration:revert-local": "npm run typeorm:ts -- -d ./typeOrm.config.ts migration:revert",
"seed:users": "ts-node -r tsconfig-paths/register src/scripts/seed-users-teams.ts"
"migration:revert-local": "npm run typeorm:ts -- -d ./typeOrm.config.ts migration:revert"
},
"dependencies": {
"@nestjs/common": "^11.1.12",
Expand Down
106 changes: 0 additions & 106 deletions api/src/scripts/seed-users-teams.ts

This file was deleted.

27 changes: 1 addition & 26 deletions frontend/app/events/[id]/bracket/actions.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
"use client";
import { useRouter, useSearchParams } from "next/navigation";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";

export default function Actions() {
const router = useRouter();
const searchParams = useSearchParams();
const isAdminView = searchParams.get("adminReveal") === "true";

return (
<div className="flex items-center space-x-2 bg-muted/50 px-3 py-1.5 rounded-full border border-border shadow-sm">
<Switch
id="admin-view"
checked={isAdminView}
onCheckedChange={(value) => {
const params = new URLSearchParams(searchParams.toString());
params.set("adminReveal", value ? "true" : "false");
router.replace(`?${params.toString()}`);
}}
/>
<Label
htmlFor="admin-view"
className="text-xs font-medium cursor-pointer select-none"
>
Admin View
</Label>
</div>
);
return <></>;
}
Loading