func enrichLinkTypeList(ctx *workItemLinkContext, list *app.WorkItemLinkTypeList) error {
	// Add "links" element
	for _, data := range list.Data {
		selfURL := rest.AbsoluteURL(ctx.RequestData, ctx.LinkFunc(*data.ID))
		data.Links = &app.GenericLinks{
			Self: &selfURL,
		}
	}
	// Build our "set" of distinct category IDs already converted as strings
	categoryIDMap := map[uuid.UUID]bool{}
	for _, typeData := range list.Data {
		categoryIDMap[typeData.Relationships.LinkCategory.Data.ID] = true
	}
	// Now include the optional link category data in the work item link type "included" array
	for categoryID := range categoryIDMap {
		modelCategory, err := ctx.Application.WorkItemLinkCategories().Load(ctx.Context, categoryID)
		if err != nil {
			jerrors, httpStatusCode := jsonapi.ErrorToJSONAPIErrors(err)
			return ctx.ResponseData.Service.Send(ctx.Context, httpStatusCode, jerrors)
		}
		appCategory := convertLinkCategoryFromModel(*modelCategory)
		list.Included = append(list.Included, appCategory.Data)
	}

	// Build our "set" of distinct space IDs already converted as strings
	spaceIDMap := map[uuid.UUID]bool{}
	for _, typeData := range list.Data {
		spaceIDMap[*typeData.Relationships.Space.Data.ID] = true
	}
	// Now include the optional link space data in the work item link type "included" array
	for spaceID := range spaceIDMap {
		space, err := ctx.Application.Spaces().Load(ctx.Context, spaceID)
		if err != nil {
			jerrors, httpStatusCode := jsonapi.ErrorToJSONAPIErrors(err)
			return ctx.ResponseData.Service.Send(ctx.Context, httpStatusCode, jerrors)
		}
		spaceData, err := ConvertSpaceFromModel(ctx.Context, ctx.DB, ctx.RequestData, *space)
		if err != nil {
			jerrors, httpStatusCode := jsonapi.ErrorToJSONAPIErrors(err)
			return ctx.ResponseData.Service.Send(ctx.Context, httpStatusCode, jerrors)
		}
		spaceSingle := &app.SpaceSingle{
			Data: spaceData,
		}
		list.Included = append(list.Included, spaceSingle.Data)
	}
	return nil
}
// enrichLinkTypeList includes related resources in the list's "included" array
enrichLinkTypeList includes related resources in the list's "included" array
// enrichLinkTypeList includes related resources in the list ' s " included " array
func enrichLinkTypeList(ctx *workItemLinkContext, list *app.WorkItemLinkTypeList) error {
	for _, data := range list.Data {
		selfURL := rest.AbsoluteURL(ctx.RequestData, ctx.LinkFunc(*data.ID))
		data.Links = &app.GenericLinks{
			Self: &selfURL,
		}
	}
	categoryIDMap := map[uuid.UUID]bool{}
	for _, typeData := range list.Data {
		categoryIDMap[typeData.Relationships.LinkCategory.Data.ID] = true
	}
	for categoryID := range categoryIDMap {
		modelCategory, err := ctx.Application.WorkItemLinkCategories().Load(ctx.Context, categoryID)
		if err != nil {
			jerrors, httpStatusCode := jsonapi.ErrorToJSONAPIErrors(err)
			return ctx.ResponseData.Service.Send(ctx.Context, httpStatusCode, jerrors)
		}
		appCategory := convertLinkCategoryFromModel(*modelCategory)
		list.Included = append(list.Included, appCategory.Data)
	}
	spaceIDMap := map[uuid.UUID]bool{}
	for _, typeData := range list.Data {
		spaceIDMap[*typeData.Relationships.Space.Data.ID] = true
	}
	for spaceID := range spaceIDMap {
		space, err := ctx.Application.Spaces().Load(ctx.Context, spaceID)
		if err != nil {
			jerrors, httpStatusCode := jsonapi.ErrorToJSONAPIErrors(err)
			return ctx.ResponseData.Service.Send(ctx.Context, httpStatusCode, jerrors)
		}
		spaceData, err := ConvertSpaceFromModel(ctx.Context, ctx.DB, ctx.RequestData, *space)
		if err != nil {
			jerrors, httpStatusCode := jsonapi.ErrorToJSONAPIErrors(err)
			return ctx.ResponseData.Service.Send(ctx.Context, httpStatusCode, jerrors)
		}
		spaceSingle := &app.SpaceSingle{
			Data: spaceData,
		}
		list.Included = append(list.Included, spaceSingle.Data)
	}
	return nil
}
func enrichLinkTypeList ( ctx * workItemLinkContext , list * app . WorkItemLinkTypeList ) error { for _ , data := range list . Data { selfURL := rest . AbsoluteURL ( ctx . RequestData , ctx . LinkFunc ( * data . ID ) ) data . Links = & app . GenericLinks { Self : & selfURL , } } categoryIDMap := map [ uuid . UUID ] bool { } for _ , typeData := range list . Data { categoryIDMap [ typeData . Relationships . LinkCategory . Data . ID ] = true } for categoryID := range categoryIDMap { modelCategory , err := ctx . Application . WorkItemLinkCategories ( ) . Load ( ctx . Context , categoryID ) if err != nil { jerrors , httpStatusCode := jsonapi . ErrorToJSONAPIErrors ( err ) return ctx . ResponseData . Service . Send ( ctx . Context , httpStatusCode , jerrors ) } appCategory := convertLinkCategoryFromModel ( * modelCategory ) list . Included = append ( list . Included , appCategory . Data ) } spaceIDMap := map [ uuid . UUID ] bool { } for _ , typeData := range list . Data { spaceIDMap [ * typeData . Relationships . Space . Data . ID ] = true } for spaceID := range spaceIDMap { space , err := ctx . Application . Spaces ( ) . Load ( ctx . Context , spaceID ) if err != nil { jerrors , httpStatusCode := jsonapi . ErrorToJSONAPIErrors ( err ) return ctx . ResponseData . Service . Send ( ctx . Context , httpStatusCode , jerrors ) } spaceData , err := ConvertSpaceFromModel ( ctx . Context , ctx . DB , ctx . RequestData , * space ) if err != nil { jerrors , httpStatusCode := jsonapi . ErrorToJSONAPIErrors ( err ) return ctx . ResponseData . Service . Send ( ctx . Context , httpStatusCode , jerrors ) } spaceSingle := & app . SpaceSingle { Data : spaceData , } list . Included = append ( list . Included , spaceSingle . Data ) } return nil }
enrichLinkTypeList includes related resources in the list's "included" array
enrichLinkTypeList includes related resources in the list ' s " included " array
// Add "links" element // Build our "set" of distinct category IDs already converted as strings // Now include the optional link category data in the work item link type "included" array // Build our "set" of distinct space IDs already converted as strings // Now include the optional link space data in the work item link type "included" array