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
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dist
coverage
playwright-report
test-results
uploads

# Git
.git
Expand All @@ -27,4 +28,4 @@ test-results

# Logs
*.log
npm-debug.log*
npm-debug.log*
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ API_HOST=127.0.0.1
API_PORT=3001
# Enable only for the documented local Apache proxy on the VM.
AUTH_TRUST_PROXY=false
# false for localhost/current HTTP VM; true when HTTPS is configured.
AUTH_COOKIE_SECURE=false
# Optional absolute directory for persisted recipe images (default: uploads/ at project root).
# UPLOAD_DIR=/var/lib/recipe-platform/uploads
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ on:
jobs:
quality:
runs-on: [self-hosted, linux, x64, t31-project2-ci]
env:
DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }}
steps:
- uses: actions/checkout@v4
- name: Require test database connection
run: |
if [ -z "$DATABASE_URL" ]; then
echo "::error::Set the TEST_DATABASE_URL Actions secret to a dedicated PostgreSQL test database accessible from this runner."
exit 1
fi
- uses: actions/setup-node@v4
with: { node-version-file: .node-version, cache: npm }
- run: npm ci
Expand All @@ -17,6 +25,10 @@ jobs:
run: npm run db:check
- name: Lint, typecheck, test and build
run: npm run check
- name: Test database constraints and migrations
run: npm run test:db
- name: Test recipe API and image storage
run: npm run test:api
- run: npx playwright install chromium
- run: npm run test:e2e
- name: Save tested release
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ coverage/
playwright-report/
test-results/
*.tsbuildinfo
uploads/
137 changes: 49 additions & 88 deletions README.md

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions apps/api/migrations/0004_uploaded_images.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE "project2"."uploaded_images" (
"filename" text PRIMARY KEY NOT NULL,
"owner_id" uuid,
"byte_size" integer NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "uploaded_images_size_valid" CHECK ("project2"."uploaded_images"."byte_size" >= 0)
);
--> statement-breakpoint
ALTER TABLE "project2"."uploaded_images" ADD CONSTRAINT "uploaded_images_owner_id_users_id_fk" FOREIGN KEY ("owner_id") REFERENCES "project2"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "uploaded_images_owner_idx" ON "project2"."uploaded_images" USING btree ("owner_id");
--> statement-breakpoint
INSERT INTO "project2"."uploaded_images" (filename, owner_id, byte_size, created_at)
SELECT DISTINCT ON (image_url) substring(image_url from 10), author_id, 0, created_at
FROM "project2"."recipes"
WHERE image_url ~ '^/uploads/[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}\.(jpg|png|webp)$'
ORDER BY image_url, created_at
ON CONFLICT DO NOTHING;
Loading