Skip to content

Commit 5ed3c11

Browse files
committed
fix
1 parent 975608c commit 5ed3c11

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

CLAUDE.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ tests/
7979
- **images** — photo_id → full_webp BLOB + preview_webp BLOB
8080
- Created with `PRAGMA page_size = 65536` for optimal BLOB streaming
8181

82+
### thumbnails/ (Static project thumbnails)
83+
- `{slug}.webp` — One thumbnail per project, served via `/api/v1/thumbnails/{slug}.webp`
84+
- Used by the catalog in ebgeo_web to display project preview images
85+
8286
### SQLite Optimizations
8387
- WAL mode on all connections
8488
- 64 MB cache for index.db, 32 MB per project DB
@@ -99,8 +103,9 @@ tests/
99103
| Endpoint | Description | Cache |
100104
|----------|-------------|-------|
101105
| `/health` | Service status + project count | None |
102-
| `/api/v1/projects` | List all projects | 1h |
106+
| `/api/v1/projects` | List all projects (includes `previewThumbnail` URL) | 1h |
103107
| `/api/v1/projects/:slug` | Single project details | 1h |
108+
| `/api/v1/thumbnails/:slug.webp` | Static project thumbnail image (WebP) | Static |
104109
| `/api/v1/photos/:uuid` | Photo metadata + targets (hidden targets filtered unless `?include_hidden=true`) | no-cache (revalidate) |
105110
| `/api/v1/photos/:uuid/image?quality=full\|preview` | WebP image stream | 1yr immutable + ETag |
106111
| `/api/v1/photos/by-name/:originalName` | Backward compat lookup | 1h |
@@ -158,7 +163,7 @@ Environment variables (with defaults):
158163
|----------|---------|-------------|
159164
| `PORT` | 8081 | HTTP server port |
160165
| `HOST` | 0.0.0.0 | Bind address |
161-
| `STREETVIEW_DATA_DIR` | ./data | Root data dir (index.db + projects/) |
166+
| `STREETVIEW_DATA_DIR` | ./data | Root data dir (index.db + projects/ + thumbnails/) |
162167
| `LOG_LEVEL` | info | Fastify logger level |
163168
| `CORS_ORIGIN` | * | CORS allowed origins |
164169

@@ -171,6 +176,7 @@ The parent app (`../ebgeo_web`) integrates via REST API calls:
171176
- **`src/js/store/streetview360.operations.js`** — CRUD for orientations/markers
172177
- **`src/js/features_tab/streetview360-section.component.js`** — Feature list section
173178
- **`src/js/street_view_tool/streetview_markers.js`** — Clustered map markers (PMTiles)
179+
- **`src/js/catalog/catalog.service.js`** — Catalog aggregation (builds absolute thumbnail URLs from `serviceUrl` + `previewThumbnail`)
174180

175181
Events: `STREETVIEW_360_OPENED`, `STREETVIEW_360_CLOSED`, `STREETVIEW_360_PHOTO_CHANGED`, `ORIENTATION_360_SAVED`, `ORIENTATION_360_CLEARED`, `MARKER_360_CLICKED`, `MARKERS_360_CHANGED`
176182

@@ -329,9 +335,4 @@ docker-compose up -d
329335

330336
# Local development
331337
npm run dev
332-
```
333-
334-
## Projects
335-
336-
15 military sites in southern Brazil:
337-
Alegrete, Parque Osorio, Uruguaiana, 3o RCMec, CIST, 27o GAC, CI Guarnicao Ijui, EASA, 29o GACap, CI Cruz Alta, SantAna do Livramento, Tubarao, Blumenau, CI General Calazans, Ponta Grossa
338+
```

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ COPY src/ ./src/
1212
COPY scripts/ ./scripts/
1313
COPY public/ ./public/
1414

15-
RUN mkdir -p /data/projects /data/thumbnails/projects
15+
RUN mkdir -p /data/projects /data/thumbnails
1616

1717
ENV NODE_ENV=production
1818
ENV PORT=8081

EXPANDING.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ Fotos 360 (JPG) + Metadados (JSON)
1414
1. Registrar novo projeto em migrate.js
1515
2. Executar migracao (JSON+JPG -> SQLite)
1616
3. Gerar PMTiles para marcadores no mapa
17-
4. Verificar e testar
18-
5. Deploy
17+
4. Adicionar thumbnail do projeto
18+
5. Verificar e testar
19+
6. Deploy
1920
```
2021

2122
## Pre-requisitos
@@ -174,7 +175,22 @@ Isso cria `fotos.pmtiles` contendo um ponto para cada foto com:
174175

175176
Requisito: [tippecanoe](https://github.com/felt/tippecanoe) deve estar instalado.
176177

177-
## Passo 5: Verificar
178+
## Passo 5: Adicionar Thumbnail
179+
180+
Crie uma imagem de thumbnail para o novo projeto no diretorio de thumbnails:
181+
182+
```
183+
{STREETVIEW_DATA_DIR}/thumbnails/{slug}.webp
184+
```
185+
186+
- Formato: WebP
187+
- Nome do arquivo: deve corresponder ao slug do projeto (ex: `nome_do_local.webp`)
188+
- A imagem sera servida na API em `GET /api/v1/thumbnails/{slug}.webp`
189+
- Usada pelo catalogo do EBGeo Web como preview do projeto
190+
191+
No Docker, o diretorio e `/data/thumbnails/`. Localmente, depende do `.env` (`STREETVIEW_DATA_DIR`).
192+
193+
## Passo 6: Verificar
178194

179195
### Verificacao manual
180196

@@ -194,6 +210,13 @@ No retorno de `/api/v1/projects/nome_do_local`, verifique:
194210
- `photoCount` — Numero esperado de fotos
195211
- `entryPhotoId` — UUID valido
196212
- `center` — Coordenadas corretas
213+
- `previewThumbnail` — Path do thumbnail (ex: `/thumbnails/nome_do_local.webp`)
214+
215+
### Testar thumbnail
216+
217+
```bash
218+
curl -o test_thumb.webp "http://localhost:8081/api/v1/thumbnails/nome_do_local.webp"
219+
```
197220

198221
### Testar foto de entrada
199222

0 commit comments

Comments
 (0)