package serializer

import (
	"github.com/jinzhu/gorm"
	"github.com/mingrammer/meetup-api/api/model"
)

type ParticipantSerialzer struct {
	ID        uint `json:"id"`
	Name      string `json:"name"`
	AvatarURL string `json:"avatar"`
}

func SerializeParticipant(db *gorm.DB, participant *model.User) *ParticipantSerialzer {
	owner := model.User{}
	db.Find(&owner, participant.ID)
	participantSerialzer := ParticipantSerialzer{
		ID:        participant.ID,
		Name:      participant.Name,
		AvatarURL: participant.AvatarURL,
	}
	return &participantSerialzer
}

package serializer

import (
	"github.com/jinzhu/gorm"
	"github.com/mingrammer/meetup-api/api/model"
)

type ParticipantSerialzer struct {
	ID   uint `json:"id"`
	Name string `json:"name"`
}

func SerializeParticipant(db *gorm.DB, participant *model.User) *ParticipantSerialzer {
	owner := model.User{}
	db.Find(&owner, participant.ID)
	participantSerialzer := ParticipantSerialzer{
		ID:   participant.ID,
		Name: participant.Name,
	}
	return &participantSerialzer
}

--- 
+++ 
@@ -6,16 +6,18 @@
 )
 
 type ParticipantSerialzer struct {
-	ID   uint `json:"id"`
-	Name string `json:"name"`
+	ID        uint `json:"id"`
+	Name      string `json:"name"`
+	AvatarURL string `json:"avatar"`
 }
 
 func SerializeParticipant(db *gorm.DB, participant *model.User) *ParticipantSerialzer {
 	owner := model.User{}
 	db.Find(&owner, participant.ID)
 	participantSerialzer := ParticipantSerialzer{
-		ID:   participant.ID,
-		Name: participant.Name,
+		ID:        participant.ID,
+		Name:      participant.Name,
+		AvatarURL: participant.AvatarURL,
 	}
 	return &participantSerialzer
 }
Add avatar url to participant serializer
