3 files changed,
20 insertions(+),
16 deletions(-)
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 9 type NoteSlug = string 10 10 11 11 type GetNote struct { 12 - Content string 13 - ReadAt time.Time 14 - CreatedAt time.Time 15 - ExpiresAt time.Time 12 + Content string 13 + BurnBeforeExpiration bool 14 + ReadAt time.Time 15 + CreatedAt time.Time 16 + ExpiresAt time.Time 16 17 } 17 18 18 19 type NoteMetadata struct {
M
internal/service/notesrv/notesrv.go
··· 131 131 } 132 132 133 133 respNote := dtos.GetNote{ 134 - Content: note.Content, 135 - ReadAt: note.ReadAt, 136 - CreatedAt: note.CreatedAt, 137 - ExpiresAt: note.ExpiresAt, 134 + Content: note.Content, 135 + BurnBeforeExpiration: note.BurnBeforeExpiration, 136 + ReadAt: note.ReadAt, 137 + CreatedAt: note.CreatedAt, 138 + ExpiresAt: note.ExpiresAt, 138 139 } 139 140 140 141 // since not every note should be burn before expiration
M
internal/transport/http/apiv1/note.go
··· 54 54 } 55 55 56 56 type getNoteBySlugResponse struct { 57 - Content string `json:"content"` 58 - ReadAt time.Time `json:"read_at,omitzero"` 59 - CreatedAt time.Time `json:"created_at"` 60 - ExpiresAt time.Time `json:"expires_at,omitzero"` 57 + Content string `json:"content"` 58 + ReadAt time.Time `json:"read_at,omitzero"` 59 + BurnBeforeExpiration bool `json:"burn_before_expiration"` 60 + CreatedAt time.Time `json:"created_at"` 61 + ExpiresAt time.Time `json:"expires_at,omitzero"` 61 62 } 62 63 63 64 func (a *APIV1) getNoteBySlugHandler(c *gin.Context) { ··· 85 86 } 86 87 87 88 c.JSON(status, getNoteBySlugResponse{ 88 - Content: note.Content, 89 - ReadAt: note.ReadAt, 90 - CreatedAt: note.CreatedAt, 91 - ExpiresAt: note.ExpiresAt, 89 + Content: note.Content, 90 + ReadAt: note.ReadAt, 91 + CreatedAt: note.CreatedAt, 92 + ExpiresAt: note.ExpiresAt, 93 + BurnBeforeExpiration: note.BurnBeforeExpiration, 92 94 }) 93 95 } 94 96