-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Endpoint to serve organizations across all segments (#2560)
- Loading branch information
Showing
3 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,27 @@ | ||
import Permissions from '../../security/permissions' | ||
import OrganizationService from '../../services/organizationService' | ||
import PermissionChecker from '../../services/user/permissionChecker' | ||
import Permissions from '../../security/permissions' | ||
import OrganizationService from '@/services/organizationService' | ||
|
||
/** | ||
* POST /tenant/{tenantId}/organization/list | ||
* @summary List organizations across all segments | ||
* @tag Organizations | ||
* @security Bearer | ||
* @description List organizations across all segments. It accepts filters, sorting options and pagination. | ||
* @pathParam {string} tenantId - Your workspace/tenant ID | ||
* @bodyContent {OrganizationQuery} application/json | ||
* @response 200 - Ok | ||
* @responseContent {OrganizationList} 200.application/json | ||
* @responseExample {OrganizationList} 200.application/json.Organization | ||
* @response 401 - Unauthorized | ||
* @response 404 - Not found | ||
* @response 429 - Too many requests | ||
*/ | ||
export default async (req, res) => { | ||
new PermissionChecker(req).validateHas(Permissions.values.organizationRead) | ||
|
||
const payload = await new OrganizationService(req).findAndCountAll(req.query) | ||
const orgService = new OrganizationService(req) | ||
const payload = await orgService.listOrganizationsAcrossAllSegments(req.body) | ||
|
||
await req.responseHandler.success(req, res, payload) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters