Fallback upload for crop (portfolio line item) photos that keep failing on the portfolio-service attachment endpoint. In PortfolioLineItemPicRH.onError, if ref data PORTFOLIO_APP_CONFIG.FIREBASE_ATTACHMENT_UPLOAD_FLAG == 1 and attemptCount >= PORTFOLIO_APP_CONFIG.FIREBASE_ATTACHMENT_UPLOAD_POST_FAIL_COUNT (default 5), FirebaseStorageUtil.uploadImage puts the local file to <userId>/<farmerId>/<pliId>/<pliId>.<ext> (ext defaults to jpg) and blocks with Tasks.await for the download URL. On success the ledger is marked done, PLIImageMeta goes to Firestore pli_image_meta, and the operation is never retried (TryAgain.NEVER). The photo never reaches the platform API; a back-office migration presumably copies it. If the upload returns null, the operation is rewritten to the portfolio custom attachment endpoint and retried later.
Headers
Header
Value
Notes
(Firebase SDK)
<Firebase app credentials>
No user auth. Access depends on Storage rules (not in the repo).
Parameters
Param
In
Required
Example
Notes
userId
path
Yes
1001
Data.getUserId().
farmerId
path
Yes
880001
Server IE id (resolved from aliasId if needed).
pliId
path
Yes
7001
Server portfolio line item id. Used as both folder and file name.
Request
Example request body (synthetic data)
{
"part": "image file bytes from PortfolioLineItem.imageUrl (local path)"
}
Field
Type
Required
Notes
file
image
Yes
Crop Actual photo. PII: geotagged field or farmer photo.