Skip to content

Commit

Permalink
fikset å se bruker profil via id
Browse files Browse the repository at this point in the history
la til isPublic i databasen, og checkbox på profil siden

prøver å endre /profile til /user/:id

fikset nokon routes men still broke

flyttet til index tilbake profil tilbake

formatering..

parent c33e1f8
author herwal <herwal20@gmail.com> 1726071554 +0200
committer Herwal <herwal20@gmail.com> 1726585905 +0200

parent c33e1f8
author herwal <herwal20@gmail.com> 1726071554 +0200
committer Herwal <herwal20@gmail.com> 1726585885 +0200

parent c33e1f8
author herwal <herwal20@gmail.com> 1726071554 +0200
committer Herwal <herwal20@gmail.com> 1726585864 +0200

parent c33e1f8
author herwal <herwal20@gmail.com> 1726071554 +0200
committer Herwal <herwal20@gmail.com> 1726585838 +0200

parent c33e1f8
author herwal <herwal20@gmail.com> 1726071554 +0200
committer Herwal <herwal20@gmail.com> 1726585621 +0200

forandret etikett for profil siden, neste steg er å kunne gå til ander sine profiler

Lagt til navnet mitt på webkom siden. (#2230)

🔥 Remove boomtown (#2233)

Fix weird images (#2234)

change href for happening tab (#2235)

added name (#2236)

Ekstern link til påmelding + navn i webkom medlemsliste (#2232)

Update dependency jsdom to v25 (#2202)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @tailwindcss/forms to v0.5.9 (#2229)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @testing-library/react to v16.0.1 (#2217)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @sanity/icons to v3.4.0 (#2194)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tsx to v4.19.0 (#2198)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @types/node to v20.16.5 (#2218)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tsx to v4.19.1 (#2242)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

added tidspunkt to csv

Update dependency @types/pg to v8.11.9 (#2237)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @tailwindcss/typography to v0.5.15 (#2216)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update pnpm to v9.10.0 (#2192)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Karo/phd (#2246)

Update dependency @types/react to v18.3.5 (#2238)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency postcss to v8.4.45 (#2240)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency remove-markdown to v0.5.5 (#2241)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tailwindcss to v3.4.11 (#2244)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency eslint-plugin-react to v7.36.1 (#2239)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency framer-motion to v11.5.4 (#2193)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @playwright/test to v1.47.1 (#2248)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Add renovate schedule

Update dependency styled-components to v6.1.13 (#2243)

Update dependency eslint-plugin-jsx-a11y to v6.10.0 (#2251)

Update dependency vite to ^5.4.5 (#2245)

Update dependency eslint-plugin-import to v2.30.0 (#2250)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update robots

🔥 Remove boomtown (#2233)

Fix weird images (#2234)

change href for happening tab (#2235)

added name (#2236)

Ekstern link til påmelding + navn i webkom medlemsliste (#2232)

Update dependency tsx to v4.19.1 (#2242)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

added tidspunkt to csv

Update pnpm to v9.10.0 (#2192)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Karo/phd (#2246)

Update dependency postcss to v8.4.45 (#2240)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency remove-markdown to v0.5.5 (#2241)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tailwindcss to v3.4.11 (#2244)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency framer-motion to v11.5.4 (#2193)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency @playwright/test to v1.47.1 (#2248)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Add renovate schedule

Update dependency styled-components to v6.1.13 (#2243)

Update dependency vite to ^5.4.5 (#2245)

Update dependency eslint-plugin-import to v2.30.0 (#2250)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update robots

Style job ads

Smaller text

Remove image on smaller screen

Reduce max connections

Fix package specifier

Fix external link

Update dependency eslint to v8.57.1 (#2258)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency postcss to v8.4.47 (#2259)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency vite to ^5.4.6 (#2261)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency tailwindcss to v3.4.12 (#2260)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Add dedicated api app (#2255)

Display waitlist position (#2268)

Only show spot when registration is open

Simplify CI (#2269)

Remove kaffe (#2270)

Increase db client count (#2271)

Center div

Fix external link

Fix feedback form

Update dependency @types/react to v18.3.8 (#2257)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Update dependency vitest to v2.1.1 (#2264)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Move docker compose file

Refresh data

Update dependency typescript to v5.6.2 (#2263)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

Remove t3 env (#2272)

Add date endpoint

Remove date endpoint

Remove dead code

Update cache

New backend, who dis?

Add revalidation tags
  • Loading branch information
Herwal committed Sep 27, 2024
1 parent 8a118c2 commit 4f9023f
Show file tree
Hide file tree
Showing 153 changed files with 2,786 additions and 2,259 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
node_modules
.git
.env
logs
.DS_Store
.vscode
.github
.sanity
.turbo
.next
dist
postgres-data
redis-data
7 changes: 4 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ NEXTAUTH_SECRET="foobar"
NEXTAUTH_URL="http://localhost:3000"


# --- Kaffe (can be found in the nano repository)
# The URL of the Kaffe server
#NEXT_PUBLIC_KAFFE_URL="http://localhost:8002"
# --- API
API_PORT=8000
NEXT_PUBLIC_API_URL=http://localhost:8000


# --- echogram (can be found in the nano repository)
#NEXT_PUBLIC_ECHOGRAM_URL="http://localhost:8001"
Expand Down
33 changes: 0 additions & 33 deletions .github/actions/pnpm-install/action.yaml

This file was deleted.

28 changes: 19 additions & 9 deletions .github/workflows/check-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,37 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Checkout main
- name: 🔍 Checkout main branch
uses: actions/checkout@v4
with:
ref: main

- name: Install dependencies
uses: ./.github/actions/pnpm-install
- name: 📦 Setup pnpm
uses: pnpm/action-setup@v4

- name: Apply migrations (main)
- name: 🐢 Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml

- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile

- name: 🏗️ Apply migrations (main)
run: pnpm db:migrate

- name: Checkout PR branch
- name: 🔍 Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Install dependencies
uses: ./.github/actions/pnpm-install
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile

- name: Check migrations (PR Branch)
- name: 🩺 Check migrations (PR Branch)
run: pnpm db:check

- name: Apply migrations (PR Branch)
- name: 🚢 Apply migrations (PR Branch)
run: pnpm db:migrate
50 changes: 36 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ on:
env:
ADMIN_KEY: foobar
DATABASE_URL: postgres://postgres:postgres@localhost:5432/echo-web

API_PORT: 8000
NEXT_PUBLIC_API_URL: http://localhost:8000

NEXT_PUBLIC_SANITY_DATASET: "testing"

FEIDE_CLIENT_ID: ${{ secrets.FEIDE_CLIENT_ID }}
FEIDE_CLIENT_SECRET: ${{ secrets.FEIDE_CLIENT_SECRET }}

NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
NEXTAUTH_URL: http://localhost:3000

TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

Expand All @@ -30,36 +38,50 @@ jobs:
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/pnpm-install
- name: 🔍 Checkout
uses: actions/checkout@v4

- name: 📦 Setup pnpm
uses: pnpm/action-setup@v4

- run: pnpm db:migrate
- name: 🐢 Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml

- name: Lint
- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile

- name: 🏗️ Migrate database
run: pnpm db:migrate

- name: 📝 Lint
run: pnpm lint

- name: Type check
- name: 🛫 Type check
run: pnpm typecheck

- name: Check style
- name: 💄 Check style
run: pnpm format:check

- name: Build
- name: 🌱 Seed database
run: pnpm seed database --mode test

- name: 👷🏻‍♂️ Build
run: pnpm build

- name: Run unit tests
- name: 🧪 Run unit tests
run: pnpm test:unit

- name: Install playwright browsers
- name: 💻 Install playwright browsers
run: pnpm --filter=playwright test:install

- name: Seed database
run: pnpm seed database --mode test

- name: Run playwright tests
- name: 🎭 Run playwright tests
run: pnpm test:e2e

- name: Upload test results
- name: 📥 Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: 🚀 Deploy

on:
push:
branches:
- main

jobs:
api:
runs-on: ubuntu-latest

steps:
- name: 🔍 Checkout
uses: actions/checkout@v4

- name: 📦 Setup pnpm
uses: pnpm/action-setup@v4

- name: 🐢 Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml

- name: 📦 Install dependencies
run: pnpm install --frozen-lockfile

- name: 🪰 Setup Fly
uses: superfly/flyctl-actions/setup-flyctl@master

- name: 🚀 Deploy
run: flyctl deploy --config apps/api/fly.toml --dockerfile apps/api/Dockerfile --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Sidene som starter er:

- [http://localhost:3000](http://localhost:3000) for nettsiden
- [http://localhost:3333](http://localhost:3333) for Sanity Studio
- [http://localhost:8000](http://localhost:8000) for API-et våres
- [https://local.drizzle.studio](https://local.drizzle.studio) for Drizzle Studio

NB: "Backenden" til Drizzle vil kjøre på [http://localhost:4983](http://localhost:4983).
Expand Down
36 changes: 36 additions & 0 deletions apps/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM node:20-alpine AS base

RUN npm install -g turbo@2.0.14
RUN npm install -g pnpm@9.7.1

FROM base AS builder

RUN apk update
RUN apk add --no-cache libc6-compat

WORKDIR /app
COPY . .
RUN turbo prune @echo-webkom/api --docker

FROM base AS installer
RUN apk update
RUN apk add --no-cache libc6-compat
WORKDIR /app

COPY --from=builder /app/out/json/ .
RUN pnpm install

COPY --from=builder /app/out/full/ .

RUN pnpm turbo build --filter=@echo-webkom/api...

FROM base AS runner
WORKDIR /app

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 hono
USER hono

COPY --from=installer /app/apps/api/dist ./dist

CMD node ./dist/index.js
17 changes: 17 additions & 0 deletions apps/api/fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
app = "fly-echo-api"
primary_region = "arn"

[build]

[http_service]
internal_port = 8000
force_https = true
auto_stop_machines = "stop"
auto_start_machines = true
min_machines_running = 1
processes = ["app"]

[[vm]]
size = "shared-cpu-2x"
memory = "1gb"
cpus = 1
33 changes: 33 additions & 0 deletions apps/api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "@echo-webkom/api",
"version": "1.0.0",
"scripts": {
"build": "pnpm with-env esbuild ./src/index.ts --bundle --platform=node --outfile=dist/index.js",
"dev": "pnpm with-env tsx watch ./src/index.ts",
"start": "pnpm with-env node ./dist/index.js",
"typecheck": "pnpm with-env tsc --noEmit",
"clean": "rm -rf dist .turbo node_modules",
"with-env": "dotenv -e ../../.env --"
},
"dependencies": {
"@echo-webkom/auth": "workspace:*",
"@echo-webkom/db": "workspace:*",
"@echo-webkom/email": "workspace:*",
"@echo-webkom/lib": "workspace:*",
"@echo-webkom/sanity": "workspace:*",
"@hono/node-server": "1.13.0",
"date-fns": "3.6.0",
"drizzle-orm": "0.33.0",
"hono": "4.6.2",
"zod": "3.23.8"
},
"devDependencies": {
"@echo-webkom/tsconfig": "workspace:*",
"@types/node": "20.16.5",
"dotenv-cli": "7.4.2",
"esbuild": "0.23.1",
"tsx": "4.19.1",
"typescript": "5.6.2",
"vitest": "2.1.1"
}
}
31 changes: 31 additions & 0 deletions apps/api/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Hono } from "hono";
import { cors } from "hono/cors";
import { logger } from "hono/logger";

import adminApp from "./services/admin";
import degreesApp from "./services/degrees";
import feedbackApp from "./services/feedback";
import happeningApp from "./services/happening";
import healthApp from "./services/health";
import shoppingApp from "./services/shopping-list";

const app = new Hono();

app.use(logger());
app.use(
cors({
origin: ["http://localhost:3000", "https://echo.uib.no"],
allowHeaders: ["Content-Type", "Authorization"],
allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
credentials: true,
}),
);

app.route("/", healthApp);
app.route("/", adminApp);
app.route("/", happeningApp);
app.route("/", feedbackApp);
app.route("/", shoppingApp);
app.route("/", degreesApp);

export default app;
18 changes: 18 additions & 0 deletions apps/api/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { serve } from "@hono/node-server";

import app from "./app";

const isCI = !!process.env.CI;
const HOSTNAME = isCI ? "localhost" : "0.0.0.0";
const PORT = process.env.API_PORT ? Number(process.env.API_PORT) : 8000;

serve(
{
fetch: app.fetch,
port: PORT,
hostname: HOSTNAME,
},
(info) => {
console.log(`Listening on http://${HOSTNAME}:${info.port}`);
},
);
4 changes: 4 additions & 0 deletions apps/api/src/lib/db.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { createDatabase, createPool } from "@echo-webkom/db/create";

const pool = createPool();
export const db = createDatabase(pool);
Loading

0 comments on commit 4f9023f

Please sign in to comment.