all repos

onasty @ b59aa76595abf2171bde3a5a97551f1f008aa622

a one-time notes service
3 files changed, 20 insertions(+), 16 deletions(-)
feat(note): return `burn_before_expiration` (#149)

Author: Smirnov Oleksandr ss2316544@gmail.com
Committed by: GitHub noreply@github.com
Committed at: 2025-06-25 17:36:09 +0300
Parent: 86dba8e
M internal/dtos/note.go

@@ -9,10 +9,11 @@

type NoteSlug = string type GetNote struct { - Content string - ReadAt time.Time - CreatedAt time.Time - ExpiresAt time.Time + Content string + BurnBeforeExpiration bool + ReadAt time.Time + CreatedAt time.Time + ExpiresAt time.Time } type NoteMetadata struct {
M internal/service/notesrv/notesrv.go

@@ -131,10 +131,11 @@ return dtos.GetNote{}, models.ErrNoteExpired

} respNote := dtos.GetNote{ - Content: note.Content, - ReadAt: note.ReadAt, - CreatedAt: note.CreatedAt, - ExpiresAt: note.ExpiresAt, + Content: note.Content, + BurnBeforeExpiration: note.BurnBeforeExpiration, + ReadAt: note.ReadAt, + CreatedAt: note.CreatedAt, + ExpiresAt: note.ExpiresAt, } // since not every note should be burn before expiration
M internal/transport/http/apiv1/note.go

@@ -54,10 +54,11 @@ Password string `json:"password"`

} type getNoteBySlugResponse struct { - Content string `json:"content"` - ReadAt time.Time `json:"read_at,omitzero"` - CreatedAt time.Time `json:"created_at"` - ExpiresAt time.Time `json:"expires_at,omitzero"` + Content string `json:"content"` + ReadAt time.Time `json:"read_at,omitzero"` + BurnBeforeExpiration bool `json:"burn_before_expiration"` + CreatedAt time.Time `json:"created_at"` + ExpiresAt time.Time `json:"expires_at,omitzero"` } func (a *APIV1) getNoteBySlugHandler(c *gin.Context) {

@@ -85,10 +86,11 @@ status = http.StatusNotFound

} c.JSON(status, getNoteBySlugResponse{ - Content: note.Content, - ReadAt: note.ReadAt, - CreatedAt: note.CreatedAt, - ExpiresAt: note.ExpiresAt, + Content: note.Content, + ReadAt: note.ReadAt, + CreatedAt: note.CreatedAt, + ExpiresAt: note.ExpiresAt, + BurnBeforeExpiration: note.BurnBeforeExpiration, }) }