🛣️ Profile routes
Profile routes are SDK composers, not Express middleware. All routes authenticate first; routes below state their exact second access rule and map source errors through orThrow or legacy terminators.
Inventory
Details
createProfileRoute
Implementation
Endpoint: POST /profiles
Access: Authenticated administrator or the identity in the JSON body.
Request: createProfileSchema, application/json body.
Pipeline: createProfile, getProfileById, avatar normalization, raw-document normalization, orThrow.
Success: Normalized profile data is returned without a statusCode descriptor.
Failure: The legacy create/load handlers can return 400, 404, or 500; orThrow has no local error map, so those errors propagate.View complete source
getProfileRoute
Implementation
Endpoint: GET /profiles/:profileId
Access: authenticated administrator or owner.
Request: path profileId; see getProfileSchema.
Pipeline: getProfileById, avatar and raw-document normalization, orThrow.
Success: normalized profile JSON.
Failure: source profile lookup failure.View complete source
findProfilesRoute
Implementation
Endpoint: GET /profiles
Access: authenticated administrator.
Request: identity/name filters and shared pagination query parameters; see findProfilesSchema.
Pipeline: findProfiles, pagination, avatar/document normalization.
Success: { data, metadata: { pagination } } without a statusCode descriptor.
Failure: the legacy list handler can return 500; the route has no local error map.View complete source
updateProfileRoute
Implementation
Endpoint: PATCH /profiles/:profileId
Access: authenticated administrator or owner.
Request: path ID and JSON body; see updateProfileSchema.
Pipeline: loads prior profile, updateProfile, reloads it, conditionally deletes replaced avatar, normalizes it.
Success: normalized profile JSON.
Failure: 404 profile; 500 file storage.View complete source
deleteProfileRoute
Implementation
Endpoint: DELETE /profiles/:profileId
Access: authenticated administrator or owner.
Request: path ID.
Pipeline: getProfileById, deleteProfile, deleteAvatar, deleteProfileTerminator.
Success: 204.
Failure: legacy loader/deleter errors and avatar storage errors propagate; the terminator also throws 500 if data.deleteProfile is missing.View complete source
getAvatarUploadUrlRoute
Implementation
Endpoint: GET /profiles/:profileId/avatar-upload-url
Access: authenticated administrator or owner.
Request: shared signed-image query contract (contentType, contentLength).
Pipeline: generateSignedAvatarUploadUrl, orThrow.
Success: 200
Failure: file-storage error maps to 500.View complete source
findProfilesByIdentityIdRoute
Implementation
Endpoint: GET /profiles/identities/:identityId
Access: authenticated self.
Request: shared identity path parameter plus shared pagination query.
Pipeline: identity filter, no-_id find options, paginated findProfiles, avatar normalization, response assembly.
Success: { data, metadata: { pagination } } without a statusCode descriptor.
Failure: ProfileDbBlockError and AvatarBlockError map to 500.View complete source
createProfileFollowRoute
Implementation
Endpoint: PUT /profiles/:profileId/profile-follows/:followProfileId
Access: authenticated administrator or owner.
Request: both path IDs; see createProfileFollowSchema.
Pipeline: loads both profiles, then createProfileFollow.
Success: 204
Failure: 404 profile, 409 duplicate, 500 database failure.View complete source
deleteProfileFollowRoute
Implementation
Endpoint: DELETE /profiles/:profileId/profile-follows/:followProfileId
Access: authenticated administrator or owner.
Request: both path IDs.
Pipeline: loads both profiles, then deleteProfileFollow.
Success: 204
Failure: 404 profile/follow, 500 database failure.View complete source
getProfileFollowersRoute
Implementation
Endpoint: GET /profiles/:profileId/followers
Access: authenticated administrator or owner.
Request: path ID and pagination.
Pipeline: verifies profile, builds follower filter, paginates findProfiles, then normalizeFollowers.
Success: { data, metadata: { pagination } } with 200.
Failure: ProfileNotFoundBlockError maps to 404 and ProfileUnexpectedDBError to 500; unmapped block errors propagate.View complete source
createOrganizationFollowRoute
Implementation
Endpoint: PUT /profiles/:profileId/organization-follows/:followOrganizationId
Access: authenticated administrator or owner.
Request: both path IDs.
Pipeline: verifies profile and organization, then createOrganizationFollow.
Success: 204
Failure: 404, duplicate 409, database 500.View complete source
deleteOrganizationFollowRoute
Implementation
Endpoint: DELETE /profiles/:profileId/organization-follows/:followOrganizationId
Access: authenticated administrator or owner.
Request: both path IDs.
Pipeline: verifies profile and organization, then deleteOrganizationFollow.
Success: 204
Failure: 404 or database 500.View complete source
createProductLikeRoute
Implementation
Endpoint: PUT /profiles/:profileId/product-likes/:likeProductId
Access: authenticated administrator or owner.
Request: both path IDs.
Pipeline: verifies profile and product, then createProductLike.
Success: 204
Failure: 404, duplicate 409, database 500.View complete source
deleteProductLikeRoute
Implementation
Endpoint: DELETE /profiles/:profileId/product-likes/:likeProductId
Access: authenticated administrator or owner.
Request: both path IDs.
Pipeline: verifies profile and product, then deleteProductLike.
Success: 204
Failure: 404 or database 500.View complete source