func (c *WorkitemtypeController) List(ctx *app.ListWorkitemtypeContext) error {
	spaceID, err := uuid.FromString(ctx.ID)
	if err != nil {
		return errors.NewNotFoundError("spaceID", ctx.ID)
	}
	logrus.Info("spaceID:", spaceID)
	start, limit, err := parseLimit(ctx.Page)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "Could not parse paging"))
	}
	return application.Transactional(c.db, func(appl application.Application) error {
		witModels, err := appl.WorkItemTypes().List(ctx.Context, spaceID, start, &limit)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "Error listing work item types"))
		}
		return ctx.ConditionalEntities(witModels, c.config.GetCacheControlWorkItemType, func() error {
			// TEMP!!!!! Until Space Template can setup a Space, redirect to SystemSpace WITs if non are found
			// for the space.
			if len(witModels) == 0 {
				witModels, err = appl.WorkItemTypes().List(ctx.Context, space.SystemSpace, start, &limit)
				if err != nil {
					return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "Error listing work item types"))
				}
			}
			// convert from model to app
			result := &app.WorkItemTypeList{}
			result.Data = make([]*app.WorkItemTypeData, len(witModels))
			for index, value := range witModels {
				wit := ConvertWorkItemTypeFromModel(ctx.RequestData, &value)
				result.Data[index] = &wit
			}
			return ctx.OK(result)
		})
	})
}
// List runs the list action
List runs the list action
// List runs the list action
func (c *WorkitemtypeController) List(ctx *app.ListWorkitemtypeContext) error {
	spaceID, err := uuid.FromString(ctx.ID)
	if err != nil {
		return errors.NewNotFoundError("spaceID", ctx.ID)
	}
	logrus.Info("spaceID:", spaceID)
	start, limit, err := parseLimit(ctx.Page)
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "Could not parse paging"))
	}
	return application.Transactional(c.db, func(appl application.Application) error {
		witModels, err := appl.WorkItemTypes().List(ctx.Context, spaceID, start, &limit)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "Error listing work item types"))
		}
		return ctx.ConditionalEntities(witModels, c.config.GetCacheControlWorkItemType, func() error {
			if len(witModels) == 0 {
				witModels, err = appl.WorkItemTypes().List(ctx.Context, space.SystemSpace, start, &limit)
				if err != nil {
					return jsonapi.JSONErrorResponse(ctx, errs.Wrap(err, "Error listing work item types"))
				}
			}
			result := &app.WorkItemTypeList{}
			result.Data = make([]*app.WorkItemTypeData, len(witModels))
			for index, value := range witModels {
				wit := ConvertWorkItemTypeFromModel(ctx.RequestData, &value)
				result.Data[index] = &wit
			}
			return ctx.OK(result)
		})
	})
}
func ( c * WorkitemtypeController ) List ( ctx * app . ListWorkitemtypeContext ) error { spaceID , err := uuid . FromString ( ctx . ID ) if err != nil { return errors . NewNotFoundError ( " " , ctx . ID ) } logrus . Info ( " " , spaceID ) start , limit , err := parseLimit ( ctx . Page ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , errs . Wrap ( err , " " ) ) } return application . Transactional ( c . db , func ( appl application . Application ) error { witModels , err := appl . WorkItemTypes ( ) . List ( ctx . Context , spaceID , start , & limit ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , errs . Wrap ( err , " " ) ) } return ctx . ConditionalEntities ( witModels , c . config . GetCacheControlWorkItemType , func ( ) error { if len ( witModels ) == 0 { witModels , err = appl . WorkItemTypes ( ) . List ( ctx . Context , space . SystemSpace , start , & limit ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , errs . Wrap ( err , " " ) ) } } result := & app . WorkItemTypeList { } result . Data = make ( [ ] * app . WorkItemTypeData , len ( witModels ) ) for index , value := range witModels { wit := ConvertWorkItemTypeFromModel ( ctx . RequestData , & value ) result . Data [ index ] = & wit } return ctx . OK ( result ) } ) } ) }
List runs the list action
List runs the list action
// TEMP!!!!! Until Space Template can setup a Space, redirect to SystemSpace WITs if non are found // for the space. // convert from model to app