ShipmentsRepositoryImpl

class ShipmentsRepositoryImpl(fortressApiService: FortressApiService, profileRepository: ProfileRepository, organizationRepository: OrganizationRepository) : ShipmentsRepository

Constructors

Link copied to clipboard
constructor(fortressApiService: FortressApiService, profileRepository: ProfileRepository, organizationRepository: OrganizationRepository)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val sharedShipments: StateFlow<List<Shipment>>
Link copied to clipboard
open override val shipments: StateFlow<List<Shipment>>
Link copied to clipboard
open override val shipmentTrees: StateFlow<List<ShipmentTree>>

Functions

Link copied to clipboard
open suspend override fun archiveShipment(shipmentId: String): Result<Shipment>

Soft-deletes a shipment, moving it to the archive.

Link copied to clipboard
open suspend override fun archiveShipments(shipmentIds: List<String>): Result<List<Shipment>>

Archive multiple shipments (batch operation)

Link copied to clipboard
open suspend override fun archiveShipmentScan(shipmentScanId: String): Result<ShipmentScan>

Deletes a shipment scan.

Link copied to clipboard
open override fun clearShipments()

Clear all shipment data (used when user logs out)

Link copied to clipboard
open suspend override fun createPickTicketShipmentEntry(shipmentId: String, shipmentScanId: String, jobId: String, fileName: String): Result<ShipmentEntry>

Create a shipment entry for a pick ticket image Links the already-uploaded pick ticket image to the shipment and scan

Link copied to clipboard
open suspend override fun createShipment(title: String, metadata: Map<String, Any>?): Result<Shipment>

Creates a new shipment.

Link copied to clipboard
open suspend override fun createShipmentScan(shipmentId: String, title: String, dimensions: Dimensions?, weight: Float?, freightClass: String?, locationData: LocationData?, notes: String?, status: String?, scanType: ShipmentScanType): Result<ShipmentScan>

Records a new scan event for a shipment.

Link copied to clipboard
open suspend override fun fetchAllShipmentData(pollScansEvery: Long?)

Triggers a full refresh of all shipment data, including scans and entries.

Link copied to clipboard
open suspend override fun fetchMostRecentShipmentEntries(shipmentIds: List<String>): Result<Map<String, List<ShipmentEntry>>>

Optimized: Implement parallel batch fetching for entries

Link copied to clipboard
open suspend override fun fetchShipmentAndScans(shipmentId: String): Result<Pair<Shipment, List<ShipmentScan>>>

Fetches both the shipment details and its scans in parallel.

Link copied to clipboard
open suspend override fun fetchShipmentEntries(shipmentScanId: String): Result<List<ShipmentEntry>>

Fetches all entries (files, images, point clouds) attached to a specific scan.

Link copied to clipboard
open suspend override fun fetchShipmentScans(shipmentId: String): Result<List<ShipmentScan>>

Fetches all scans associated with a specific shipment.

open suspend override fun fetchShipmentScans(shipmentIds: List<String>): Result<Map<String, List<ShipmentScan>>>

Optimized: Implement parallel batch fetching for scans

Link copied to clipboard
open suspend override fun fetchShipmentTrees(pollScansEvery: Long?): Result<ShipmentWithSharing>

Optimized: Implement parallel fetching of scans and entries

Link copied to clipboard
open suspend override fun processCloudDimensions(snapshotZipData: ByteArray, shipmentId: String, shipmentScanId: String, progressCallback: (String) -> Unit?, validationResult: SnapshotValidator.ValidationResult?): Boolean

Optimized: Extract cloud processing to separate function

Link copied to clipboard
open suspend override fun renameShipment(shipmentId: String, newTitle: String): Result<Shipment>

Rename a shipment

Link copied to clipboard
open suspend override fun shareShipment(shipmentId: String, recipientEmail: String, expiration: String?): Result<ShipmentSharing>

Shares a shipment with another user via email.

Link copied to clipboard
open override fun shipmentEntriesOf(shipmentId: String): StateFlow<List<ShipmentEntry>>

Provides a reactive stream of entries for a single shipment.

open override fun shipmentEntriesOf(shipmentIds: Set<String>): StateFlow<List<List<ShipmentEntry>>>

Provides a reactive stream of entries (files/metadata) for a set of shipment IDs.

Link copied to clipboard
open override fun shipmentScansOf(shipmentId: String): StateFlow<List<ShipmentScan>>

Provides a reactive stream of scans for a single shipment.

open override fun shipmentScansOf(shipmentIds: Set<String>): StateFlow<List<List<ShipmentScan>>>

Provides a reactive stream of scans for a specific set of shipment IDs.

Link copied to clipboard
open override fun shipmentTree(shipmentId: String): StateFlow<ShipmentTree>

Returns a reactive stream for a specific ShipmentTree.

Link copied to clipboard
open suspend override fun unarchiveShipment(shipmentId: String): Result<Shipment>

Unarchive a shipment (restore)

Link copied to clipboard
open suspend override fun updateShipmentMetadata(shipmentId: String, metadata: Map<String, Any>): Result<Shipment>

Updates metadata of a shipment Ensure original metadata fields of shipment are included to not overwrite data.

Link copied to clipboard
open suspend override fun updateShipmentScan(shipmentScanId: String, metadata: Map<String, Any>): Result<ShipmentScan>

Updates raw metadata for a specific scan.

Link copied to clipboard
open suspend override fun updateShipmentScanManualDimensions(shipmentScanId: String, dimensions: Dimensions): Result<ShipmentScan>

Updates a scan with manually measured dimensions.

Link copied to clipboard
open suspend override fun updateShipmentScanQualityApprovedByUser(scanId: String, approved: Boolean, currentMetadata: Map<String, Any>): Result<ShipmentScan>

Updates the quality approval status for a scan, usually triggered by manual user review.

Link copied to clipboard
open suspend override fun updateShipmentScanType(scanId: String, scanType: ShipmentScanType): Result<ShipmentScan>

Update shipment scan type to match the document type

Link copied to clipboard
open suspend override fun updateShipmentScanUserDimensions(shipmentScanId: String, dimensions: Dimensions, newCenter: Vector3): Result<ShipmentScan>

Updates the bounding box/user-adjusted dimensions for a 3D scan.

Link copied to clipboard
open suspend override fun updateShipmentScanWeight(shipmentScanId: String, weight: Float?): Result<ShipmentScan>

Updates the weight of the scanned object.

Link copied to clipboard
open suspend override fun uploadBarcodes(barcodeData: List<BarcodeData>, shipmentId: String, shipmentScanId: String, progressCallback: (String) -> Unit?): Result<Shipment>

Optimized: Extract barcode upload to separate function

Link copied to clipboard
open suspend override fun uploadImages(images: List<ByteArray>, shipmentId: String, shipmentScanId: String, progressCallback: (String) -> Unit?): List<Pair<StorageObject, ShipmentEntry>?>

Optimized: Extract image upload to separate function

Link copied to clipboard
open suspend override fun uploadLogLines(logList: List<LogEntry>): Result<String>

Uploads SDK/Application logs to the Dockware server for troubleshooting.