mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
20 lines
504 B
Go
20 lines
504 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/contexts/ctxerr"
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
)
|
|
|
|
func (mw validationMiddleware) InviteNewUser(ctx context.Context, payload fleet.InvitePayload) (*fleet.Invite, error) {
|
|
invalid := &fleet.InvalidArgumentError{}
|
|
if payload.Email == nil {
|
|
invalid.Append("email", "missing required argument")
|
|
}
|
|
if invalid.HasErrors() {
|
|
return nil, ctxerr.Wrap(ctx, invalid)
|
|
}
|
|
return mw.Service.InviteNewUser(ctx, payload)
|
|
}
|