func (c *WorkitemtypeController) ListTargetLinkTypes(ctx *app.ListTargetLinkTypesWorkitemtypeContext) error {
	spaceID, err := uuid.FromString(ctx.ID)
	if err != nil {
		return errors.NewNotFoundError("spaceID", ctx.ID)
	}

	return application.Transactional(c.db, func(appl application.Application) error {
		// Test that work item type exists
		_, err := appl.WorkItemTypes().Load(ctx.Context, spaceID, ctx.WitID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		// Fetch all link types where this work item type can be used in the
		// target of the linkg
		modelLinkTypes, err := appl.WorkItemLinkTypes().ListTargetLinkTypes(ctx.Context, ctx.WitID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		return ctx.ConditionalEntities(modelLinkTypes, c.config.GetCacheControlWorkItemType, func() error {
			appLinkTypes, err := ConvertLinkTypesFromModels(ctx.RequestData, modelLinkTypes)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, err)
			}
			// Enrich link types
			hrefFunc := func(obj interface{}) string {
				return fmt.Sprintf(app.WorkItemLinkTypeHref(spaceID, "%v"), obj)
			}
			linkCtx := newWorkItemLinkContext(ctx.Context, appl, c.db, ctx.RequestData, ctx.ResponseData, hrefFunc, nil)
			err = enrichLinkTypeList(linkCtx, appLinkTypes)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, err)
			}
			return ctx.OK(appLinkTypes)
		})
	})
}
// ListTargetLinkTypes runs the list-target-link-types action.
ListTargetLinkTypes runs the list-target-link-types action.
// ListTargetLinkTypes runs the list - target - link - types action .
func (c *WorkitemtypeController) ListTargetLinkTypes(ctx *app.ListTargetLinkTypesWorkitemtypeContext) error {
	spaceID, err := uuid.FromString(ctx.ID)
	if err != nil {
		return errors.NewNotFoundError("spaceID", ctx.ID)
	}
	return application.Transactional(c.db, func(appl application.Application) error {
		_, err := appl.WorkItemTypes().Load(ctx.Context, spaceID, ctx.WitID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		modelLinkTypes, err := appl.WorkItemLinkTypes().ListTargetLinkTypes(ctx.Context, ctx.WitID)
		if err != nil {
			return jsonapi.JSONErrorResponse(ctx, err)
		}
		return ctx.ConditionalEntities(modelLinkTypes, c.config.GetCacheControlWorkItemType, func() error {
			appLinkTypes, err := ConvertLinkTypesFromModels(ctx.RequestData, modelLinkTypes)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, err)
			}
			hrefFunc := func(obj interface{}) string {
				return fmt.Sprintf(app.WorkItemLinkTypeHref(spaceID, "%v"), obj)
			}
			linkCtx := newWorkItemLinkContext(ctx.Context, appl, c.db, ctx.RequestData, ctx.ResponseData, hrefFunc, nil)
			err = enrichLinkTypeList(linkCtx, appLinkTypes)
			if err != nil {
				return jsonapi.JSONErrorResponse(ctx, err)
			}
			return ctx.OK(appLinkTypes)
		})
	})
}
func ( c * WorkitemtypeController ) ListTargetLinkTypes ( ctx * app . ListTargetLinkTypesWorkitemtypeContext ) error { spaceID , err := uuid . FromString ( ctx . ID ) if err != nil { return errors . NewNotFoundError ( " " , ctx . ID ) } return application . Transactional ( c . db , func ( appl application . Application ) error { _ , err := appl . WorkItemTypes ( ) . Load ( ctx . Context , spaceID , ctx . WitID ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , err ) } modelLinkTypes , err := appl . WorkItemLinkTypes ( ) . ListTargetLinkTypes ( ctx . Context , ctx . WitID ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , err ) } return ctx . ConditionalEntities ( modelLinkTypes , c . config . GetCacheControlWorkItemType , func ( ) error { appLinkTypes , err := ConvertLinkTypesFromModels ( ctx . RequestData , modelLinkTypes ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , err ) } hrefFunc := func ( obj interface { } ) string { return fmt . Sprintf ( app . WorkItemLinkTypeHref ( spaceID , " " ) , obj ) } linkCtx := newWorkItemLinkContext ( ctx . Context , appl , c . db , ctx . RequestData , ctx . ResponseData , hrefFunc , nil ) err = enrichLinkTypeList ( linkCtx , appLinkTypes ) if err != nil { return jsonapi . JSONErrorResponse ( ctx , err ) } return ctx . OK ( appLinkTypes ) } ) } ) }
ListTargetLinkTypes runs the list-target-link-types action.
ListTargetLinkTypes runs the list - target - link - types action .
// Test that work item type exists // Fetch all link types where this work item type can be used in the // target of the linkg // Enrich link types