diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php index 9df3d807a..6382415f7 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SpeakerOrganizationalRoleApiController.php @@ -12,12 +12,16 @@ * limitations under the License. **/ use App\Models\Foundation\Summit\Repositories\ISpeakerOrganizationalRoleRepository; +use App\Security\SummitScopes; use models\oauth2\IResourceServerContext; use Illuminate\Support\Facades\Log; use models\exceptions\EntityNotFoundException; use models\exceptions\ValidationException; +use Symfony\Component\HttpFoundation\Response; use utils\PagingResponse; use Illuminate\Support\Facades\Request; +use OpenApi\Attributes as OA; + /** * Class OAuth2SpeakerOrganizationalRoleApiController * @package App\Http\Controllers @@ -40,6 +44,36 @@ public function __construct $this->repository = $repository; } + #[OA\Get( + path: '/api/v1/speakers/organizational-roles', + summary: 'Get all default speaker organizational roles', + description: 'Retrieves a list of default organizational roles for speakers. These are predefined role types that speakers can select to describe their position or role within an organization (e.g., "Developer", "Manager", "Architect", "Executive").', + operationId: 'getAllSpeakerOrganizationalRoles', + security: [['speaker_organizational_role_oauth2' => [ + SummitScopes::ReadSummitData, + SummitScopes::ReadAllSummitData + ]]], + tags: ['Speakers'], + parameters: [ + new OA\Parameter( + name: 'expand', + in: 'query', + required: false, + description: 'Comma-separated list of related resources to expand', + schema: new OA\Schema(type: 'string', example: '') + ), + ], + responses: [ + new OA\Response( + response: 200, + description: 'Organizational roles retrieved successfully', + content: new OA\JsonContent(ref: '#/components/schemas/SpeakerOrganizationalRolesResponse') + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "not found"), + new OA\Response(response: Response::HTTP_PRECONDITION_FAILED, description: "Validation Error"), + new OA\Response(response: Response::HTTP_INTERNAL_SERVER_ERROR, description: "Server Error"), + ] + )] /** * @return mixed */ @@ -68,4 +102,4 @@ public function getAll() return $this->error500($ex); } } -} \ No newline at end of file +} diff --git a/app/Swagger/Security/SpeakerOrganizationalRoleAuthSchema.php b/app/Swagger/Security/SpeakerOrganizationalRoleAuthSchema.php new file mode 100644 index 000000000..af67d23a2 --- /dev/null +++ b/app/Swagger/Security/SpeakerOrganizationalRoleAuthSchema.php @@ -0,0 +1,25 @@ + 'Read All Summit Data', + SummitScopes::ReadSummitData => 'Read Summit Data', + ], + ), + ], + ) +] +class SpeakerOrganizationalRoleAuthSchema{} diff --git a/app/Swagger/SummitSpeakersSchemas.php b/app/Swagger/SummitSpeakersSchemas.php index 6cd22d65a..5a1a0deac 100644 --- a/app/Swagger/SummitSpeakersSchemas.php +++ b/app/Swagger/SummitSpeakersSchemas.php @@ -4,6 +4,8 @@ use OpenApi\Attributes as OA; +// + #[OA\Schema( schema: 'SpeakerActiveInvolvement', type: 'object', @@ -15,7 +17,9 @@ new OA\Property(property: 'is_default', type: 'boolean', example: true), ] )] -class SpeakerActiveInvolvementSchema {} +class SpeakerActiveInvolvementSchema +{ +} #[OA\Schema( schema: 'SpeakerActiveInvolvementsResponse', @@ -32,4 +36,40 @@ class SpeakerActiveInvolvementSchema {} ), ] )] -class SpeakerActiveInvolvementsResponseSchema {} +class SpeakerActiveInvolvementsResponseSchema +{ +} + +#[OA\Schema( + schema: 'SpeakerOrganizationalRole', + type: 'object', + properties: [ + new OA\Property(property: 'id', type: 'integer', example: 1), + new OA\Property(property: 'created', type: 'integer', format: 'int64', example: 1633024800), + new OA\Property(property: 'last_edited', type: 'integer', format: 'int64', example: 1633024800), + new OA\Property(property: 'role', type: 'string', example: 'Developer'), + new OA\Property(property: 'is_default', type: 'boolean', example: true), + ] +)] +class SpeakerOrganizationalRoleSchema +{ +} + +#[OA\Schema( + schema: 'SpeakerOrganizationalRolesResponse', + type: 'object', + properties: [ + new OA\Property(property: 'total', type: 'integer', example: 8), + new OA\Property(property: 'per_page', type: 'integer', example: 8), + new OA\Property(property: 'current_page', type: 'integer', example: 1), + new OA\Property(property: 'last_page', type: 'integer', example: 1), + new OA\Property( + property: 'data', + type: 'array', + items: new OA\Items(ref: '#/components/schemas/SpeakerOrganizationalRole') + ), + ] +)] +class SpeakerOrganizationalRolesResponseSchema +{ +} \ No newline at end of file