Esempio n. 1
0
func (p *Profile) convert(ip profile.Profile) error {
	p.Id = ip.Id
	p.RateTypeId = ip.RateTypeId
	p.DailyRate = ip.DailyRate
	p.HourlyRate = ip.HourlyRate
	p.RateUnits = ip.RateUnits
	p.Created = ip.Created
	p.Email = ip.Email
	p.Phone = ip.Phone
	p.Name = ip.Name
	p.Flags = ip.Flags
	p.Utypes = ip.Utypes

	dbPhotos, err := ip.Photos()
	if err != nil {
		return err
	}
	for _, photo := range dbPhotos {
		href := photo.GetExpiringUrl(ip.Folder)
		p.Photos = append(p.Photos, Photo{photo.Id, photo.Created, href, photo.Caption})
	}
	return nil
}