Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
99908e8
refactor: use shared jest.base.js for client and server jest configs
buzz-code May 3, 2026
99b5760
chore: update submodule pointers to feat/generalization-2026-04
buzz-code May 3, 2026
6103353
feat: use reusable run-tests workflow from multi-repo-codespace
buzz-code May 3, 2026
d829c18
chore: standardize Dockerfiles and rename docker-compose services to …
buzz-code May 3, 2026
8f9a8a7
feat: use shared AppController, AppService, and bootstrapNraApplication
buzz-code May 3, 2026
178044d
feat: remove re-export shims and stale tests, update server/shared fo…
buzz-code May 3, 2026
1996811
feat: migrate to BaseNraAppModule.forRoot and createSharedEntitiesImp…
buzz-code May 3, 2026
37894de
feat: migrate App.jsx to buildResources DSL, update client/shared poi…
buzz-code May 3, 2026
97cd859
feat: add prettier script to server package.json (Day 10)
buzz-code May 3, 2026
b119489
feat: migrate vite.config.js to createViteConfig factory, fix dev por…
buzz-code May 3, 2026
640221b
refactor: complete buildResources conversion in App.jsx (Day 9 follow…
buzz-code May 3, 2026
fd90024
refactor: convert condition properties to function items in App.jsx (…
buzz-code May 3, 2026
e7df934
chore: sync override with template, use direct API URL, remove proxy
buzz-code May 5, 2026
e031fe4
chore: update nra-client submodule pointer (remove proxy from createV…
buzz-code May 5, 2026
5f0fab1
chore: remove docker-compose.override.yml from gitignore (file is now…
buzz-code May 5, 2026
8d2e3d2
fix: run migrations on dev container startup
buzz-code May 7, 2026
d602085
chore: add typeorm:run:ts script and shorten compose dev command
buzz-code May 7, 2026
6a8d860
chore: simplify typeorm:cli - add --transpile-only directly, remove c…
buzz-code May 7, 2026
9485ccc
chore: fix MYSQL_HOST to 'database', add .vite-cache to .gitignore, r…
buzz-code May 7, 2026
fac91fe
chore: sync shared submodules to main and align app configs
buzz-code May 9, 2026
1e55dfb
ci: use correct inputs for shared reusable test workflow
buzz-code May 9, 2026
90f51b0
fix: address copilot CI, docker, and compose review feedback
buzz-code May 9, 2026
ade1c60
ci: inline test jobs to remove cross-repo reusable workflow dependency
buzz-code May 9, 2026
8d65bae
fix: remove network override from dev compose, restore e2e in CI, dro…
buzz-code May 9, 2026
6c88be2
fix: restore paths-filter, recordRepresentation, AGENTS.md, override …
buzz-code May 9, 2026
cf18fe3
fix: restore student menu order and swagger config
buzz-code May 10, 2026
3e85ed6
refactor: revert App.jsx to flat inline Resources
buzz-code May 10, 2026
4585c09
fix: use anonymous volumes for node_modules in override template
buzz-code May 10, 2026
d79b8ed
fix: restore caddy/elknet external:false in override template (needed…
buzz-code May 10, 2026
1ee59ca
fix: revert to host bind-mount for node_modules (Dockerfile dev stage…
buzz-code May 10, 2026
370c560
chore: update nra-server submodule (reflect-metadata migration fix)
buzz-code May 10, 2026
bed99b6
chore: update nra-server submodule (AuditLog explicit column types)
buzz-code May 10, 2026
037b628
chore: update nra-server (boolean column fix)
buzz-code May 10, 2026
6011ab6
fix: remove --transpile-only from typeorm:cli so emitDecoratorMetadat…
buzz-code May 10, 2026
e02e7e9
fix: add --project tsconfig.json to ts-node in typeorm:cli for proper…
buzz-code May 10, 2026
cb51314
test: add GET / endpoint e2e test
buzz-code May 17, 2026
7e430ce
test: use shared e2e factory, align jest-e2e config
buzz-code May 17, 2026
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
2 changes: 1 addition & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
DOMAIN_NAME=demo.yoman.online
MYSQL_HOST=mysql
MYSQL_HOST=database
MYSQL_USER=mysql_user
MYSQL_PASSWORD=mysql_password
MYSQL_DATABASE=mysql_database
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "Copilot Setup Steps"

# Automatically run the setup steps when they are changed to allow for easy validation, and
# allow manual testing through the repository's "Actions" tab
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml

jobs:
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
copilot-setup-steps:
runs-on: ubuntu-latest

# Set the permissions to the lowest permissions possible needed for your steps.
# Copilot will be given its own token for its operations.
permissions:
# Clone the repository to install dependencies
contents: read

# Environment variables to configure development tools
env:
# Skip Chromium download for Puppeteer (firewall restrictions)
PUPPETEER_SKIP_DOWNLOAD: true
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Initialize git submodules for shared components
submodules: recursive

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
cache-dependency-path: |
server/yarn.lock
client/yarn.lock

- name: Install server dependencies
working-directory: ./server
run: yarn install --frozen-lockfile

- name: Install client dependencies
working-directory: ./client
run: yarn install --frozen-lockfile

# - name: Build server
# working-directory: ./server
# run: yarn build

# - name: Build client
# working-directory: ./client
# run: yarn build

# - name: Verify server tests can run
# working-directory: ./server
# run: yarn test --passWithNoTests

# - name: Verify client tests can run
# working-directory: ./client
# run: yarn test --passWithNoTests
4 changes: 1 addition & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Run tests on pull request
on:
pull_request:
branches:
- main
- main

jobs:
prepare:
Expand All @@ -28,7 +28,6 @@ jobs:
server:
- 'server/**'


server-tests:
name: Run server tests
runs-on: ubuntu-latest
Expand All @@ -49,7 +48,6 @@ jobs:
- run: yarn
- run: yarn test
- run: yarn test:e2e


client-tests:
name: Run client tests
Expand Down
2 changes: 2 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

.vite-cache/
12 changes: 6 additions & 6 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM node:18-alpine as development
FROM node:18-alpine AS development

RUN apk add git
RUN apk add --no-cache git

WORKDIR /app
ENV NODE_ENV development

# COPY package*.json /app/
# COPY yarn.lock /app/
WORKDIR /app

# No need to do this, because external node_modules are mounted
# COPY package*.json yarn.lock ./
# RUN yarn install

# COPY . .

CMD ["yarn", "start"]
Expand Down
9 changes: 3 additions & 6 deletions client/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
const base = require('./shared/config/jest.base');
module.exports = {
moduleNameMapper: {
"src/(.*)": "<rootDir>/src/$1",
"@shared/(.*)": "<rootDir>/shared/$1"
},
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['./src/setupTests.js'],
...base,
setupFilesAfterEnv: ['<rootDir>/src/setupTests.js'],
};
4 changes: 1 addition & 3 deletions client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const App = () => (
<Resource name="teacher_report_status" {...teacherReportStatus} options={{ menuGroup: 'report' }} icon={RuleIcon} />
<Resource name="teacher_grade_report_status" {...teacherGradeReportStatus} options={{ menuGroup: 'report' }} icon={RuleIcon} />
<Resource name="teacher_salary_report" {...teacherSalaryReport} options={{ menuGroup: 'report' }} icon={LocalAtmIcon} />

{isAdmin(permissions) && <Resource name="student_percent_report" {...studentPercentReport} options={{ menuGroup: 'report' }} icon={SummarizeIcon} />}
<Resource name="report_month" {...reportMonth} options={{ menuGroup: 'settings' }} icon={DateRangeIcon} />
{CommonSettingsResources()}
{isUploadedFiles(permissions) && <Resource name="uploaded_file" {...uploadedFile} options={{ menuGroup: 'settings' }} icon={UploadFileIcon} />}
Expand All @@ -155,8 +155,6 @@ const App = () => (
<Resource name="student_by_year" {...(isAdmin(permissions) ? resourceEntityGuesser : {})} recordRepresentation={CommonRepresentation} options={{ menuGroup: 'admin' }} icon={PermContactCalendarIcon} />
<Resource name="grade_effect_by_user" {...(isAdmin(permissions) ? resourceEntityGuesser : {})} recordRepresentation={'effect'} options={{ menuGroup: 'admin' }} icon={AdminPanelSettingsIcon} />
<Resource name="abs_count_effect_by_user" {...(isAdmin(permissions) ? resourceEntityGuesser : {})} recordRepresentation={'effect'} options={{ menuGroup: 'admin' }} icon={AdminPanelSettingsIcon} />

{isAdmin(permissions) && <Resource name="student_percent_report" {...studentPercentReport} options={{ menuGroup: 'report' }} icon={SummarizeIcon} />}
{CommonAdminResources({ permissions })}

{isLessonSignature(permissions) && <>
Expand Down
40 changes: 2 additions & 38 deletions client/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,2 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from 'path';

export default ({ mode }) => {
return defineConfig({
envPrefix: 'REACT_APP',
plugins: [react()],
server: {
host: '0.0.0.0',
port: Number(process.env.PORT || 3000),
hmr: {
overlay: true,
clientPort: 3000,
},
},
define: {
"process.env.NODE_ENV": `"${mode}"`,
"process.env.REACT_APP_API_URL": `"${process.env.REACT_APP_API_URL ?? ''}"`,
},
resolve: {
alias: {
'@shared': path.resolve(__dirname, './shared'),
'src': path.resolve(__dirname, './src')
},
},
build: {
rollupOptions: {
onwarn(warning, warn) {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
return
}
warn(warning)
}
}
},
})
}
import { createViteConfig } from './shared/config/createViteConfig';
export default createViteConfig();
34 changes: 23 additions & 11 deletions docker-compose.override.yml.template
Original file line number Diff line number Diff line change
@@ -1,39 +1,51 @@
version: "3"
name: react-admin-nestjs-dev
services:
frontend:
container_name: frontend-dev
client:
container_name: ran-client-dev
build:
target: development
environment:
PORT: 3000
REACT_APP_API_URL: http://localhost:3001
ports:
- "3000:3000" # Main Vite dev server port
- "3000:3000"
- "24678:24678"
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/"]
interval: 10s
timeout: 5s
start_period: 60s
retries: 3
volumes:
- ./client:/app
- ./client/node_modules:/app/node_modules
networks:
- private-network

backend:
container_name: backend-dev
server:
container_name: ran-server-dev
build:
target: development
command: sh -c "yarn typeorm:run && yarn start:dev"
ports:
- "3001:3000" # Map container port 3000 to host port 3001
- "3001:3000"
volumes:
- ./server:/app
- ./server/node_modules:/app/node_modules
networks:
Comment on lines 20 to 36
- private-network

mysql:
container_name: mysql-dev
database:
container_name: ran-database-dev
ports:
- "3306:3306" # MySQL port for local access
- "3306:3306"

phpmyadmin:
container_name: php-myadmin-dev
container_name: ran-phpmyadmin-dev
profiles: [tools]
ports:
- "8080:80" # PhpMyAdmin web interface
- "8080:80"
networks:
- private-network

Expand Down
20 changes: 10 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
version: "3"
services:
frontend:
container_name: frontend
client:
container_name: client
restart: unless-stopped
depends_on:
- backend
- server
build:
Comment on lines +3 to 8
context: ./client
target: production
Expand Down Expand Up @@ -44,8 +44,8 @@ services:
window: 120s


backend:
container_name: backend
server:
container_name: server
restart: unless-stopped
build:
context: ./server
Expand All @@ -64,7 +64,7 @@ services:
MAINTENANCE_MODE: $MAINTENANCE_MODE
MAINTENANCE_MESSAGE: $MAINTENANCE_MESSAGE
depends_on:
- mysql
- database
labels:
caddy: api.$DOMAIN_NAME
caddy.reverse_proxy: "{{upstreams 3000}}"
Expand Down Expand Up @@ -97,8 +97,8 @@ services:
max_attempts: 3
window: 120s

mysql:
container_name: mysql
database:
container_name: database
restart: unless-stopped
build:
context: ./db
Expand All @@ -119,13 +119,13 @@ services:
container_name: php-myadmin
restart: unless-stopped
depends_on:
- mysql
- database
image: phpmyadmin
labels:
caddy: sql.$DOMAIN_NAME
caddy.reverse_proxy: "{{upstreams 80}}"
environment:
PMA_HOST: mysql
PMA_HOST: database
MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
# ports:
# - "80"
Expand Down
2 changes: 0 additions & 2 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ CMD ["yarn", "start:dev"]

FROM node:16-alpine AS builder

RUN apk add curl bash

WORKDIR /app

COPY package*.json /app/
Expand Down
14 changes: 7 additions & 7 deletions server/helpers/sync-db-from-data-sql.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ set -e
echo "🔄 Syncing database from data.sql..."

# Check if docker compose is running
if ! docker compose ps mysql | grep -q "Up"; then
echo "❌ Database container is not running. Please start it with: docker compose up -d mysql"
if ! docker compose ps database | grep -q "Up"; then
echo "❌ Database container is not running. Please start it with: docker compose up -d database"
exit 1
fi

# Wait for MySQL to be ready
echo "⏳ Waiting for MySQL to be ready..."
timeout=30
counter=0
until docker compose exec mysql mysqladmin ping -h localhost --silent 2>/dev/null; do
until docker compose exec database mysqladmin ping -h localhost --silent 2>/dev/null; do
sleep 1
counter=$((counter + 1))
if [ $counter -ge $timeout ]; then
Expand All @@ -35,15 +35,15 @@ DB_PASSWORD=${MYSQL_PASSWORD:-mysql_password}

# Drop and recreate database
echo "🗑️ Dropping existing database..."
docker compose exec mysql mysql -u"$DB_USER" -p"$DB_PASSWORD" -e "DROP DATABASE IF EXISTS \`$DB_NAME\`;"
docker compose exec database mysql -u"$DB_USER" -p"$DB_PASSWORD" -e "DROP DATABASE IF EXISTS \`$DB_NAME\`;"

echo "📦 Creating fresh database..."
docker compose exec mysql mysql -u"$DB_USER" -p"$DB_PASSWORD" -e "CREATE DATABASE \`$DB_NAME\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
docker compose exec database mysql -u"$DB_USER" -p"$DB_PASSWORD" -e "CREATE DATABASE \`$DB_NAME\` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

# Import data.sql
echo "📥 Importing data.sql..."
docker compose exec -T mysql mysql -u"$DB_USER" -p"$DB_PASSWORD" "$DB_NAME" < db/data.sql
docker compose exec -T database mysql -u"$DB_USER" -p"$DB_PASSWORD" "$DB_NAME" < db/data.sql

echo "✅ Database synced successfully!"
echo ""
echo "💡 You can now run: docker compose exec backend yarn typeorm:generate src/migrations/migrationMeaningfulName -p --dr"
echo "💡 You can now run: docker compose exec server yarn typeorm:generate src/migrations/migrationMeaningfulName -p --dr"
Loading
Loading