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

    Domain service for Article business logic.

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

    const queryRepo: IArticlesQueryRepository = new PrismaArticlesQueryRepository();
    const domainService = new ArticlesDomainService(queryRepo);

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

    Constructors

    Methods

    Constructors

    Methods

    • Validates that no article with the same URL exists for the user.

      Parameters

      • url: string & $brand<"Url">

        The URL to check for duplicates

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

        The user ID for tenant isolation

      Returns Promise<void>

      When an article with this URL already exists

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