Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
cab4607
chore: add plan for database
wiktoriavh Oct 30, 2025
a5bc3d8
feat: introduce prisma
wiktoriavh Nov 1, 2025
1478532
Merge branch 'main' into feat/add-database
wiktoriavh Nov 1, 2025
c67daa1
docs: implement SQLite database with Prisma for moderation actions tr…
wiktoriavh Nov 1, 2025
e3ce6a0
feat: add moderation tables and update schema for user actions tracking
wiktoriavh Nov 1, 2025
f9fd99b
feat: implement database connection and graceful shutdown in bot
wiktoriavh Nov 1, 2025
bea8234
feat: add analytics and operations modules for user and moderation ac…
wiktoriavh Nov 1, 2025
3eb2a0e
test: add comprehensive database tests
wiktoriavh Nov 1, 2025
c74920f
refactor: improve variable naming for clarity in analytics and databa…
wiktoriavh Nov 1, 2025
c6fb8e2
test: enhance database action counting tests to verify accurate total…
wiktoriavh Nov 1, 2025
304fabc
refactor: update Prisma schema to introduce new roles and action type…
wiktoriavh Nov 9, 2025
32c1a36
feat: add User and Action models to Prisma schema, replacing Moderati…
wiktoriavh Nov 9, 2025
6effde8
chore: remove unused analytics and operations modules along with asso…
wiktoriavh Nov 9, 2025
d228f8c
fix: correct spelling of 'DISRESPECTFUL' in ActionReason enum in Pris…
wiktoriavh Nov 9, 2025
ed3e997
chore: remove outdated database implementation plan and related files
wiktoriavh Nov 9, 2025
fa1e555
chore: update docker-compose and Dockerfile to use named volumes and …
wiktoriavh Nov 9, 2025
f9a3861
chore: update datasource URL in Prisma configuration to point to mode…
wiktoriavh Nov 9, 2025
12cacc9
chore: remove unused script.ts file and related database connection l…
wiktoriavh Nov 9, 2025
b6f5e46
Update prisma/schema.prisma
wiktoriavh Nov 9, 2025
d4ec192
chore: add new Prisma scripts for database migration, validation, and…
wiktoriavh Nov 21, 2025
07db577
chore: upgrade Prisma dependencies to version 7.0.0 and update relate…
wiktoriavh Nov 21, 2025
1a2faee
chore: update Prisma schema to add VOICE_MODERATOR role, rename DISRE…
wiktoriavh Nov 21, 2025
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,5 @@ tmp/
.env.production.local

# esbuild metafile
meta.json
meta.json
/generated/prisma
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ FROM deps-dev AS build

COPY . .

# Generate Prisma client
RUN npx prisma generate

RUN pnpm run build:ci

# Production stage - Minimal runtime image
Expand All @@ -39,7 +42,10 @@ COPY --from=deps /app/node_modules ./node_modules

# Copy built application
COPY --from=build /app/dist ./dist
COPY --from=build /app/generated ./generated
COPY --from=build /app/prisma ./prisma
COPY package.json ./
COPY prisma.config.ts ./

# Create data directory and set permissions for node user
RUN mkdir -p /app/data && chown -R node:node /app/data
Expand All @@ -56,6 +62,9 @@ ENV NODE_ENV=development

COPY . .

# Generate Prisma client
RUN npx prisma generate

# Create data directory and set permissions for node user
RUN mkdir -p /app/data && chown -R node:node /app/data

Expand Down
27 changes: 24 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ services:
environment:
- NODE_ENV=production
volumes:
- ./logs:/app/logs
- ./data:/app/data
- prod_logs:/app/logs
- prod_data:/app/data # Named volume - persists outside repo

discord-bot-dev:
build:
Expand All @@ -34,4 +34,25 @@ services:
- ./logs:/app/logs
- ./data:/app/data
ports:
- "9229:9229" # For debugging
- "9229:9229" # For debugging

# Run database migrations manually when ready
migrate:
build:
context: .
dockerfile: Dockerfile
target: production
container_name: moderation-tool-migrate
profiles: ["tools"]
env_file:
- .env.local
volumes:
- prod_data:/app/data # Use same named volume as production
command: npx prisma migrate deploy

# Named volumes - persist outside the repo directory
volumes:
prod_data:
name: discord-moderation-data
prod_logs:
name: discord-moderation-logs
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,26 @@
"format": "biome format --write .",
"check": "biome check .",
"check:fix": "biome check --write .",
"db:migrate": "prisma migrate dev",
"db:validate": "prisma validate",
"db:format": "prisma format",
"prepare": "husky",
"pre-commit": "lint-staged",
"typecheck": "tsc --noEmit"
},
"license": "MIT",
"packageManager": "[email protected]",
"dependencies": {
"@prisma/adapter-better-sqlite3": "^7.0.0",
"@prisma/client": "^7.0.0",
"discord.js": "^14.22.1"
},
"devDependencies": {
"@biomejs/biome": "^2.2.4",
"@types/node": "^24.5.2",
"husky": "^9.1.7",
"lint-staged": "^16.2.1",
"prisma": "^7.0.0",
"tsx": "^4.20.6",
"typescript": "^5.9.2"
},
Expand Down
Loading