fix: fixup leads
ci-api / test (push) Has been cancelled
ci-web / test (push) Has been cancelled

This commit is contained in:
Nuxgrid
2026-07-28 16:40:38 +02:00
parent dfe0e5c5a5
commit b7043e113f
5 changed files with 14 additions and 13 deletions
+9 -3
View File
@@ -30,10 +30,16 @@ func (h *Handler) Create(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{"error": "requête invalide"})
return
}
l, err := h.store.Create(Lead{
lead := Lead{
Telegram: sanitize(req.Telegram),
Message: sanitize(req.Message),
})
}
if msg := sanitize(req.Message); msg != "" {
lead.Message = &msg
}
l, err := h.store.Create(lead)
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": "erreur serveur"})
return
+1 -1
View File
@@ -30,7 +30,7 @@ func (s Status) Valid() bool {
type Lead struct {
ID string `gorm:"type:uuid;primaryKey" json:"id"`
Telegram string `gorm:"size:120;not null" json:"telegram"`
Message string `gorm:"size:2000" json:"message"`
Message *string `gorm:"size:2000" json:"message"`
Status Status `gorm:"size:20;not null;index" json:"status"`
CreatedAt time.Time `json:"created_at"`
}