package tenant import ( "context" "backend/modules/users" "github.com/pkg/errors" log "github.com/sirupsen/logrus" ) // @provider type Create struct { userSvc *users.Service log *log.Entry `inject:"false"` } // Prepare func (d *Create) Prepare() error { d.log = log.WithField("module", "tenants.create") return nil } func (d *Create) RunE(name, slug string) error { d.log.Infof("create tenant %s(%s)", name, slug) err := d.userSvc.CreateTenant(context.Background(), name, slug) if err != nil { return errors.Wrapf(err, "create tenant: %s(%s)", name, slug) } d.log.Infof("create tenant success: %s(%s)", name, slug) return nil }