fix: TS errors + Docker Compose running locally
- Removed unused imports (PublicRoute, GripVertical, addFromRecipe, X, ShoppingGroup) - Fixed HouseholdCard unused var - Fixed ShoppingPage household query (missing queryFn) - Killed tmux sessions, app runs fully on Docker now - 3 containers: db (postgres:17), backend (node:22), frontend (nginx)
This commit is contained in:
@@ -1,18 +1,12 @@
|
|||||||
FROM node:22-alpine AS base
|
FROM node:22-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci --omit=dev
|
RUN npm ci
|
||||||
|
|
||||||
# Copy source
|
|
||||||
COPY src/ src/
|
COPY src/ src/
|
||||||
COPY .env* ./
|
|
||||||
COPY tsconfig.json ./
|
COPY tsconfig.json ./
|
||||||
|
|
||||||
# Install tsx for running TypeScript
|
|
||||||
RUN npm install -g tsx
|
|
||||||
|
|
||||||
EXPOSE 6001
|
EXPOSE 6001
|
||||||
|
|
||||||
CMD ["tsx", "src/index.ts"]
|
CMD ["npx", "tsx", "src/index.ts"]
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
version: '3.8'
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: postgres:17-alpine
|
image: postgres:17-alpine
|
||||||
@@ -10,6 +8,8 @@ services:
|
|||||||
POSTGRES_PASSWORD: ${DB_PASSWORD:-luna-recipes-secret-2026}
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-luna-recipes-secret-2026}
|
||||||
volumes:
|
volumes:
|
||||||
- pgdata:/var/lib/postgresql/data
|
- pgdata:/var/lib/postgresql/data
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:5433:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U luna -d luna_recipes"]
|
test: ["CMD-SHELL", "pg_isready -U luna -d luna_recipes"]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
@@ -30,7 +30,7 @@ services:
|
|||||||
PORT: "6001"
|
PORT: "6001"
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
ports:
|
ports:
|
||||||
- "127.0.0.1:6001:6001"
|
- "6001:6001"
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
build: ./frontend
|
build: ./frontend
|
||||||
@@ -38,7 +38,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "6100:80"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
pgdata:
|
pgdata:
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { BrowserRouter, Routes, Route } from 'react-router'
|
import { BrowserRouter, Routes, Route } from 'react-router'
|
||||||
import { AppShell } from './components/layout/AppShell'
|
import { AppShell } from './components/layout/AppShell'
|
||||||
import { AuthProvider } from './context/AuthContext'
|
import { AuthProvider } from './context/AuthContext'
|
||||||
import { PublicRoute } from './components/auth/AuthGuard'
|
|
||||||
import { HomePage } from './pages/HomePage'
|
import { HomePage } from './pages/HomePage'
|
||||||
import { RecipePage } from './pages/RecipePage'
|
import { RecipePage } from './pages/RecipePage'
|
||||||
import { SearchPage } from './pages/SearchPage'
|
import { SearchPage } from './pages/SearchPage'
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ export function HouseholdCard() {
|
|||||||
|
|
||||||
const regenMut = useMutation({
|
const regenMut = useMutation({
|
||||||
mutationFn: () => regenerateInviteCode(household!.id),
|
mutationFn: () => regenerateInviteCode(household!.id),
|
||||||
onSuccess: (res) => {
|
onSuccess: () => {
|
||||||
qc.invalidateQueries({ queryKey: ['household'] })
|
qc.invalidateQueries({ queryKey: ['household'] })
|
||||||
showToast.success('Neuer Code generiert')
|
showToast.success('Neuer Code generiert')
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import { createContext, useContext, useState, useEffect, type ReactNode } from 'react'
|
import { createContext, useContext, useState, useEffect, type ReactNode } from 'react'
|
||||||
import {
|
import {
|
||||||
type User,
|
type User,
|
||||||
getMe,
|
|
||||||
refreshToken,
|
refreshToken,
|
||||||
logout as apiLogout
|
logout as apiLogout
|
||||||
} from '../api/auth'
|
} from '../api/auth'
|
||||||
import { setAuthToken, getAuthToken } from '../api/token'
|
import { setAuthToken } from '../api/token'
|
||||||
|
|
||||||
interface AuthContextType {
|
interface AuthContextType {
|
||||||
user: User | null
|
user: User | null
|
||||||
|
|||||||
@@ -2,12 +2,11 @@ import { useState, useEffect, useRef } from 'react'
|
|||||||
import { useParams, useNavigate } from 'react-router'
|
import { useParams, useNavigate } from 'react-router'
|
||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import { ArrowLeft, Plus, Trash2, Camera, X, GripVertical, Link, Loader2 } from 'lucide-react'
|
import { ArrowLeft, Plus, Trash2, Camera, X, Link, Loader2 } from 'lucide-react'
|
||||||
import { fetchRecipe, createRecipe, updateRecipe, deleteRecipe, uploadRecipeImage, fetchOgPreview } from '../api/recipes'
|
import { fetchRecipe, createRecipe, updateRecipe, deleteRecipe, uploadRecipeImage, fetchOgPreview } from '../api/recipes'
|
||||||
import { fetchCategories } from '../api/categories'
|
import { fetchCategories } from '../api/categories'
|
||||||
import { Confetti } from '../components/ui/Confetti'
|
import { Confetti } from '../components/ui/Confetti'
|
||||||
import type { RecipeFormData } from '../api/recipes'
|
import type { RecipeFormData } from '../api/recipes'
|
||||||
import type { Ingredient, Step } from '../api/types'
|
|
||||||
|
|
||||||
interface IngredientRow {
|
interface IngredientRow {
|
||||||
key: string
|
key: string
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import toast from 'react-hot-toast'
|
|||||||
import { ArrowLeft, Heart, Clock, Users, ChefHat, ShoppingCart, Pencil, Minus, Plus, Send, Trash2 } from 'lucide-react'
|
import { ArrowLeft, Heart, Clock, Users, ChefHat, ShoppingCart, Pencil, Minus, Plus, Send, Trash2 } from 'lucide-react'
|
||||||
import { Dices } from 'lucide-react'
|
import { Dices } from 'lucide-react'
|
||||||
import { fetchRecipe, toggleFavorite, fetchRandomRecipe } from '../api/recipes'
|
import { fetchRecipe, toggleFavorite, fetchRandomRecipe } from '../api/recipes'
|
||||||
import { addFromRecipe, addCustomItem } from '../api/shopping'
|
import { addCustomItem } from '../api/shopping'
|
||||||
import { IngredientPickerModal } from '../components/recipe/IngredientPickerModal'
|
import { IngredientPickerModal } from '../components/recipe/IngredientPickerModal'
|
||||||
import { createNote, deleteNote } from '../api/notes'
|
import { createNote, deleteNote } from '../api/notes'
|
||||||
import { Badge } from '../components/ui/Badge'
|
import { Badge } from '../components/ui/Badge'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useRef } from 'react'
|
import { useState, useRef } from 'react'
|
||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
|
||||||
import { Trash2, Plus, X } from 'lucide-react'
|
import { Trash2, Plus } from 'lucide-react'
|
||||||
import {
|
import {
|
||||||
fetchShopping,
|
fetchShopping,
|
||||||
addCustomItem,
|
addCustomItem,
|
||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
deleteChecked,
|
deleteChecked,
|
||||||
deleteAll,
|
deleteAll,
|
||||||
} from '../api/shopping'
|
} from '../api/shopping'
|
||||||
import type { ShoppingGroup, ShoppingItem } from '../api/shopping'
|
import type { ShoppingItem } from '../api/shopping'
|
||||||
import { useAuth } from '../context/AuthContext'
|
import { useAuth } from '../context/AuthContext'
|
||||||
import { EmptyState } from '../components/ui/EmptyState'
|
import { EmptyState } from '../components/ui/EmptyState'
|
||||||
|
|
||||||
@@ -23,10 +23,19 @@ export function ShoppingPage() {
|
|||||||
// Check if user has a household
|
// Check if user has a household
|
||||||
const { data: householdData } = useQuery({
|
const { data: householdData } = useQuery({
|
||||||
queryKey: ['household'],
|
queryKey: ['household'],
|
||||||
|
queryFn: async () => {
|
||||||
|
const { getMyHousehold } = await import('../api/households')
|
||||||
|
try {
|
||||||
|
const res = await getMyHousehold()
|
||||||
|
return res.data
|
||||||
|
} catch {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
},
|
||||||
enabled: isAuthenticated,
|
enabled: isAuthenticated,
|
||||||
retry: false,
|
retry: false,
|
||||||
})
|
})
|
||||||
const hasHousehold = !!householdData?.data
|
const hasHousehold = !!householdData
|
||||||
|
|
||||||
const activeScope = hasHousehold ? scope : undefined
|
const activeScope = hasHousehold ? scope : undefined
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user