V3 S7 : preview cloud + export chiffré + release 1.2.0
Release / release-apk (push) Successful in 8m58s
Release / release-docker (push) Successful in 3m47s
CI / docker (push) Successful in 7s
CI / lint-backend (push) Successful in 1m44s
CI / lint-mobile (push) Failing after 18m59s
CI / test-backend (push) Successful in 2m12s
CI / test-mobile (push) Successful in 8m50s
CI / build-backend (push) Successful in 45s
Release / release-apk (push) Successful in 8m58s
Release / release-docker (push) Successful in 3m47s
CI / docker (push) Successful in 7s
CI / lint-backend (push) Successful in 1m44s
CI / lint-mobile (push) Failing after 18m59s
CI / test-backend (push) Successful in 2m12s
CI / test-mobile (push) Successful in 8m50s
CI / build-backend (push) Successful in 45s
Backend : resource_previews (000024), GET /files/:id/preview (JPEG
512, images pur Go, PDF page 1 via pdftoppm + poppler au Dockerfile,
cache régénéré sur changement, 404 NO_PREVIEW sinon), POST /export
{password 8+} -> zip AES-256 streamé (fichiers vifs possédés +
manifest.json avec faits, metadata-only sans octets). Deps :
alexmullins/zip, x/image directs. Tests service + handlers + migrations.
Mobile : vignettes distantes (une requête/session puis cache WebP
versionné, garde tried, icône sinon), FileThumbnail cloud-only,
export (mot de passe jamais persisté, cache + partage FileProvider),
bouton Partager ACTION_SEND. Impression papier reportée V4. FR/EN.
Contrat docs/api-v1.md, V3.md (S7 livré, V3 close), AGENTS.md,
VERSION 1.2.0 + CHANGELOG.
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
)
|
||||
|
||||
// PreviewRow mémorise la vignette servie (V3 S7, migration 000024).
|
||||
type PreviewRow struct {
|
||||
SrcSize int64
|
||||
SrcUpdatedAt time.Time
|
||||
}
|
||||
|
||||
// GetPreview lit la génération servie. Absente → sql.ErrNoRows (régénérer).
|
||||
func (r *Resources) GetPreview(resourceID string) (PreviewRow, error) {
|
||||
var row PreviewRow
|
||||
err := r.DB.QueryRow(
|
||||
`SELECT src_size_bytes, src_updated_at FROM resource_previews WHERE resource_id = $1`,
|
||||
resourceID,
|
||||
).Scan(&row.SrcSize, &row.SrcUpdatedAt)
|
||||
if err == sql.ErrNoRows {
|
||||
return PreviewRow{}, err
|
||||
}
|
||||
return row, err
|
||||
}
|
||||
|
||||
// UpsertPreview mémorise la génération servie (taille + updated_at sources).
|
||||
func (r *Resources) UpsertPreview(resourceID string, srcSize int64, srcUpdatedAt time.Time) error {
|
||||
_, err := r.DB.Exec(
|
||||
`INSERT INTO resource_previews (resource_id, src_size_bytes, src_updated_at)
|
||||
VALUES ($1, $2, $3)
|
||||
ON CONFLICT (resource_id)
|
||||
DO UPDATE SET src_size_bytes = EXCLUDED.src_size_bytes,
|
||||
src_updated_at = EXCLUDED.src_updated_at,
|
||||
created_at = NOW()`,
|
||||
resourceID, srcSize, srcUpdatedAt,
|
||||
)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user