func (c *SpaceController) List(ctx *app.ListSpaceContext) error {
	offset, limit := computePagingLimts(ctx.PageOffset, ctx.PageLimit)

	return application.Transactional(c.db, func(appl application.Application) error {
		spaces, cnt, err := appl.Spaces().List(ctx.Context, &offset, &limit)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		return ctx.ConditionalEntities(spaces, c.config.GetCacheControlSpace, func() error {
			count := int(cnt)
			spaceData, err := ConvertSpacesFromModel(ctx.Context, c.db, ctx.RequestData, spaces)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, err)
			}
			response := app.SpaceList{
				Links: &app.PagingLinks{},
				Meta:  &app.SpaceListMeta{TotalCount: count},
				Data:  spaceData,
			}
			setPagingLinks(response.Links, buildAbsoluteURL(ctx.RequestData), len(spaces), offset, limit, count)
			return ctx.OK(&response)
		})
	})

}
// List runs the list action.
List runs the list action.
// List runs the list action .
func (c *SpaceController) List(ctx *app.ListSpaceContext) error {
	offset, limit := computePagingLimts(ctx.PageOffset, ctx.PageLimit)
	return application.Transactional(c.db, func(appl application.Application) error {
		spaces, cnt, err := appl.Spaces().List(ctx.Context, &offset, &limit)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		return ctx.ConditionalEntities(spaces, c.config.GetCacheControlSpace, func() error {
			count := int(cnt)
			spaceData, err := ConvertSpacesFromModel(ctx.Context, c.db, ctx.RequestData, spaces)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, err)
			}
			response := app.SpaceList{
				Links: &app.PagingLinks{},
				Meta:  &app.SpaceListMeta{TotalCount: count},
				Data:  spaceData,
			}
			setPagingLinks(response.Links, buildAbsoluteURL(ctx.RequestData), len(spaces), offset, limit, count)
			return ctx.OK(&response)
		})
	})
}
func ( c * SpaceController ) List ( ctx * app . ListSpaceContext ) error { offset , limit := computePagingLimts ( ctx . PageOffset , ctx . PageLimit ) return application . Transactional ( c . db , func ( appl application . Application ) error { spaces , cnt , err := appl . Spaces ( ) . List ( ctx . Context , & offset , & limit ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , err ) } return ctx . ConditionalEntities ( spaces , c . config . GetCacheControlSpace , func ( ) error { count := int ( cnt ) spaceData , err := ConvertSpacesFromModel ( ctx . Context , c . db , ctx . RequestData , spaces ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , err ) } response := app . SpaceList { Links : & app . PagingLinks { } , Meta : & app . SpaceListMeta { TotalCount : count } , Data : spaceData , } setPagingLinks ( response . Links , buildAbsoluteURL ( ctx . RequestData ) , len ( spaces ) , offset , limit , count ) return ctx . OK ( & response ) } ) } ) }
List runs the list action.
List runs the list action .