code: func (c *QueryController) Create(ctx *app.CreateQueryContext) error {
  	currentUserIdentityID, err := login.ContextIdentity(ctx)
  	if err != nil {
  		return jsonapi.JSONErrorResponse(ctx, goa.ErrUnauthorized(err.Error()))
  	}
  	var q query.Query
  	err = application.Transactional(c.db, func(appl application.Application) error {
  		err = appl.Spaces().CheckExists(ctx, ctx.SpaceID)
  		if err != nil {
  			return err
  		}
  		q = query.Query{
  			SpaceID: ctx.SpaceID,
  			Fields:  ctx.Payload.Data.Attributes.Fields,
  			Title:   strings.TrimSpace(ctx.Payload.Data.Attributes.Title),
  			Creator: *currentUserIdentityID,
  		}
  		err = appl.Queries().Create(ctx, &q)
  		return errs.WithStack(err)
  	})
  	if err != nil {
  		return jsonapi.JSONErrorResponse(ctx, err)
  	}
  	res := &app.QuerySingle{
  		Data: ConvertQuery(ctx.Request, q),
  	}
  	ctx.ResponseData.Header().Set("Location", rest.AbsoluteURL(ctx.Request, app.QueryHref(ctx.SpaceID, res.Data.ID)))
  	return ctx.Created(res)
  }
docs: // Create runs the create action.