diff --git a/backend/handlers/main.go b/backend/handlers/main.go index b19aac8..5e765c9 100644 --- a/backend/handlers/main.go +++ b/backend/handlers/main.go @@ -333,7 +333,7 @@ func WebhookReceiveHandler(db *gorm.DB) http.HandlerFunc { messages := value["messages"].([]interface{}) if len(messages) > 0 { msg := messages[0].(map[string]interface{}) - from := msg["from"].(string) + //from := msg["from"].(string) msgType := msg["type"].(string) msgID := msg["id"].(string) @@ -354,7 +354,7 @@ func WebhookReceiveHandler(db *gorm.DB) http.HandlerFunc { conv := models.Conversation{ UserID: user.ID, - From: from, + From: user.NameClient, To: recipientID, MessageID: msgID, Type: msgType, diff --git a/backend/models/models.go b/backend/models/models.go index 29eed3a..3dc6c36 100644 --- a/backend/models/models.go +++ b/backend/models/models.go @@ -19,8 +19,9 @@ type User struct { CreatedAt time.Time UpdatedAt time.Time DeletedAt gorm.DeletedAt `gorm:"index"` - - Password string `gorm:"not null"` // hashé avec bcrypt + + NameClient string `gorm:"not null"` + Password string `gorm:"not null"` // hashé avec bcrypt Email string `gorm:"uniqueIndex;not null"` SSOID string `gorm:"uniqueIndex;not null"` Role UserRole `gorm:"type:enum('ADMIN','CLIENT');default:'CLIENT';not null"`