mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
25 lines
604 B
Go
25 lines
604 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/kolide/fleet/server/kolide"
|
|
)
|
|
|
|
func (mw validationMiddleware) InviteNewUser(ctx context.Context, payload kolide.InvitePayload) (*kolide.Invite, error) {
|
|
invalid := &invalidArgumentError{}
|
|
if payload.Email == nil {
|
|
invalid.Append("email", "missing required argument")
|
|
}
|
|
if payload.InvitedBy == nil {
|
|
invalid.Append("invited_by", "missing required argument")
|
|
}
|
|
if payload.Admin == nil {
|
|
invalid.Append("admin", "missing required argument")
|
|
}
|
|
if invalid.HasErrors() {
|
|
return nil, invalid
|
|
}
|
|
return mw.Service.InviteNewUser(ctx, payload)
|
|
}
|