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

    Domain service for Image business logic.

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

    const queryRepo: IImagesQueryRepository = new PrismaImagesQueryRepository();
    const domainService = new ImagesDomainService(queryRepo);

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

    Constructors

    Methods

    Constructors

    Methods

    • Validates that no image with the same path exists for the user.

      Parameters

      • path: string & $brand<"Path">

        The path to check for duplicates

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

        The user ID for tenant isolation

      Returns Promise<void>

      When an image with this path already exists

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