🛣️ Organization routes
Organization routes are SDK composers, not Express middleware. Mount their matching feature or organizationService; each detail links schema, validators, pipeline, and response contract.
Inventory
Details
createOrganizationRoute
Implementation
Endpoint: POST /organizations
Creates a new organization via POST /organizations with parent/ancestor and logo normalization.
Access: The source executes this validator chain in order: isAuthenticated → checkIdentityType.
Request: createOrganizationSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → calculateChildAncestors → noop → createOrganization → normalizeLogoOfOwner → normalizeOrganizationTerminator.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
getOrganizationRoute
Implementation
Endpoint: GET /organizations/:organizationId
Retrieves a specific organization via GET /organizations/:organizationId with logo normalization and access control.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: getOrganizationSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → normalizeCertificateImage → normalizeLogoOfOwner → normalizeOrganizationTerminator.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
findOrganizationsRoute
Implementation
Endpoint: GET /organizations
Retrieves paginated organizations list via GET /organizations with certificate and logo normalization for admin users.
Access: The source executes this validator chain in order: isAuthenticated → checkIdentityType.
Request: findOrganizationsSchema defines the path, query, header, and JSON-body contract.
Pipeline: findOrganizations → normalizeCertificateImages → normalizeLogosOfOwners → applySpec → normalizeOrganizationsListTerminator.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
updateOrganizationRoute
Implementation
Endpoint: PATCH /organizations/:organizationId
Updates an existing organization via PATCH /organizations/:organizationId with logo normalization and access control.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: updateOrganizationSchema defines the path, query, header, and JSON-body contract.
Pipeline: updateOrganization → getOrganizationById → normalizeCertificateImage → normalizeLogoOfOwner → normalizeOrganizationTerminator.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
updateOrganizationAsAdminRoute
Implementation
Endpoint: PATCH /admin/organizations/:organizationId/
Updates an organization as admin via PATCH /admin/organizations/:organizationId/.
Access: The source executes this validator chain in order: isAuthenticated → checkIdentityType.
Request: updateOrganizationAsAdminSchema defines the path, query, header, and JSON-body contract.
Pipeline: validateAuditStatus → updateOrganization → getOrganizationById → normalizeCertificateImage → normalizeLogoOfOwner → normalizeOrganizationTerminator.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
deleteOrganizationRoute
Implementation
Endpoint: DELETE /organizations/:organizationId
Deletes an organization and its logo via DELETE /organizations/:organizationId.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: deleteOrganizationSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → deleteLogoOfOwner → deleteOrganization → deleteOrganizationTerminator.
Success: 204; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
getOrganizationMemberRoleRoute
Implementation
Endpoint: GET /organizations/:organizationId/members/:identityId/role
Retrieves the role of a specific member within an organization via GET /organizations/:organizationId/members/:identityId/role.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: getOrganizationMemberRoleSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → buildOrganizationsForMemberByIdsQuery → findOrganizations → calculateMemberRole.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
checkOrganizationMemberExistenceRoute
Implementation
Endpoint: GET /organizations/:organizationId/members/check-existence
Checks if a given identity exists as a member within an organization via GET /organizations/:organizationId/members/check-existence.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: checkOrganizationMemberExistenceSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → checkOrganizationMemberExistence → normalizeOrganizationMemberExistenceTerminator.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
findOrganizationMembersRoute
Implementation
Endpoint: GET /organizations/:organizationId/members
Retrieves all members within an organization via GET /organizations/:organizationId/members.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: findOrganizationMembersSchema defines the path, query, header, and JSON-body contract.
Pipeline: findOrganizationMembers → normalizeOrganizationMembersListTerminator.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
upsertOrganizationMembersRoute
Implementation
Endpoint: PATCH /organizations/:organizationId/members
Upserts members within an organization via PATCH /organizations/:organizationId/members.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → all → hasOrgRole → hasOrgRoleAssignmentPermission → hasOrgOwnerRemainingAfterMembersUpsert.
Request: upsertOrganizationMembersSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → upsertOrganizationMembers → upsertOrganizationMembersTerminator.
Success: 204; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
deleteOrganizationMemberRoute
Implementation
Endpoint: DELETE /organizations/:organizationId/members/:identityId
Removes a member from an organization via DELETE /organizations/:organizationId/members/:identityId.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → all → hasOrgRole → hasOrgRoleSameOrAbove → hasOrgOwnerRemainingAfterMemberRemoval.
Request: deleteOrganizationMemberSchema defines the path, query, header, and JSON-body contract.
Pipeline: deleteOrganizationMember → deleteOrganizationMemberTerminator.
Success: 204; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
findOrganizationsForMemberRoute
Implementation
Endpoint: GET /organizations/members/:identityId
Retrieves all organizations for a specific member, including direct and inherited roles, via GET /organizations/members/:identityId.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → isSelf.
Request: findOrganizationsForMemberSchema defines the path, query, header, and JSON-body contract.
Pipeline: buildOrganizationsForMemberByRoleQuery → findOrganizations → normalizeCertificateImages → normalizeLogosOfOwners → buildOrganizationsWithDescendantsQuery → extractAncestors → buildOrganizationsForMemberByIdsQuery → calculateMemberRoleForOrganizations → normalizeOrganizationsForMember.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
findOrganizationDescendantsRoute
Implementation
Endpoint: GET /organizations/:organizationId/descendants
Organization descendants retrieval route with pagination and normalization.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: findOrganizationDescendantsSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → buildDescendantsQuery → findOrganizations → normalizeOrganizations → applySpec.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
getLogoUploadUrlRoute
Implementation
Endpoint: GET /organizations/:organizationId/logo-upload-url
Generates a signed upload URL for an organization logo via GET /organizations/:organizationId/logo-upload-url.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: getSignedImageUploadUrlSchema defines the path, query, header, and JSON-body contract.
Pipeline: generateFileUploadUrl.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
getCertificateUploadUrlRoute
Implementation
Endpoint: GET /organizations/:organizationId/certificate-upload-url
Generates a signed upload URL for an organization certificate via GET /organizations/:organizationId/certificate-upload-url.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: getCertificateUploadUrlSchema defines the path, query, header, and JSON-body contract.
Pipeline: generateFileUploadUrl.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
createChangeRequestRoute
Implementation
Endpoint: POST /organizations/:organizationId/change-requests
Creates organization change request via POST /organizations/:organizationId/change-requests.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: createChangeRequestSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → validateOrganizationName → noop → extractTokenFromAuthorizationHeader → checkToken → createChangeRequest → buildUpdateOrganizationAfterNewChangeRequestPayload → updateOrganization → normalizeEmptyBody.
Success: 204; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
findChangeRequestsForOrganizationRoute
Implementation
Endpoint: GET /organizations/:organizationId/change-requests
Retrieves change requests for a specific organization via GET /organizations/:organizationId/change-requests.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: findChangeRequestsForOrganizationSchema defines the path, query, header, and JSON-body contract.
Pipeline: findChangeRequests → normalizeChangeRequests → applySpec.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source
getOrganizationFollowersRoute
Implementation
Endpoint: GET /organizations/:organizationId/followers
Retrieves organization followers via GET /organizations/:organizationId/followers.
Access: The source executes this validator chain in order: isAuthenticated → some → checkIdentityType → hasOrgRole.
Request: getOrganizationFollowersSchema defines the path, query, header, and JSON-body contract.
Pipeline: getOrganizationById → buildOrganizationFollowersByFollowOrganizationIdQuery → buildWithoutMongoIdFindOptions → findProfiles → normalizeFollowers → applySpec.
Success: 200; the complete source shows the final ordinary value, terminator, or orThrow response descriptor.
Failure: Validator failures occur before the pipeline; source-mapped block errors and status mappings are preserved in the complete definition below.View complete source