Skip to content

Commit d49051d

Browse files
committed
Legger til submissions
1 parent 578d108 commit d49051d

31 files changed

Lines changed: 1384 additions & 106 deletions

File tree

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ WORKDIR /app
33
COPY package*.json ./
44
RUN npm ci
55
EXPOSE 5175
6-
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "5175"]
6+
CMD ["sh", "-c", "npx drizzle-kit migrate && npm run dev -- --host 0.0.0.0 --port 5175"]

docker-compose.prod.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,27 @@ services:
1414
timeout: 5s
1515
retries: 5
1616

17+
nginx:
18+
image: nginx:alpine
19+
restart: unless-stopped
20+
ports:
21+
- "80:80"
22+
- "443:443"
23+
volumes:
24+
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
25+
- ${SSL_CERT_DIR:-./ssl}:/etc/nginx/ssl:ro
26+
depends_on:
27+
- app
28+
1729
app:
1830
image: ghcr.io/javabin/javabinkids:${JZ_KIDS_VERSION:-latest}
1931
restart: unless-stopped
20-
ports:
21-
- "${APP_PORT:-3000}:3000"
32+
expose:
33+
- "3000"
2234
environment:
2335
DATABASE_URL: postgres://${DB_USER:-javabin}:${DB_PASSWORD}@db:5432/${DB_NAME:-javabinkids}
24-
RESEND_API_KEY: ${RESEND_API_KEY}
25-
BASE_URL: ${BASE_URL}
36+
SENDGRID_API_KEY: ${SENDGRID_API_KEY}
37+
BASE_URL: ${BASE_URL:-https://jzkids.skaperiet.no}
2638
NODE_ENV: production
2739
depends_on:
2840
db:

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ services:
2828
- /app/node_modules
2929
environment:
3030
DATABASE_URL: postgres://javabin:javabin@db:5432/javabinkids
31-
RESEND_API_KEY: ${RESEND_API_KEY:-re_your_api_key}
31+
SENDGRID_API_KEY: ${SENDGRID_API_KEY:-SG.your_api_key}
3232
ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
3333
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-changeme}
3434
BASE_URL: http://localhost:5175
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
CREATE TABLE IF NOT EXISTS "submissions" (
2+
"submissionId" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3+
"arrangementId" uuid NOT NULL,
4+
"status" text DEFAULT 'submitted' NOT NULL,
5+
"title" text NOT NULL,
6+
"description" text NOT NULL,
7+
"equipmentRequirements" text,
8+
"ageMin" integer NOT NULL,
9+
"ageMax" integer NOT NULL,
10+
"maxParticipants" integer NOT NULL,
11+
"speakerName" text NOT NULL,
12+
"speakerEmail" text NOT NULL,
13+
"speakerBio" text NOT NULL,
14+
"editToken" uuid DEFAULT gen_random_uuid() NOT NULL,
15+
"createdAt" timestamp DEFAULT now() NOT NULL,
16+
"updatedAt" timestamp DEFAULT now() NOT NULL
17+
);
18+
19+
ALTER TABLE "submissions" ADD CONSTRAINT "submissions_arrangementId_events_arrangementId_fk" FOREIGN KEY ("arrangementId") REFERENCES "events"("arrangementId") ON DELETE restrict ON UPDATE no action;
20+
21+
ALTER TABLE "events" ADD COLUMN "openForSubmissions" boolean DEFAULT false NOT NULL;
22+
ALTER TABLE "events" ADD COLUMN "submissionDeadline" timestamp;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"id": "0005_add_submissions",
3+
"prevId": "0004_add_images_and_consent",
4+
"version": "7",
5+
"dialect": "postgresql",
6+
"tables": {},
7+
"enums": {},
8+
"schemas": {},
9+
"sequences": {},
10+
"_meta": {
11+
"schemas": {},
12+
"tables": {},
13+
"columns": {}
14+
}
15+
}

drizzle/migrations/meta/_journal.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@
3636
"when": 1773900060000,
3737
"tag": "0004_add_images_and_consent",
3838
"breakpoints": true
39+
},
40+
{
41+
"idx": 5,
42+
"version": "7",
43+
"when": 1774258800000,
44+
"tag": "0005_add_submissions",
45+
"breakpoints": true
3946
}
4047
]
4148
}

nginx.conf

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
server {
2+
listen 80;
3+
server_name jzkids.skaperiet.no;
4+
return 301 https://$server_name$request_uri;
5+
}
6+
7+
server {
8+
listen 443 ssl;
9+
server_name jzkids.skaperiet.no;
10+
11+
ssl_certificate /etc/nginx/ssl/STAR_skaperiet_no_chain.crt;
12+
ssl_certificate_key /etc/nginx/ssl/skaperiet_no.key;
13+
14+
client_max_body_size 20M;
15+
16+
location / {
17+
proxy_set_header Host $host;
18+
proxy_set_header X-Real-IP $remote_addr;
19+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
20+
proxy_set_header X-Forwarded-Proto $scheme;
21+
22+
proxy_pass http://app:3000;
23+
}
24+
}

0 commit comments

Comments
 (0)