s-private API Documentation - v3.8.1
    Preparing search index...

    Domain service for Note business logic.

    Encapsulates complex business rules that don't belong to a single entity. Uses dependency injection for repository access.

    const queryRepo: INotesQueryRepository = new PrismaNotesQueryRepository();
    const domainService = new NotesDomainService(queryRepo);

    try {
    await domainService.ensureNoDuplicate(title, userId);
    // Safe to create the note
    } catch (error) {
    if (error instanceof DuplicateError) {
    // Handle duplicate title
    }
    }
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Validates that no note with the same title exists for the user.

      Parameters

      • title: string & $brand<"NoteTitle">

        The title to check for duplicates

      • userId: string & $brand<"UserId">

        The user ID for tenant isolation

      Returns Promise<void>

      When a note with this title already exists

      This is a domain invariant check that should be called before creating notes.