@@ -4288,4 +4288,84 @@ public function updateLeadReportSettings($summit_id, $sponsor_id) {
42884288 );
42894289 });
42904290 }
4291+
4292+ #[OA \Put(
4293+ path: "/api/v1/summits/{id}/sponsors/{sponsor_id}/sponsorservices-statistics " ,
4294+ description: "required-groups " . IGroup::SuperAdmins . ", " . IGroup::Administrators . ", " . IGroup::SummitAdministrators,
4295+ summary: 'Upsert Sponsor Services Statistics ' ,
4296+ operationId: 'updateSponsorServicesStatistics ' ,
4297+ tags: ['Sponsors ' ],
4298+ x: [
4299+ 'required-groups ' => [
4300+ IGroup::SuperAdmins,
4301+ IGroup::Administrators,
4302+ IGroup::SummitAdministrators,
4303+ ]
4304+ ],
4305+ security: [
4306+ [
4307+ 'summit_sponsor_oauth2 ' => [
4308+ SummitScopes::WriteSummitData,
4309+ ]
4310+ ]
4311+ ],
4312+ parameters: [
4313+ new OA \Parameter (
4314+ name: 'id ' ,
4315+ in: 'path ' ,
4316+ required: true ,
4317+ schema: new OA \Schema (type: 'integer ' ),
4318+ description: 'The summit id '
4319+ ),
4320+ new OA \Parameter (
4321+ name: 'sponsor_id ' ,
4322+ in: 'path ' ,
4323+ required: true ,
4324+ schema: new OA \Schema (type: 'integer ' ),
4325+ description: 'The sponsor id '
4326+ ),
4327+ ],
4328+ requestBody: new OA \RequestBody (
4329+ required: true ,
4330+ content: new OA \JsonContent (ref: "#/components/schemas/SponsorServicesStatisticsUpsertRequest " )
4331+ ),
4332+ responses: [
4333+ new OA \Response (
4334+ response: Response::HTTP_CREATED ,
4335+ description: 'Sponsor Services Statistics created/updated successfully '
4336+ ),
4337+ new OA \Response (response: Response::HTTP_UNAUTHORIZED , description: "Unauthorized " ),
4338+ new OA \Response (response: Response::HTTP_NOT_FOUND , description: "Not Found " ),
4339+ new OA \Response (response: Response::HTTP_INTERNAL_SERVER_ERROR , description: "Server Error " ),
4340+ new OA \Response (response: Response::HTTP_PRECONDITION_FAILED , description: "Validation Error " )
4341+ ]
4342+ )]
4343+ /**
4344+ * @param $summit_id
4345+ * @param $sponsor_id
4346+ * @return mixed
4347+ */
4348+ public function updateSponsorServicesStatistics ($ summit_id , $ sponsor_id ) {
4349+ return $ this ->processRequest (function () use ($ summit_id , $ sponsor_id ) {
4350+
4351+ $ summit = SummitFinderStrategyFactory::build ($ this ->summit_repository , $ this ->resource_server_context )->find ($ summit_id );
4352+ if (is_null ($ summit )) return $ this ->error404 ();
4353+
4354+ $ sponsor = $ summit ->getSummitSponsorById (intval ($ sponsor_id ));
4355+ if (is_null ($ sponsor )) return $ this ->error404 ();
4356+
4357+ $ payload = $ this ->getJsonPayload (SponsorServicesStatisticsValidationRulesFactory::buildForUpdate (), true );
4358+
4359+ $ statistics = $ this ->service ->updateSponsorServicesStatistics ($ summit , $ sponsor ->getId (), $ payload );
4360+
4361+ return $ this ->updated (SerializerRegistry::getInstance ()
4362+ ->getSerializer ($ statistics )
4363+ ->serialize (
4364+ SerializerUtils::getExpand (),
4365+ SerializerUtils::getFields (),
4366+ SerializerUtils::getRelations ()
4367+ )
4368+ );
4369+ });
4370+ }
42914371}
0 commit comments