34 lines
606 B
Go
34 lines
606 B
Go
package profile
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
messages "git.k6n.net/mats/go-cart-actor/proto/profile"
|
|
)
|
|
|
|
// HandleSetProfile updates the user's core profile information.
|
|
func HandleSetProfile(p *ProfileGrain, m *messages.SetProfile) error {
|
|
if m == nil {
|
|
return fmt.Errorf("SetProfile: nil payload")
|
|
}
|
|
if m.Name != nil {
|
|
p.Name = *m.Name
|
|
}
|
|
if m.Email != nil {
|
|
p.Email = *m.Email
|
|
}
|
|
if m.Phone != nil {
|
|
p.Phone = *m.Phone
|
|
}
|
|
if m.Language != nil {
|
|
p.Language = *m.Language
|
|
}
|
|
if m.Currency != nil {
|
|
p.Currency = *m.Currency
|
|
}
|
|
if m.AvatarUrl != nil {
|
|
p.AvatarUrl = *m.AvatarUrl
|
|
}
|
|
return nil
|
|
}
|