Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
use App\ModelSerializers\SerializerUtils;
use App\Rules\Boolean;
use App\Services\Model\ISummitMetricService;
use Illuminate\Http\Response;
use models\main\IMemberRepository;
use models\oauth2\IResourceServerContext;
use models\summit\ISummitMetricType;
use models\summit\ISummitRepository;
use ModelSerializers\SerializerRegistry;
use OpenApi\Attributes as OA;

/**
* Class OAuth2SummitMetricsApiController
Expand Down Expand Up @@ -68,6 +70,41 @@ public function __construct
* @param $event_id
* @return mixed
*/
#[OA\Put(
path: "/api/v1/summits/{id}/metrics/enter",
summary: "Record a metric entry (enter)",
security: [["Bearer" => []]],
tags: ["summit-metrics"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
)
],
requestBody: new OA\RequestBody(
required: true,
content: new OA\MediaType(
mediaType: "application/json",
schema: new OA\Schema(ref: "#/components/schemas/SummitMetricEnterRequest")
)
),
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/SummitMetric")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
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")
]
)]
public function enter($summit_id)
{
return $this->processRequest(function () use ($summit_id) {
Expand Down Expand Up @@ -101,6 +138,41 @@ public function enter($summit_id)
* @param $event_id
* @return mixed
*/
#[OA\Post(
path: "/api/v1/summits/{id}/metrics/leave",
summary: "Record a metric exit (leave)",
security: [["Bearer" => []]],
tags: ["summit-metrics"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
)
],
requestBody: new OA\RequestBody(
required: true,
content: new OA\MediaType(
mediaType: "application/json",
schema: new OA\Schema(ref: "#/components/schemas/SummitMetricLeaveRequest")
)
),
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/SummitMetric")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
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")
]
)]
public function leave($summit_id)
{
return $this->processRequest(function () use ($summit_id) {
Expand Down Expand Up @@ -134,6 +206,48 @@ public function leave($summit_id)
* @param $event_id
* @return mixed
*/
#[OA\Put(
path: "/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/metrics/enter",
summary: "Record a metric entry to a specific event",
security: [["Bearer" => []]],
tags: ["summit-metrics"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
),
new OA\Parameter(
name: "member_id",
in: "path",
required: true,
schema: new OA\Schema(type: "string", enum: ["me"]),
description: "The member id (must be 'me')"
),
new OA\Parameter(
name: "event_id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The event id"
)
],
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/SummitMetric")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
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")
]
)]
public function enterToEvent($summit_id, $member_id, $event_id)
{
return $this->processRequest(function () use ($summit_id, $member_id, $event_id) {
Expand Down Expand Up @@ -162,6 +276,48 @@ public function enterToEvent($summit_id, $member_id, $event_id)
* @param $event_id
* @return mixed
*/
#[OA\Post(
path: "/api/v1/summits/{id}/members/{member_id}/schedule/{event_id}/metrics/leave",
summary: "Record a metric exit from a specific event",
security: [["Bearer" => []]],
tags: ["summit-metrics"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
),
new OA\Parameter(
name: "member_id",
in: "path",
required: true,
schema: new OA\Schema(type: "string", enum: ["me"]),
description: "The member id (must be 'me')"
),
new OA\Parameter(
name: "event_id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The event id"
)
],
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/SummitMetric")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
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")
]
)]
public function leaveFromEvent($summit_id, $member_id, $event_id)
{
return $this->processRequest(function () use ($summit_id, $member_id, $event_id) {
Expand All @@ -184,6 +340,41 @@ public function leaveFromEvent($summit_id, $member_id, $event_id)
});
}

#[OA\Put(
path: "/api/v1/summits/{id}/metrics/onsite/enter",
summary: "Record an on-site metric entry (for attendees entering venue/room)",
security: [["Bearer" => []]],
tags: ["summit-metrics"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
)
],
requestBody: new OA\RequestBody(
required: true,
content: new OA\MediaType(
mediaType: "application/json",
schema: new OA\Schema(ref: "#/components/schemas/SummitMetricOnSiteEnterRequest")
)
),
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/SummitMetric")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
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")
]
)]
public function onSiteEnter($summit_id)
{
return $this->processRequest(function () use ($summit_id) {
Expand Down Expand Up @@ -213,7 +404,55 @@ public function onSiteEnter($summit_id)
});
}


#[OA\Get(
path: "/api/v1/summits/{id}/metrics/onsite/enter",
summary: "Check if on-site entry is allowed for an attendee (validation only, does not record entry)",
security: [["Bearer" => []]],
tags: ["summit-metrics"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
),
new OA\Parameter(
name: "attendee_id",
in: "query",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The attendee id"
),
new OA\Parameter(
name: "room_id",
in: "query",
required: false,
schema: new OA\Schema(type: "integer"),
description: "The room id"
),
new OA\Parameter(
name: "event_id",
in: "query",
required: false,
schema: new OA\Schema(type: "integer"),
description: "The event id"
)
],
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/SummitMetric")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
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")
]
)]
public function checkOnSiteEnter($summit_id)
{
return $this->processRequest(function () use ($summit_id) {
Expand All @@ -240,6 +479,41 @@ public function checkOnSiteEnter($summit_id)
});
}

#[OA\Post(
path: "/api/v1/summits/{id}/metrics/onsite/leave",
summary: "Record an on-site metric exit (for attendees leaving venue/room)",
security: [["Bearer" => []]],
tags: ["summit-metrics"],
parameters: [
new OA\Parameter(
name: "id",
in: "path",
required: true,
schema: new OA\Schema(type: "integer"),
description: "The summit id"
)
],
requestBody: new OA\RequestBody(
required: true,
content: new OA\MediaType(
mediaType: "application/json",
schema: new OA\Schema(ref: "#/components/schemas/SummitMetricOnSiteLeaveRequest")
)
),
responses: [
new OA\Response(
response: 200,
description: "OK",
content: new OA\JsonContent(ref: "#/components/schemas/SummitMetric")
),
new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Bad Request"),
new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"),
new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"),
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")
]
)]
public function onSiteLeave($summit_id)
{
return $this->processRequest(function () use ($summit_id) {
Expand All @@ -265,4 +539,4 @@ public function onSiteLeave($summit_id)
));
});
}
}
}
Loading