feat(link_service): added link_service
This commit is contained in:
parent
96b51584ff
commit
6595e5a447
1 changed files with 10 additions and 1 deletions
|
|
@ -2,8 +2,10 @@ package services
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"log/slog"
|
||||||
|
|
||||||
filehandling "github.com/KristianJBorgwarth/dendrite.daemon/core/file_handling"
|
filehandling "github.com/KristianJBorgwarth/dendrite.daemon/core/file_handling"
|
||||||
|
"github.com/KristianJBorgwarth/dendrite.daemon/core/models"
|
||||||
"github.com/KristianJBorgwarth/dendrite.daemon/persistence"
|
"github.com/KristianJBorgwarth/dendrite.daemon/persistence"
|
||||||
"github.com/KristianJBorgwarth/dendrite.daemon/persistence/repositories"
|
"github.com/KristianJBorgwarth/dendrite.daemon/persistence/repositories"
|
||||||
)
|
)
|
||||||
|
|
@ -21,5 +23,12 @@ func NewLinkService(linkRepo repositories.ILinkRepository) ILinkService {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *linkService) CreateLinks(ctx context.Context, dbCtx persistence.IDbContext, noteID string, links []*filehandling.ExtractedLink) error {
|
func (s *linkService) CreateLinks(ctx context.Context, dbCtx persistence.IDbContext, noteID string, links []*filehandling.ExtractedLink) error {
|
||||||
panic("not implemented")
|
if len(links) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
linkModels := models.MapToLinkModel(noteID, links)
|
||||||
|
slog.Debug("Creating links", "noteID", noteID, "links", linkModels)
|
||||||
|
return s.linkRepo.Insert(ctx, dbCtx, linkModels)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue