notes

package
v1.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(repo repository.Repo, subscriptions service.SubscriptionService) *Service

func (*Service) CheckImportConflicts

func (s *Service) CheckImportConflicts(ctx context.Context, vaultID uuid.UUID, destPath string, zipData []byte) ([]string, error)

CheckImportConflicts is a dry run over an uploaded zip: it reports which of its entries would collide with an existing note/file at destPath, without writing anything. The caller re-submits the same zip to CommitImport along with a resolution per conflicting path.

func (*Service) CommitImport

func (s *Service) CommitImport(
	ctx context.Context,
	vaultID uuid.UUID,
	destPath string,
	zipData []byte,
	resolutions []domain.ImportResolution,
) (imported int, skipped int, err error)

CommitImport writes an uploaded zip's entries under destPath, applying resolutions for any path CheckImportConflicts previously reported as conflicting. Entries with no resolution and no conflict are written directly. Binary entries are skipped (not failed) when the vault has no bucket, matching the best-effort semantics of DeleteFolder.

func (*Service) DeleteFolder

func (s *Service) DeleteFolder(ctx context.Context, vaultID uuid.UUID, folderPath string) (deletedCount int, failedPaths []string, err error)

DeleteFolder best-effort deletes every note and file under folderPath. CouchDB has no cross-document transactions here, so this cannot be all-or-nothing: it keeps going past individual failures and reports them in failedPaths rather than aborting.

func (*Service) ExportFolder

func (s *Service) ExportFolder(ctx context.Context, vaultID uuid.UUID, folderPath string) ([]byte, error)

ExportFolder zips every note and binary file under folderPath (empty means the whole vault), with entries relative to folderPath, so re-importing the zip elsewhere lands its contents directly under whatever destination path the user picks.

func (*Service) GetNote

func (s *Service) GetNote(ctx context.Context, vaultID uuid.UUID, path string) (couchdb.NoteDoc, error)

func (*Service) ListFolders

func (s *Service) ListFolders(ctx context.Context, vaultID uuid.UUID) ([]string, error)

func (*Service) ListNotes

func (s *Service) ListNotes(ctx context.Context, vaultID uuid.UUID) ([]couchdb.NoteEntry, error)

func (*Service) ListTags

func (s *Service) ListTags(ctx context.Context, vaultID uuid.UUID) ([]string, error)

func (*Service) MoveFolder

func (s *Service) MoveFolder(ctx context.Context, vaultID uuid.UUID, oldFolderPath, newFolderPath string) (movedCount int, err error)

MoveFolder renames folderPath to newFolderPath by moving every note and binary file whose path is folderPath itself or lives under it. Unlike DeleteFolder, this is all-or-nothing: every destination path is checked for conflicts against everything NOT being moved before anything is touched, and the whole move is rejected with user_errors.AlreadyExists if any collide, rather than partially applying and reporting failures.

func (*Service) MoveNote

func (s *Service) MoveNote(ctx context.Context, vaultID uuid.UUID, oldPath, newPath string) error

MoveNote renames/moves a single note. A move onto an already-occupied destination is rejected with user_errors.AlreadyExists rather than silently overwriting (client.MoveNote upserts on write, so without this check a move onto an existing path would clobber it).

func (*Service) SaveNote

func (s *Service) SaveNote(ctx context.Context, vaultID uuid.UUID, path, content string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL