docs: uppdatera README/TEKNISK_BESKRIVNING och lagg till NEXT_STEPS
This commit is contained in:
+35
-6
@@ -1,6 +1,7 @@
|
||||
# Teknisk beskrivning av Recipe App
|
||||
|
||||
> Se [README.md](README.md) för användarinformation och kom-igång-guide.
|
||||
> Se [README.md](README.md) för användarinformation och kom-igång-guide.
|
||||
> Se [NEXT_STEPS.md](NEXT_STEPS.md) för förslag på nästa steg i projektet.
|
||||
|
||||
## Översikt
|
||||
|
||||
@@ -67,9 +68,13 @@ Recipe App är en fullstack-applikation för hantering av hemmavaror, recept och
|
||||
| **Recipe detail** | `app/recipes/[id]/` | Enskilt recept (detaljer, redigering) |
|
||||
| **Admin: Produkter** | `app/admin/products/page.tsx` | Produktadmin-panel |
|
||||
| | `AdminProductList.tsx` | Lista produkter, sök, sortera |
|
||||
| | `NameForm.tsx` | Redigera produktnamn |
|
||||
| | `CanonicalNameForm.tsx` | Redigera canonical name |
|
||||
| | `EditProductForm.tsx` | Inline redigering av name, canonicalName, category + soft-delete |
|
||||
| | `MergePreviewForm.tsx` | Förhandsgranska merge |
|
||||
| | `actions.ts` | Server actions: updateProduct, deleteProduct |
|
||||
| **Baslager** | `app/baslager/page.tsx` | Visa och hantera baslager (server component) |
|
||||
| | `AddToPantryForm.tsx` | Lägg till produkt i baslager (dropdown) |
|
||||
| | `PantryList.tsx` | Visa baslager grupperat per kategori |
|
||||
| | `actions.ts` | Server actions: addPantryItem, removePantryItem |
|
||||
|
||||
### API-proxy routes (Next.js)
|
||||
|
||||
@@ -81,6 +86,7 @@ Recipe App är en fullstack-applikation för hantering av hemmavaror, recept och
|
||||
| `/api/recipe-preview-proxy` | GET | Proxies receptförhandsvisning |
|
||||
| `/api/admin/merge-preview-proxy` | GET | Proxies produktmerge-preview |
|
||||
| `/api/products` | GET | Lista/proxies produkter |
|
||||
| `/api/recipes` | GET, POST | Lista recept + spara nytt recept (proxy till backend) |
|
||||
|
||||
### Frontend utbyggbarhet
|
||||
|
||||
@@ -150,8 +156,12 @@ backend/src/
|
||||
└── dto/
|
||||
├── create-recipe.dto.ts
|
||||
├── parse-markdown.dto.ts
|
||||
└── create-recipe-ingredient.dto.ts
|
||||
```
|
||||
└── create-recipe-ingredient.dto.ts└── pantry/
|
||||
├── pantry.controller.ts # GET/POST/DELETE /api/pantry
|
||||
├── pantry.service.ts # Baslagerlogik
|
||||
├── pantry.module.ts
|
||||
└── dto/
|
||||
└── create-pantry-item.dto.ts```
|
||||
|
||||
### Backend-funktioner
|
||||
|
||||
@@ -258,7 +268,7 @@ GET /api/recipes/:id/inventory-preview Jämför recept mot inventarie
|
||||
GET /api/products Lista alla aktiva produkter
|
||||
POST /api/products Skapa ny produkt
|
||||
GET /api/products/:id Hämta specifik produkt
|
||||
PATCH /api/products/:id Uppdatera produktens namn
|
||||
PATCH /api/products/:id Uppdatera produktens namn, canonicalName eller kategori
|
||||
DELETE /api/products/:id Soft-delete produkt
|
||||
POST /api/products/:id/restore Återställ raderad produkt
|
||||
|
||||
@@ -270,6 +280,13 @@ PATCH /api/products/:id/canonical-name Uppdatera canonical name
|
||||
POST /api/products/backfill-canonical Backfill canonical names (admin)
|
||||
```
|
||||
|
||||
### 🛀 Baslager-endpoints
|
||||
```
|
||||
GET /api/pantry Lista alla baslagerartiklar (inkl. produktinfo)
|
||||
POST /api/pantry Lägg till produkt i baslagret
|
||||
DELETE /api/pantry/:id Ta bort produkt från baslagret
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Datamodell (Prisma ORM)
|
||||
@@ -366,6 +383,18 @@ model RecipeIngredient {
|
||||
}
|
||||
```
|
||||
|
||||
### PantryItem
|
||||
```prisma
|
||||
model PantryItem {
|
||||
id Int @id @default(autoincrement())
|
||||
productId Int @unique # En produkt kan bara finnas en gång i baslagret
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
product Product @relation(fields: [productId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Receptimport och receptskaping — Detaljerad arkitektur
|
||||
|
||||
Reference in New Issue
Block a user