25 lines
695 B
Go
25 lines
695 B
Go
package glue
|
|
|
|
import (
|
|
"context"
|
|
"mind/internal/models"
|
|
)
|
|
|
|
type ForkReq struct {
|
|
ConversationID int64 `json:"conversation_id"`
|
|
Name string `json:"name"`
|
|
HeadNodeID int64 `json:"head_node_id"`
|
|
}
|
|
|
|
func (g *Glue) ForkBranch(ctx context.Context, fr ForkReq) (models.Branch, error) {
|
|
return g.repo.CreateOrGetBranch(ctx, fr.ConversationID, fr.Name, fr.HeadNodeID)
|
|
}
|
|
|
|
func (g *Glue) DeleteBranch(ctx context.Context, conversationID int64, name string) error {
|
|
return g.repo.DeleteBranch(ctx, conversationID, name)
|
|
}
|
|
|
|
func (g *Glue) ListBranches(ctx context.Context, conversationID int64) ([]models.Branch, error) {
|
|
return g.repo.ListBranches(ctx, conversationID)
|
|
}
|