creator, creation date on deck #61
@@ -16,6 +16,8 @@ export interface ShortDeckDto {
|
|||||||
playedNumber: number;
|
playedNumber: number;
|
||||||
ctype: number;
|
ctype: number;
|
||||||
cardsCount: number;
|
cardsCount: number;
|
||||||
|
creator: string;
|
||||||
|
creationdate: Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DetailDeckDto {
|
export interface DetailDeckDto {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { DeckAggregate } from '../../../Domain/Deck/DeckAggregate';
|
import { DeckAggregate } from '../../../Domain/Deck/DeckAggregate';
|
||||||
|
import { UserAggregate } from '../../../Domain/User/UserAggregate';
|
||||||
import { CreateDeckDto, UpdateDeckDto, ShortDeckDto, DetailDeckDto } from '../DeckDto';
|
import { CreateDeckDto, UpdateDeckDto, ShortDeckDto, DetailDeckDto } from '../DeckDto';
|
||||||
|
|
||||||
export class DeckMapper {
|
export class DeckMapper {
|
||||||
@@ -10,6 +11,8 @@ export class DeckMapper {
|
|||||||
playedNumber: deck.playedNumber,
|
playedNumber: deck.playedNumber,
|
||||||
ctype: deck.ctype,
|
ctype: deck.ctype,
|
||||||
cardsCount: deck.cards.length,
|
cardsCount: deck.cards.length,
|
||||||
|
creator: deck.user?.username || 'Unknown',
|
||||||
|
creationdate: deck.creationdate
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,6 +37,8 @@ export class DeckMapper {
|
|||||||
playedNumber: deck.playedNumber,
|
playedNumber: deck.playedNumber,
|
||||||
ctype: deck.ctype,
|
ctype: deck.ctype,
|
||||||
cardsCount: deck.cards.length,
|
cardsCount: deck.cards.length,
|
||||||
|
creator: deck.user?.username || 'Unknown',
|
||||||
|
creationdate: deck.creationdate
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
||||||
import { OrganizationAggregate } from '../Organization/OrganizationAggregate';
|
import { OrganizationAggregate } from '../Organization/OrganizationAggregate';
|
||||||
|
import { UserAggregate } from '../User/UserAggregate';
|
||||||
|
|
||||||
export enum Type {
|
export enum Type {
|
||||||
LUCK = 0,
|
LUCK = 0,
|
||||||
@@ -81,4 +82,8 @@ export class DeckAggregate {
|
|||||||
@ManyToOne(() => OrganizationAggregate, { nullable: true })
|
@ManyToOne(() => OrganizationAggregate, { nullable: true })
|
||||||
@JoinColumn({ name: 'organization_id' })
|
@JoinColumn({ name: 'organization_id' })
|
||||||
organization!: OrganizationAggregate | null;
|
organization!: OrganizationAggregate | null;
|
||||||
|
|
||||||
|
@ManyToOne(() => UserAggregate, { eager: false })
|
||||||
|
@JoinColumn({ name: 'user_id' })
|
||||||
|
user!: UserAggregate | null;
|
||||||
}
|
}
|
||||||
@@ -255,7 +255,7 @@ export class DeckRepository implements IDeckRepository {
|
|||||||
|
|
||||||
const [decks, totalCount] = await this.repo.findAndCount({
|
const [decks, totalCount] = await this.repo.findAndCount({
|
||||||
where: { state: Not(State.SOFT_DELETE) },
|
where: { state: Not(State.SOFT_DELETE) },
|
||||||
relations: ['organization'],
|
relations: ['organization', 'user'],
|
||||||
order: { creationdate: 'DESC' },
|
order: { creationdate: 'DESC' },
|
||||||
skip,
|
skip,
|
||||||
take
|
take
|
||||||
@@ -270,6 +270,7 @@ export class DeckRepository implements IDeckRepository {
|
|||||||
// Regular user complex filtering
|
// Regular user complex filtering
|
||||||
const queryBuilder = this.repo.createQueryBuilder('deck')
|
const queryBuilder = this.repo.createQueryBuilder('deck')
|
||||||
.leftJoinAndSelect('deck.organization', 'org')
|
.leftJoinAndSelect('deck.organization', 'org')
|
||||||
|
.leftJoinAndSelect('deck.user', 'user')
|
||||||
.where('deck.state != :deletedState', { deletedState: State.SOFT_DELETE });
|
.where('deck.state != :deletedState', { deletedState: State.SOFT_DELETE });
|
||||||
|
|
||||||
queryBuilder.andWhere('(' +
|
queryBuilder.andWhere('(' +
|
||||||
|
|||||||
@@ -0,0 +1,206 @@
|
|||||||
|
services:
|
||||||
|
# Backend service with hot reload
|
||||||
|
backend:
|
||||||
|
build:
|
||||||
|
context: ../SerpentRace_Backend
|
||||||
|
dockerfile: ../SerpentRace_Docker/Dockerfile_backend.dev
|
||||||
|
container_name: serpentrace-backend-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- .env.dev
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
- PORT=3000
|
||||||
|
- FRONTEND_URL=http://localhost:5173
|
||||||
|
- DB_HOST=postgres
|
||||||
|
- DB_PORT=5432
|
||||||
|
- DB_NAME=serpentrace
|
||||||
|
- DB_USERNAME=postgres
|
||||||
|
- DB_PASSWORD=postgres
|
||||||
|
- REDIS_URL=redis://redis:6379
|
||||||
|
- REDIS_HOST=redis
|
||||||
|
- REDIS_PORT=6379
|
||||||
|
- MINIO_ENDPOINT=minio
|
||||||
|
- MINIO_PORT=9000
|
||||||
|
- MINIO_ACCESS_KEY=serpentrace
|
||||||
|
- MINIO_SECRET_KEY=serpentrace123!
|
||||||
|
- MINIO_USE_SSL=false
|
||||||
|
volumes: [ ../SerpentRace_Backend/logs:/app/logs ]
|
||||||
|
develop:
|
||||||
|
watch:
|
||||||
|
- action: sync
|
||||||
|
path: ../SerpentRace_Backend/src
|
||||||
|
target: /app/src
|
||||||
|
ignore:
|
||||||
|
- node_modules/
|
||||||
|
- dist/
|
||||||
|
- "*.log"
|
||||||
|
- action: sync
|
||||||
|
path: ../SerpentRace_Backend/package.json
|
||||||
|
target: /app/package.json
|
||||||
|
- action: rebuild
|
||||||
|
path: ../SerpentRace_Backend/package-lock.json
|
||||||
|
- action: rebuild
|
||||||
|
path: ../SerpentRace_Backend/tsconfig.json
|
||||||
|
- action: rebuild
|
||||||
|
path: ./Dockerfile_backend.dev
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
minio:
|
||||||
|
condition: service_healthy
|
||||||
|
network_mode: host
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 40s
|
||||||
|
|
||||||
|
# Frontend service with hot reload
|
||||||
|
frontend:
|
||||||
|
build:
|
||||||
|
context: ../SerpentRace_Frontend
|
||||||
|
dockerfile: ../SerpentRace_Docker/Dockerfile_frontend.dev
|
||||||
|
container_name: serpentrace-frontend-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "5173:5173"
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=development
|
||||||
|
- VITE_API_URL=http://localhost:3000
|
||||||
|
volumes: []
|
||||||
|
develop:
|
||||||
|
watch:
|
||||||
|
- action: sync
|
||||||
|
path: ../SerpentRace_Frontend/src
|
||||||
|
target: /app/src
|
||||||
|
ignore:
|
||||||
|
- node_modules/
|
||||||
|
- dist/
|
||||||
|
- "*.log"
|
||||||
|
- action: sync
|
||||||
|
path: ../SerpentRace_Frontend/public
|
||||||
|
target: /app/public
|
||||||
|
- action: sync
|
||||||
|
path: ../SerpentRace_Frontend/package.json
|
||||||
|
target: /app/package.json
|
||||||
|
- action: rebuild
|
||||||
|
path: ../SerpentRace_Frontend/package-lock.json
|
||||||
|
- action: rebuild
|
||||||
|
path: ../SerpentRace_Frontend/vite.config.js
|
||||||
|
- action: rebuild
|
||||||
|
path: ./Dockerfile_frontend.dev
|
||||||
|
depends_on:
|
||||||
|
- backend
|
||||||
|
network_mode: host
|
||||||
|
|
||||||
|
# PostgreSQL Database
|
||||||
|
postgres:
|
||||||
|
image: postgres:15-alpine
|
||||||
|
container_name: serpentrace-postgres-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: serpentrace
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_INITDB_ARGS: "--encoding=UTF-8"
|
||||||
|
volumes:
|
||||||
|
- postgres_dev_data:/var/lib/postgresql/data
|
||||||
|
- ./sql_schema_only.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
||||||
|
network_mode: host
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
# Redis Cache
|
||||||
|
redis:
|
||||||
|
image: redis:7-alpine
|
||||||
|
container_name: serpentrace-redis-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "6379:6379"
|
||||||
|
volumes:
|
||||||
|
- redis_dev_data:/data
|
||||||
|
command: redis-server --appendonly yes
|
||||||
|
network_mode: host
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "redis-cli", "ping"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
# MinIO Object Storage
|
||||||
|
minio:
|
||||||
|
image: minio/minio:latest
|
||||||
|
container_name: serpentrace-minio-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "9000:9000"
|
||||||
|
- "9001:9001"
|
||||||
|
environment:
|
||||||
|
MINIO_ROOT_USER: serpentrace
|
||||||
|
MINIO_ROOT_PASSWORD: serpentrace123!
|
||||||
|
volumes:
|
||||||
|
- minio_dev_data:/data
|
||||||
|
command: server /data --console-address ":9001"
|
||||||
|
network_mode: host
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
|
||||||
|
# Redis Commander for development debugging
|
||||||
|
redis-commander:
|
||||||
|
image: rediscommander/redis-commander:latest
|
||||||
|
container_name: serpentrace-redis-commander-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8081:8081"
|
||||||
|
environment:
|
||||||
|
- REDIS_HOSTS=local:redis:6379
|
||||||
|
depends_on:
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
|
network_mode: host
|
||||||
|
|
||||||
|
# Database administration tool
|
||||||
|
pgadmin:
|
||||||
|
image: dpage/pgadmin4:latest
|
||||||
|
container_name: serpentrace-pgadmin-dev
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8080:80"
|
||||||
|
environment:
|
||||||
|
PGADMIN_DEFAULT_EMAIL: admin@serpentrace.dev
|
||||||
|
PGADMIN_DEFAULT_PASSWORD: admin
|
||||||
|
PGADMIN_CONFIG_SERVER_MODE: 'False'
|
||||||
|
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: 'False'
|
||||||
|
PGADMIN_CONFIG_WTF_CSRF_ENABLED: 'False'
|
||||||
|
volumes:
|
||||||
|
- pgadmin_dev_data:/var/lib/pgadmin
|
||||||
|
- ./pgadmin_servers.json:/pgadmin4/servers.json:ro
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
network_mode: host
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_dev_data:
|
||||||
|
driver: local
|
||||||
|
redis_dev_data:
|
||||||
|
driver: local
|
||||||
|
minio_dev_data:
|
||||||
|
driver: local
|
||||||
|
pgadmin_dev_data:
|
||||||
|
driver: local
|
||||||
Generated
+23
@@ -15,6 +15,7 @@
|
|||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-icons": "^5.5.0",
|
"react-icons": "^5.5.0",
|
||||||
"react-router-dom": "^7.6.0",
|
"react-router-dom": "^7.6.0",
|
||||||
|
"react-toastify": "^11.0.5",
|
||||||
"tailwindcss": "^4.1.7"
|
"tailwindcss": "^4.1.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -1816,6 +1817,15 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/clsx": {
|
||||||
|
"version": "2.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||||
|
"integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/color-convert": {
|
"node_modules/color-convert": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
@@ -3363,6 +3373,19 @@
|
|||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-toastify": {
|
||||||
|
"version": "11.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/react-toastify/-/react-toastify-11.0.5.tgz",
|
||||||
|
"integrity": "sha512-EpqHBGvnSTtHYhCPLxML05NLY2ZX0JURbAdNYa6BUkk+amz4wbKBQvoKQAB0ardvSarUBuY4Q4s1sluAzZwkmA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"clsx": "^2.1.1"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"react": "^18 || ^19",
|
||||||
|
"react-dom": "^18 || ^19"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/resolve-from": {
|
"node_modules/resolve-from": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.1.0",
|
||||||
"react-icons": "^5.5.0",
|
"react-icons": "^5.5.0",
|
||||||
"react-router-dom": "^7.6.0",
|
"react-router-dom": "^7.6.0",
|
||||||
|
"react-toastify": "^11.0.5",
|
||||||
"tailwindcss": "^4.1.7"
|
"tailwindcss": "^4.1.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ if %errorlevel% neq 0 (
|
|||||||
|
|
||||||
if "%1"=="dev:start" goto dev_start
|
if "%1"=="dev:start" goto dev_start
|
||||||
if "%1"=="dev:watch" goto dev_watch
|
if "%1"=="dev:watch" goto dev_watch
|
||||||
|
if "%1"=="dev:watch_nat" goto dev_watch_nat
|
||||||
if "%1"=="dev:stop" goto dev_stop
|
if "%1"=="dev:stop" goto dev_stop
|
||||||
if "%1"=="prod:start" goto prod_start
|
if "%1"=="prod:start" goto prod_start
|
||||||
if "%1"=="prod:stop" goto prod_stop
|
if "%1"=="prod:stop" goto prod_stop
|
||||||
@@ -49,6 +50,16 @@ docker-compose -f docker-compose.watch.yml --env-file .env.dev up --build --watc
|
|||||||
cd ..
|
cd ..
|
||||||
goto end
|
goto end
|
||||||
|
|
||||||
|
:dev_watch_nat
|
||||||
|
echo [INFO] Starting SerpentRace development environment with file watchers without nat...
|
||||||
|
echo [INFO] This will automatically sync file changes and rebuild containers as needed
|
||||||
|
cd SerpentRace_Docker
|
||||||
|
echo [INFO] This will use system network to avoid nat
|
||||||
|
docker-compose -f docker-compose.watch.nat.yml --env-file .env.dev up --build --watch
|
||||||
|
cd ..
|
||||||
|
goto end
|
||||||
|
|
||||||
|
|
||||||
:dev_stop
|
:dev_stop
|
||||||
echo [INFO] Stopping SerpentRace development environment...
|
echo [INFO] Stopping SerpentRace development environment...
|
||||||
cd SerpentRace_Docker
|
cd SerpentRace_Docker
|
||||||
@@ -109,6 +120,7 @@ echo.
|
|||||||
echo Commands:
|
echo Commands:
|
||||||
echo dev:start Start development environment with hot reload
|
echo dev:start Start development environment with hot reload
|
||||||
echo dev:watch Start development environment with file watchers (auto-rebuild)
|
echo dev:watch Start development environment with file watchers (auto-rebuild)
|
||||||
|
echo dev:watch_nat Start development environment with file watchers (auto-rebuild); Without NAT
|
||||||
echo dev:stop Stop development environment
|
echo dev:stop Stop development environment
|
||||||
echo prod:start Start production environment
|
echo prod:start Start production environment
|
||||||
echo prod:stop Stop production environment
|
echo prod:stop Stop production environment
|
||||||
|
|||||||
Reference in New Issue
Block a user