func ConvertSpaceFromModel(ctx context.Context, db application.DB, request *goa.RequestData, p space.Space, additional ...SpaceConvertFunc) (*app.Space, error) {
	selfURL := rest.AbsoluteURL(request, app.SpaceHref(p.ID))
	spaceIDStr := p.ID.String()
	relatedIterationList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/iterations", spaceIDStr))
	relatedAreaList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/areas", spaceIDStr))
	relatedBacklogList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/backlog", spaceIDStr))
	relatedCodebasesList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/codebases", spaceIDStr))
	relatedWorkItemList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/workitems", spaceIDStr))
	relatedWorkItemTypeList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/workitemtypes", spaceIDStr))
	relatedWorkItemLinkTypeList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/workitemlinktypes", spaceIDStr))
	relatedOwnerByLink := rest.AbsoluteURL(request, fmt.Sprintf("%s/%s", identitiesEndpoint, p.OwnerId.String()))

	count, err := countBacklogItems(ctx, db, p.ID)
	if err != nil {
		return nil, errs.Wrap(err, "unable to fetch backlog items")
	}
	return &app.Space{
		ID:   &p.ID,
		Type: APIStringTypeSpace,
		Attributes: &app.SpaceAttributes{
			Name:        &p.Name,
			Description: &p.Description,
			CreatedAt:   &p.CreatedAt,
			UpdatedAt:   &p.UpdatedAt,
			Version:     &p.Version,
		},
		Links: &app.GenericLinksForSpace{
			Self: &selfURL,
			Backlog: &app.BacklogGenericLink{
				Self: &relatedBacklogList,
				Meta: &app.BacklogLinkMeta{TotalCount: count},
			},
			Workitemtypes:     &relatedWorkItemTypeList,
			Workitemlinktypes: &relatedWorkItemLinkTypeList,
		},
		Relationships: &app.SpaceRelationships{
			OwnedBy: &app.SpaceOwnedBy{
				Data: &app.IdentityRelationData{
					Type: "identities",
					ID:   &p.OwnerId,
				},
				Links: &app.GenericLinks{
					Related: &relatedOwnerByLink,
				},
			},
			Iterations: &app.RelationGeneric{
				Links: &app.GenericLinks{
					Related: &relatedIterationList,
				},
			},
			Areas: &app.RelationGeneric{
				Links: &app.GenericLinks{
					Related: &relatedAreaList,
				},
			},
			Codebases: &app.RelationGeneric{
				Links: &app.GenericLinks{
					Related: &relatedCodebasesList,
				},
			},
			Workitems: &app.RelationGeneric{
				Links: &app.GenericLinks{
					Related: &relatedWorkItemList,
				},
			},
		},
	}, nil
}
// ConvertSpaceFromModel converts between internal and external REST representation
ConvertSpaceFromModel converts between internal and external REST representation
// ConvertSpaceFromModel converts between internal and external REST representation
func ConvertSpaceFromModel(ctx context.Context, db application.DB, request *goa.RequestData, p space.Space, additional ...SpaceConvertFunc) (*app.Space, error) {
	selfURL := rest.AbsoluteURL(request, app.SpaceHref(p.ID))
	spaceIDStr := p.ID.String()
	relatedIterationList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/iterations", spaceIDStr))
	relatedAreaList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/areas", spaceIDStr))
	relatedBacklogList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/backlog", spaceIDStr))
	relatedCodebasesList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/codebases", spaceIDStr))
	relatedWorkItemList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/workitems", spaceIDStr))
	relatedWorkItemTypeList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/workitemtypes", spaceIDStr))
	relatedWorkItemLinkTypeList := rest.AbsoluteURL(request, fmt.Sprintf("/api/spaces/%s/workitemlinktypes", spaceIDStr))
	relatedOwnerByLink := rest.AbsoluteURL(request, fmt.Sprintf("%s/%s", identitiesEndpoint, p.OwnerId.String()))
	count, err := countBacklogItems(ctx, db, p.ID)
	if err != nil {
		return nil, errs.Wrap(err, "unable to fetch backlog items")
	}
	return &app.Space{
		ID:   &p.ID,
		Type: APIStringTypeSpace,
		Attributes: &app.SpaceAttributes{
			Name:        &p.Name,
			Description: &p.Description,
			CreatedAt:   &p.CreatedAt,
			UpdatedAt:   &p.UpdatedAt,
			Version:     &p.Version,
		},
		Links: &app.GenericLinksForSpace{
			Self: &selfURL,
			Backlog: &app.BacklogGenericLink{
				Self: &relatedBacklogList,
				Meta: &app.BacklogLinkMeta{TotalCount: count},
			},
			Workitemtypes:     &relatedWorkItemTypeList,
			Workitemlinktypes: &relatedWorkItemLinkTypeList,
		},
		Relationships: &app.SpaceRelationships{
			OwnedBy: &app.SpaceOwnedBy{
				Data: &app.IdentityRelationData{
					Type: "identities",
					ID:   &p.OwnerId,
				},
				Links: &app.GenericLinks{
					Related: &relatedOwnerByLink,
				},
			},
			Iterations: &app.RelationGeneric{
				Links: &app.GenericLinks{
					Related: &relatedIterationList,
				},
			},
			Areas: &app.RelationGeneric{
				Links: &app.GenericLinks{
					Related: &relatedAreaList,
				},
			},
			Codebases: &app.RelationGeneric{
				Links: &app.GenericLinks{
					Related: &relatedCodebasesList,
				},
			},
			Workitems: &app.RelationGeneric{
				Links: &app.GenericLinks{
					Related: &relatedWorkItemList,
				},
			},
		},
	}, nil
}
func ConvertSpaceFromModel ( ctx context . Context , db application . DB , request * goa . RequestData , p space . Space , additional ... SpaceConvertFunc ) ( * app . Space , error ) { selfURL := rest . AbsoluteURL ( request , app . SpaceHref ( p . ID ) ) spaceIDStr := p . ID . String ( ) relatedIterationList := rest . AbsoluteURL ( request , fmt . Sprintf ( " " , spaceIDStr ) ) relatedAreaList := rest . AbsoluteURL ( request , fmt . Sprintf ( " " , spaceIDStr ) ) relatedBacklogList := rest . AbsoluteURL ( request , fmt . Sprintf ( " " , spaceIDStr ) ) relatedCodebasesList := rest . AbsoluteURL ( request , fmt . Sprintf ( " " , spaceIDStr ) ) relatedWorkItemList := rest . AbsoluteURL ( request , fmt . Sprintf ( " " , spaceIDStr ) ) relatedWorkItemTypeList := rest . AbsoluteURL ( request , fmt . Sprintf ( " " , spaceIDStr ) ) relatedWorkItemLinkTypeList := rest . AbsoluteURL ( request , fmt . Sprintf ( " " , spaceIDStr ) ) relatedOwnerByLink := rest . AbsoluteURL ( request , fmt . Sprintf ( " " , identitiesEndpoint , p . OwnerId . String ( ) ) ) count , err := countBacklogItems ( ctx , db , p . ID ) if err != nil { return nil , errs . Wrap ( err , " " ) } return & app . Space { ID : & p . ID , Type : APIStringTypeSpace , Attributes : & app . SpaceAttributes { Name : & p . Name , Description : & p . Description , CreatedAt : & p . CreatedAt , UpdatedAt : & p . UpdatedAt , Version : & p . Version , } , Links : & app . GenericLinksForSpace { Self : & selfURL , Backlog : & app . BacklogGenericLink { Self : & relatedBacklogList , Meta : & app . BacklogLinkMeta { TotalCount : count } , } , Workitemtypes : & relatedWorkItemTypeList , Workitemlinktypes : & relatedWorkItemLinkTypeList , } , Relationships : & app . SpaceRelationships { OwnedBy : & app . SpaceOwnedBy { Data : & app . IdentityRelationData { Type : " " , ID : & p . OwnerId , } , Links : & app . GenericLinks { Related : & relatedOwnerByLink , } , } , Iterations : & app . RelationGeneric { Links : & app . GenericLinks { Related : & relatedIterationList , } , } , Areas : & app . RelationGeneric { Links : & app . GenericLinks { Related : & relatedAreaList , } , } , Codebases : & app . RelationGeneric { Links : & app . GenericLinks { Related : & relatedCodebasesList , } , } , Workitems : & app . RelationGeneric { Links : & app . GenericLinks { Related : & relatedWorkItemList , } , } , } , } , nil }
ConvertSpaceFromModel converts between internal and external REST representation
ConvertSpaceFromModel converts between internal and external REST representation