(ctx context.Context, currentUser string, deployType int, id int64, paths []string)
| 786 | } |
| 787 | |
| 788 | func (c *ModelComponent) SetRuntimeFrameworkModes(ctx context.Context, currentUser string, deployType int, id int64, paths []string) ([]string, error) { |
| 789 | runtimeRepos, err := c.rtfm.FindByID(ctx, id) |
| 790 | if err != nil { |
| 791 | return nil, err |
| 792 | } |
| 793 | |
| 794 | if runtimeRepos == nil { |
| 795 | return nil, fmt.Errorf("failed to get runtime framework") |
| 796 | } |
| 797 | |
| 798 | models, err := c.ms.ListByPath(ctx, paths) |
| 799 | if err != nil { |
| 800 | return nil, err |
| 801 | } |
| 802 | |
| 803 | var failedModels []string |
| 804 | for _, model := range models { |
| 805 | relations, err := c.rrtfms.GetByIDsAndType(ctx, id, model.Repository.ID, deployType) |
| 806 | if err != nil { |
| 807 | return nil, err |
| 808 | } |
| 809 | if relations == nil || len(relations) < 1 { |
| 810 | err = c.rrtfms.Add(ctx, id, model.Repository.ID, deployType) |
| 811 | if err != nil { |
| 812 | failedModels = append(failedModels, model.Repository.Path) |
| 813 | } |
| 814 | } |
| 815 | } |
| 816 | |
| 817 | return failedModels, nil |
| 818 | } |
| 819 | |
| 820 | func (c *ModelComponent) DeleteRuntimeFrameworkModes(ctx context.Context, currentUser string, deployType int, id int64, paths []string) ([]string, error) { |
| 821 | models, err := c.ms.ListByPath(ctx, paths) |
no test coverage detected