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

    Domain service for batch operations on Articles.

    Encapsulates the business logic for batch status transitions. Manages the state machine for article lifecycle:

    UNEXPORTED --> LAST_UPDATED --> EXPORTED
    |
    v
    UNEXPORTED (revert)
    const commandRepo = createArticlesCommandRepository(prisma);
    const batchService = new ArticlesBatchDomainService(commandRepo);

    // Reset: finalize previous batch and mark new items
    const result = await batchService.resetArticles(userId);
    console.log(`Finalized: ${result.finalized.count}, Marked: ${result.marked.count}`);

    // Revert: undo the marking if something went wrong
    const revertResult = await batchService.revertArticles(userId);
    console.log(`Reverted: ${revertResult.count}`);
    Index

    Constructors

    Methods

    • Resets articles for a new batch export.

      Parameters

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

        The user ID for tenant isolation

      Returns Promise<ResetStatusResult>

      The result containing finalized and marked counts

      Delegates to repository's resetStatus which performs two operations atomically within a single transaction:

      1. Finalize: LAST_UPDATED -> EXPORTED (complete previous batch)
      2. Mark: UNEXPORTED -> LAST_UPDATED (prepare current batch)