| 12345678910111213141516171819202122232425262728 |
- package command
- import "errors"
- type CreateUserCommand struct {
- // FirstName string
- // LastName string
- FirstName string `json:"first_name"`
- LastName string `json:"last_name"`
- }
- func NewCreateUserCommand(firstName, lastName string) *CreateUserCommand {
- return &CreateUserCommand{
- FirstName: firstName,
- LastName: lastName,
- }
- }
- // Validate valida los campos del comando
- func (c *CreateUserCommand) Validate() error {
- if c.FirstName == "" {
- return errors.New("el nombre es requerido")
- }
- if c.LastName == "" {
- return errors.New("el apellido es requerido")
- }
- return nil
- }
|