add profile actors
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user