diff --git a/config/routes.php b/config/routes.php index 25f1bbc..dbfcfd1 100644 --- a/config/routes.php +++ b/config/routes.php @@ -1,220 +1,342 @@ get('/', \App\Action\Home\HomeAction::class)->setName('home'); + $app->get('/', HomeAction::class)->setName('home'); - $app->get('/whatsapp', \App\Action\Home\HomeAction::class)->setName('whatsapp'); + $app->get('/whatsapp', HomeAction::class)->setName('whatsapp'); // Swagger API documentation - $app->get('/docs/v1', \App\Action\OpenApi\Version1DocAction::class)->setName('docs'); + $app->get('/docs/v1', Version1DocAction::class)->setName('docs'); - $app->post('/doc_login', \App\Action\Auth\DocLoginSubmitAction::class)->setName('login'); + $app->post('/doc_login', DocLoginSubmitAction::class)->setName('login'); - $app->post('/user_login', \App\Action\Auth\UserLoginSubmitAction::class)->setName('user-login'); + $app->post('/user_login', UserLoginSubmitAction::class)->setName('user-login'); - $app->post('/register_doc', \App\Action\Users\UserCreateDocAction::class); + $app->post('/register_doc', UserCreateDocAction::class); - $app->post('/register_paz', \App\Action\Users\UserCreatePazAction::class); + $app->post('/register_paz', UserCreatePazAction::class); - $app->get('/logout', \App\Action\Auth\LogoutAction::class); + $app->get('/logout', LogoutAction::class); $app->group('/public', function (RouteCollectorProxy $group) { - $group->get("/doc_login", \App\Action\Pages\DocLoginPageAction::class)->setName('public_doc_login'); - $group->get("/paziente_login", \App\Action\Pages\PazLoginPageAction::class)->setName('public_paz_login'); - $group->get("/admin_login", \App\Action\Pages\AdminLoginPageAction::class)->setName('public_admin_login'); - $group->get("/register_doc", \App\Action\Pages\RegisterDocPageAction::class)->setName('register_doc'); - $group->get("/privacy", \App\Action\Pages\PrivacyPageAction::class)->setName('privacy-policy'); - $group->get("/terms", \App\Action\Pages\TermsPageAction::class)->setName('terms'); - $group->post("/stripe/webhook", \App\Action\Stripe\webhook::class)->setName('wh'); - $group->get("/consulto/{codice}", \App\Action\Pages\ConsultoPageAction::class)->setName('consulto'); - $group->post("/pincode/check", \App\Action\Consulti\PinCodeActionCheck::class)->setName('consulto-pin-check'); - $group->post("/hack/attempt", \App\Action\Security\HackAttemptAction::class)->setName('log-hack-attempt'); - $group->get('/create-checkout-session', \App\Action\Pages\CreateCheckoutSession::class)->setName('payment-page'); + $group->get("/doc_login", DocLoginPageAction::class)->setName('public_doc_login'); + $group->get("/paziente_login", PazLoginPageAction::class)->setName('public_paz_login'); + $group->get("/admin_login", AdminLoginPageAction::class)->setName('public_admin_login'); + $group->get("/register_doc", RegisterDocPageAction::class)->setName('register_doc'); + $group->get("/privacy", PrivacyPageAction::class)->setName('privacy-policy'); + $group->get("/terms", TermsPageAction::class)->setName('terms'); + $group->post("/stripe/webhook", webhook::class)->setName('wh'); + $group->get("/consult/{codice}", ConsultoPageAction::class)->setName('consult'); + $group->post("/pincode/check", PinCodeActionCheck::class)->setName('consult-pin-check'); + $group->post("/hack/attempt", HackAttemptAction::class)->setName('log-hack-attempt'); + $group->get('/create-checkout-session', CreateCheckoutSession::class)->setName('payment-page'); }); $app->group('/pages', function (RouteCollectorProxy $group) { - $group->get("/home_doctor", \App\Action\Pages\HomeDocPageAction::class)->setName('pages-home-doc'); - $group->get("/doctor_detail[/{esito}]", \App\Action\Pages\DetailDocPageAction::class)->setName('doctor-detail'); - $group->get("/messages", \App\Action\Pages\MessagesDocPageAction::class)->setName('doctor-detail'); - $group->get("/patients/detail/{paz_id}", \App\Action\Pages\PatientDetailAction::class)->setName('pages-view-patient'); - $group->get("/calendar", \App\Action\Pages\CalendarAction::class)->setName('calendar'); - $group->get("/reports", \App\Action\Pages\ReportsAction::class)->setName('reports'); - $group->get("/faq", \App\Action\Pages\FaqPageAction::class)->setName('reports'); - - $group->get("/patients/add", \App\Action\Pages\AddPatientsAction::class)->setName('add-patient'); - $group->get("/patients/list", \App\Action\Pages\ListSmartboxAction::class)->setName('list-patient'); + $group->get("/home_doctor", HomeDocPageAction::class)->setName('pages-home-doc'); + $group->get("/doctor_detail[/{esito}]", DetailDocPageAction::class)->setName('doctor-detail'); + $group->get("/messages", MessagesDocPageAction::class)->setName('doctor-detail'); + $group->get("/patients/detail/{paz_id}", PatientDetailAction::class)->setName('pages-view-patient'); + $group->get("/calendar", CalendarAction::class)->setName('calendar'); + $group->get("/reports", ReportsAction::class)->setName('reports'); + $group->get("/faq", FaqPageAction::class)->setName('reports'); + + $group->get("/patients/add", AddPatientsAction::class)->setName('add-patient'); + $group->get("/patients/list", ListSmartboxAction::class)->setName('list-patient'); })->add(UserAuthMiddleware::class); // API endpoints. This group is protected with JWT. $app->group('/api', function (RouteCollectorProxy $group) { - $group->post('/patients/add', \App\Action\Patients\AddPatientAction::class); - $group->get('/patients/list', \App\Action\Patients\ListPatAction::class); - $group->get('/patients/list/last_10_mood/{paz_id}', \App\Action\Patients\List10MoodPatientAction::class); - $group->get('/patients/list/diary/{user_id}', \App\Action\Patients\ListDiaryPatientAction::class); - $group->get('/patients/pharm/list/{paz_id}', \App\Action\Patients\ListPharmPatientAction::class); - $group->post('/patients/update', \App\Action\Patients\UpdatePatientAction::class); - $group->get('/patients/file/list/{user_id}', \App\Action\Files\DocFileListAction::class); - $group->post('/patient/file/download', \App\Action\Files\DocFileDownloadAction::class); - $group->post('/patient/file/upload', \App\Action\Files\DocFileUploadAction::class); - $group->post('/patient/file/delete', \App\Action\Files\DocFileDeleteAction::class); - $group->get('/patient/mood/all/{user_id}', \App\Action\Patients\ListAllMoodPatientAction::class); - $group->get('/patient/depressione/all/{user_id}', \App\Action\Patients\ListAllDeprePatientAction::class); - $group->get('/account/delete', \App\Action\Users\UserDocDeleteAction::class); - $group->get('/login/history', \App\Action\Users\UserHistoryAction::class); - $group->post('/password/update', \App\Action\Users\UserPasswordChange::class); - $group->post('/drugs/list/search', \App\Action\Pharm\WebSearchByNameAction::class); - $group->get('/search/patient/{full_name}', \App\Action\Patients\SearchPatAction::class); - $group->get('/invoices/list', \App\Action\Invoices\ListInvoiceAction::class); - $group->get('/patient/pills/add/{paz_id}/{pill_id}', \App\Action\Patients\AddPillPatientAction::class); - $group->get('/patient/pills/delete/{paz_id}/{ass_id}', \App\Action\Patients\DelPillPatientAction::class); - $group->get('/patient/delete/{paz_id}', \App\Action\Patients\DelPatientAction::class); - $group->get('/patients/list/annotation/{paz_id}', \App\Action\Patients\ListAnnotationPatientAction::class); - $group->post('/patients/add/annotation', \App\Action\Patients\AddAnnotationPatientAction::class); - $group->get('/patients/delete/annotation/{ann_id}', \App\Action\Patients\DeleteAnnotationPatientAction::class); - $group->get('/patients/relazione/{paz_id}', \App\Action\Patients\LoadRelazionePatientAction::class); - $group->post('/patients/relazione/save', \App\Action\Patients\SalvaRelazionePatientAction::class); - $group->get('/patient/messsages/contacts', \App\Action\Messages\ListContactsAction::class); - $group->get('/calendar/list', \App\Action\Calendar\ListEventAction::class); - $group->post('/calendar/add', \App\Action\Calendar\AddEventAction::class); - $group->post('/patient/search', \App\Action\Patients\SelectSearchPatAction::class); - $group->get('/patient/test/comportamento/{user_id}', \App\Action\Reports\WebListComportamentoTestAction::class); - $group->get('/patient/test/emozioni/{user_id}', \App\Action\Reports\WebListEmozioniTestAction::class); - $group->get('/patient/test/phq9/{user_id}', \App\Action\Reports\WebPhqTestAction::class); - $group->get('/patient/report/{user_id}', \App\Action\Reports\WebReportsAction::class); - $group->get('/doctor/stat', \App\Action\Reports\WebDocStatAction::class); - $group->post('/dsm/list/search', \App\Action\Dsm\WebDsmSearchByNameAction::class); - $group->post('/search/patient', \App\Action\Patients\ReportSearchPatAction::class); - $group->post('/reports/generate', \App\Action\Reports\WebReportGenAction::class); - $group->post('/consulto/create', \App\Action\Consulti\GeneraLinkConsultoAction::class); - $group->get('/consulto/list/{paz_id}', \App\Action\Consulti\ListLinkConsultoAction::class); + $group->post('/patients/add', AddPatientAction::class); + $group->get('/patients/list', ListPatAction::class); + $group->get('/patients/list/last_10_mood/{paz_id}', List10MoodPatientAction::class); + $group->get('/patients/list/diary/{user_id}', ListDiaryPatientAction::class); + $group->get('/patients/pharm/list/{paz_id}', ListPharmPatientAction::class); + $group->post('/patients/update', UpdatePatientAction::class); + $group->get('/patients/file/list/{user_id}', DocFileListAction::class); + $group->post('/patient/file/download', DocFileDownloadAction::class); + $group->post('/patient/file/upload', DocFileUploadAction::class); + $group->post('/patient/file/delete', DocFileDeleteAction::class); + $group->get('/patient/mood/all/{user_id}', ListAllMoodPatientAction::class); + $group->get('/patient/depressione/all/{user_id}', ListAllDeprePatientAction::class); + $group->get('/account/delete', UserDocDeleteAction::class); + $group->get('/login/history', UserHistoryAction::class); + $group->post('/password/update', UserPasswordChange::class); + $group->post('/drugs/list/search', WebSearchByNameAction::class); + $group->get('/search/patient/{full_name}', SearchPatAction::class); + $group->get('/invoices/list', ListInvoiceAction::class); + $group->get('/patient/pills/add/{paz_id}/{pill_id}', AddPillPatientAction::class); + $group->get('/patient/pills/delete/{paz_id}/{ass_id}', DelPillPatientAction::class); + $group->get('/patient/delete/{paz_id}', DelPatientAction::class); + $group->get('/patients/list/annotation/{paz_id}', ListAnnotationPatientAction::class); + $group->post('/patients/add/annotation', AddAnnotationPatientAction::class); + $group->get('/patients/delete/annotation/{ann_id}', DeleteAnnotationPatientAction::class); + $group->get('/patients/relazione/{paz_id}', LoadPatientRelationAction::class); + $group->post('/patients/relazione/save', SavePatientRelationAction::class); + $group->get('/patient/messsages/contacts', ListContactsAction::class); + $group->get('/calendar/list', ListEventAction::class); + $group->post('/calendar/add', AddEventAction::class); + $group->post('/patient/search', SelectSearchPatAction::class); + $group->get('/patient/test/comportamento/{user_id}', WebListComportamentoTestAction::class); + $group->get('/patient/test/emozioni/{user_id}', WebListEmozioniTestAction::class); + $group->get('/patient/test/phq9/{user_id}', WebPhqTestAction::class); + $group->get('/patient/report/{user_id}', WebReportsAction::class); + $group->get('/doctor/stat', WebDocStatAction::class); + $group->post('/dsm/list/search', WebDsmSearchByNameAction::class); + $group->post('/search/patient', ReportSearchPatAction::class); + $group->post('/reports/generate', WebReportGenAction::class); + $group->post('/consult/create', GenerateConsultLinkAction::class); + $group->get('/consult/list/{paz_id}', ListConsultLinkAction::class); /*** END PATIENTS ***/ - $group->post('/doctor/update', \App\Action\Doctors\UpdateDoctorAction::class); - $group->get('/doctor/calendar', \App\Action\Doctors\UpdateDoctorAction::class); - + $group->post('/doctor/update', UpdateDoctorAction::class); + $group->get('/doctor/calendar', UpdateDoctorAction::class); - $group->get('/cities/list', \App\Action\Cities\ListCitiesAction::class); - $group->get('/dsm/list', \App\Action\Dsm\ListDsmAction::class); - $group->get('/pharm/list', \App\Action\Pharm\ListPharmAction::class); - $group->get('/pharm/list/select', \App\Action\Pharm\ListPharmSelectAction::class); + $group->get('/cities/list', ListCitiesAction::class); + $group->get('/dsm/list', ListDsmAction::class); + $group->get('/pharm/list', ListPharmAction::class); + $group->get('/pharm/list/select', ListPharmSelectAction::class); /** * Retrieve User information */ - $group->get('/user/detail/{id}', \App\Action\Users\UserReadAction::class); + $group->get('/user/detail/{id}', UserReadAction::class); /** * Delete user */ - $group->get('/user/delete/{id}', \App\Action\Users\UserDeleteAction::class); + $group->get('/user/delete/{id}', UserDeleteAction::class); /** * List all users */ - $group->get('/user/list', \App\Action\Users\UserFindAction::class); + $group->get('/user/list', UserFindAction::class); /** * Add User */ - $group->post('/user/add', \App\Action\Users\UserCreateAction::class); + $group->post('/user/add', UserCreateAction::class); /** * Update User */ - $group->post('/user/update', \App\Action\Users\UserUpdateAction::class); + $group->post('/user/update', UserUpdateAction::class); - $group->post('/user/password/update', \App\Action\Users\UserPasswordChange::class); + $group->post('/user/password/update', UserPasswordChange::class); /********* END USER SECTION ************/ })->add(UserAuthMiddleware::class); $app->group('/mobile/api', function (RouteCollectorProxy $group) { - $group->post('/mood', \App\Action\Moods\AddMoodAction::class); - $group->get('/mood/delete/{mood_id}', \App\Action\Moods\DeleteMoodAction::class); - $group->get('/last_10_mood', \App\Action\Moods\ListMoodAction::class); - $group->get('/last_10_mood/graph', \App\Action\Moods\ListMoodGraphAction::class); - $group->post('/patient/update', \App\Action\Users\UserUpdateAction::class); - $group->post('/patient/update/address', \App\Action\Users\UserUpdateAddrAction::class); - $group->post('/invite/doctor', \App\Action\Doctors\InviteDoctorAction::class); - $group->get('/patient/my_doctor', \App\Action\Doctors\DocDetailAppAction::class); - $group->get('/patient/scollega_doc', \App\Action\Doctors\DocRemoveAction::class); - $group->get('/patient/delete_account', \App\Action\Users\UserDeleteAction::class); - $group->get('/drugs/list', \App\Action\Pharm\MobileListPharmAction::class); - $group->get('/drugs/list/search/{drug_name}', \App\Action\Pharm\SearchByNameAction::class); - $group->get('/patient/diary', \App\Action\Diary\GetDiaryAction::class); - $group->post('/patient/diary', \App\Action\Diary\UploadDiaryAction::class); - $group->get('/patient/diary/delete/{diary_id}', \App\Action\Diary\DeleteDiaryAction::class); - $group->post('/patient/file/upload', \App\Action\Files\FileUploadAction::class); - $group->get('/patient/file/list', \App\Action\Files\FileListAction::class); - $group->post('/patient/file/download', \App\Action\Files\FileDownloadAction::class); - $group->post('/patient/tracking', \App\Action\Users\UserTrackAction::class); - $group->get('/patient/tracking/list', \App\Action\Users\UserTrackListAction::class); - $group->get('/patient/calendar', \App\Action\Users\UserCalendarAction::class); - $group->get('/patient/drug/list', \App\Action\Patients\ListPharmPatientMobAction::class); - $group->get('/patient/drug/delete/{id}', \App\Action\Pharm\DeletePharmAction::class); - $group->post('/patient/drug/add', \App\Action\Pharm\AddPharmAction::class); - $group->get('/patient/account/delete', \App\Action\Users\UserDeleteAction::class); - $group->get('/patient/account/download', \App\Action\Users\UserDownloadAction::class); - $group->post('/obiettivi/add', \App\Action\Obiettivi\AddObiettivoAction::class); - $group->post('/obiettivi/delete', \App\Action\Obiettivi\DeleteObiettivoAction::class); - $group->post('/obiettivi/update', \App\Action\Obiettivi\UpdateObiettivoAction::class); - $group->get('/obiettivi/list', \App\Action\Obiettivi\ListObiettivoAction::class); - $group->get('/patient/report/pills', \App\Action\Reports\ReportGenAction::class); - $group->post('/patient/report/mood', \App\Action\Reports\ReportMoodGenAction::class); - $group->post('/patient/test/comportamento', \App\Action\Reports\ComportamentoTestAction::class); - $group->get('/patient/test/comportamento', \App\Action\Reports\ListComportamentoTestAction::class); - $group->post('/patient/test/emozioni', \App\Action\Reports\EmozioniTestAction::class); - $group->get('/patient/test/emozioni', \App\Action\Reports\ListEmozioniTestAction::class); - $group->post('/patient/health/passi', \App\Action\Health\AddPassiAction::class); - $group->post('/patient/test/phq', \App\Action\Reports\Phq9TestAction::class); - $group->get('/patient/test/phq', \App\Action\Reports\ListPhq9TestAction::class); - $group->post('/register/notification', \App\Action\Notification\RegisterNotificationAction::class); - })->add(\App\Middleware\JwtAuthMiddleware::class); - - - /** NON ELIMINARE, RISOLVE PROBLEMA PRE-FLIGHT */ - $app->options('/mobile/api/mood', \App\CORS\CORSAction::class); - $app->options('/mobile/api/mood/delete/{mood_id}', \App\CORS\CORSAction::class); - $app->options('/mobile/api/last_10_mood', \App\CORS\CORSAction::class); - $app->options('/mobile/api/last_10_mood/graph', \App\CORS\CORSAction::class); - $app->options('/register_paz', \App\CORS\CORSAction::class); - $app->options('/user_login', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/update', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/update/address', \App\CORS\CORSAction::class); - $app->options('/mobile/api/invite/doctor', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/my_doctor', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/scollega_doc', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/delete_account', \App\CORS\CORSAction::class); - $app->options('/mobile/api/drugs/list', \App\CORS\CORSAction::class); - $app->options('/mobile/api/drugs/list/search/{drug_name}', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/diary', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/diary/delete/{diary_id}', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/file/upload', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/file/list', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/file/download', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/tracking', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/tracking/list', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/calendar', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/drug/list', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/drug/delete/{id}', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/drug/add', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/account/delete', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/account/download', \App\CORS\CORSAction::class); - $app->options('/mobile/api/obiettivi/add', \App\CORS\CORSAction::class); - $app->options('/mobile/api/obiettivi/delete', \App\CORS\CORSAction::class); - $app->options('/mobile/api/obiettivi/update', \App\CORS\CORSAction::class); - $app->options('/mobile/api/obiettivi/list', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/report/pills', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/report/mood', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/test/comportamento', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/test/emozioni', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/health/passi', \App\CORS\CORSAction::class); - $app->options('/mobile/api/patient/test/phq', \App\CORS\CORSAction::class); - $app->options('/mobile/api/register/notification', \App\CORS\CORSAction::class); + $group->post('/mood', AddMoodAction::class); + $group->get('/mood/delete/{mood_id}', DeleteMoodAction::class); + $group->get('/last_10_mood', ListMoodAction::class); + $group->get('/last_10_mood/graph', ListMoodGraphAction::class); + $group->post('/patient/update', UserUpdateAction::class); + $group->post('/patient/update/address', UserUpdateAddrAction::class); + $group->post('/invite/doctor', InviteDoctorAction::class); + $group->get('/patient/my_doctor', DocDetailAppAction::class); + $group->get('/patient/scollega_doc', DocRemoveAction::class); + $group->get('/patient/delete_account', UserDeleteAction::class); + $group->get('/drugs/list', MobileListPharmAction::class); + $group->get('/drugs/list/search/{drug_name}', SearchByNameAction::class); + $group->get('/patient/diary', GetDiaryAction::class); + $group->post('/patient/diary', UploadDiaryAction::class); + $group->get('/patient/diary/delete/{diary_id}', DeleteDiaryAction::class); + $group->post('/patient/file/upload', FileUploadAction::class); + $group->get('/patient/file/list', FileListAction::class); + $group->post('/patient/file/download', FileDownloadAction::class); + $group->post('/patient/tracking', UserTrackAction::class); + $group->get('/patient/tracking/list', UserTrackListAction::class); + $group->get('/patient/calendar', UserCalendarAction::class); + $group->get('/patient/drug/list', ListPharmPatientMobAction::class); + $group->get('/patient/drug/delete/{id}', DeletePharmAction::class); + $group->post('/patient/drug/add', AddPharmAction::class); + $group->get('/patient/account/delete', UserDeleteAction::class); + $group->get('/patient/account/download', UserDownloadAction::class); + $group->post('/obiettivi/add', AddObjectiveAction::class); + $group->post('/obiettivi/delete', DeleteObjectiveAction::class); + $group->post('/obiettivi/update', UpdateObjectiveAction::class); + $group->get('/obiettivi/list', ListObjectiveAction::class); + $group->get('/patient/report/pills', ReportGenAction::class); + $group->post('/patient/report/mood', ReportMoodGenAction::class); + $group->post('/patient/test/comportamento', BehaviourTestAction::class); + $group->get('/patient/test/comportamento', ListBehaviourTestAction::class); + $group->post('/patient/test/emozioni', EmotionsTestAction::class); + $group->get('/patient/test/emozioni', ListEmotionsTestAction::class); + $group->post('/patient/health/passi', AddStepsAction::class); + $group->post('/patient/test/phq', Phq9TestAction::class); + $group->get('/patient/test/phq', ListPhq9TestAction::class); + $group->post('/register/notification', RegisterNotificationAction::class); + })->add(JwtAuthMiddleware::class); + + + /** + * WARNING ! + * DO NOT remove the following lines. + * Those lines resolve the problem on the app + * for the PRE-FLIGHT problem. + * @note To each new endpoint (get or post) must be created + * also here in OPTIONS mode. + */ + $app->options('/mobile/api/mood', CORSAction::class); + $app->options('/mobile/api/mood/delete/{mood_id}', CORSAction::class); + $app->options('/mobile/api/last_10_mood', CORSAction::class); + $app->options('/mobile/api/last_10_mood/graph', CORSAction::class); + $app->options('/register_paz', CORSAction::class); + $app->options('/user_login', CORSAction::class); + $app->options('/mobile/api/patient/update', CORSAction::class); + $app->options('/mobile/api/patient/update/address', CORSAction::class); + $app->options('/mobile/api/invite/doctor', CORSAction::class); + $app->options('/mobile/api/patient/my_doctor', CORSAction::class); + $app->options('/mobile/api/patient/scollega_doc', CORSAction::class); + $app->options('/mobile/api/patient/delete_account', CORSAction::class); + $app->options('/mobile/api/drugs/list', CORSAction::class); + $app->options('/mobile/api/drugs/list/search/{drug_name}', CORSAction::class); + $app->options('/mobile/api/patient/diary', CORSAction::class); + $app->options('/mobile/api/patient/diary/delete/{diary_id}', CORSAction::class); + $app->options('/mobile/api/patient/file/upload', CORSAction::class); + $app->options('/mobile/api/patient/file/list', CORSAction::class); + $app->options('/mobile/api/patient/file/download', CORSAction::class); + $app->options('/mobile/api/patient/tracking', CORSAction::class); + $app->options('/mobile/api/patient/tracking/list', CORSAction::class); + $app->options('/mobile/api/patient/calendar', CORSAction::class); + $app->options('/mobile/api/patient/drug/list', CORSAction::class); + $app->options('/mobile/api/patient/drug/delete/{id}', CORSAction::class); + $app->options('/mobile/api/patient/drug/add', CORSAction::class); + $app->options('/mobile/api/patient/account/delete', CORSAction::class); + $app->options('/mobile/api/patient/account/download', CORSAction::class); + $app->options('/mobile/api/obiettivi/add', CORSAction::class); + $app->options('/mobile/api/obiettivi/delete', CORSAction::class); + $app->options('/mobile/api/obiettivi/update', CORSAction::class); + $app->options('/mobile/api/obiettivi/list', CORSAction::class); + $app->options('/mobile/api/patient/report/pills', CORSAction::class); + $app->options('/mobile/api/patient/report/mood', CORSAction::class); + $app->options('/mobile/api/patient/test/comportamento', CORSAction::class); + $app->options('/mobile/api/patient/test/emozioni', CORSAction::class); + $app->options('/mobile/api/patient/health/passi', CORSAction::class); + $app->options('/mobile/api/patient/test/phq', CORSAction::class); + $app->options('/mobile/api/register/notification', CORSAction::class); }; diff --git a/resources/text/en_US/LC_MESSAGES/messages_en_US.po b/resources/text/en_US/LC_MESSAGES/messages_en_US.po index d968fe8..ead7f54 100644 --- a/resources/text/en_US/LC_MESSAGES/messages_en_US.po +++ b/resources/text/en_US/LC_MESSAGES/messages_en_US.po @@ -916,7 +916,7 @@ msgid "" msgstr "Error while sending mail. if you wrote it right contact Mental Space" #: src/Domain/Consulti/Repository/ConsultiRepository.php:126 -msgid "Richiesta consulto inviata correttamente" +msgid "Richiesta consult inviata correttamente" msgstr "Medical Consultation request sent successfull" #: src/Domain/Patients/Repository/PatientsRepository.php:103 diff --git a/src/Action/Auth/DocLoginSubmitAction.php b/src/Action/Auth/DocLoginSubmitAction.php index 1d93bad..f8a6f47 100644 --- a/src/Action/Auth/DocLoginSubmitAction.php +++ b/src/Action/Auth/DocLoginSubmitAction.php @@ -53,9 +53,9 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res $username = (string)($data['username'] ?? ''); $password = (string)($data['password'] ?? ''); $role = (string)($data['role'] ?? ''); -// Pseudo example -// Check user credentials. You may use an application/domain service and the database here. $user = null; + $userData = $this->userAuth->authenticate($username, $password, $role); + // Clear all flash messages $flash = $this->session->getFlash(); $flash->clear(); diff --git a/src/Action/Auth/UserLoginSubmitAction.php b/src/Action/Auth/UserLoginSubmitAction.php index 8f56e70..dacd39c 100644 --- a/src/Action/Auth/UserLoginSubmitAction.php +++ b/src/Action/Auth/UserLoginSubmitAction.php @@ -58,8 +58,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res $username = (string)($data['username'] ?? ''); $password = (string)($data['password'] ?? ''); $role = (string)($data['role'] ?? ''); -// Pseudo example -// Check user credentials. You may use an application/domain service and the database here. $user = null; + $userData = $this->userAuth->authenticate_paz($username, $password, $role); // Clear all flash messages $flash = $this->session->getFlash(); @@ -82,21 +81,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res $flash->add('success', 'Login successfully'); set_language($userData['locale']); - /* - * $tokenBuilder = (new Builder(new JoseEncoder(), ChainedFormatter::default())); - $algorithm = new Sha256(); - $signingKey = getenv('JWT_SECRET'); - $now = new \DateTimeImmutable(); - $token = $tokenBuilder - ->issuedBy('https://app.mentalspace.com') - ->permittedFor('http://localhost:8100') - ->identifiedBy($userData['user_id']) - ->expiresAt($now->modify('+15 DAY')) - ->withClaim('uid',$userData['user_id']) - ->withClaim('email', $userData['email']) - ->getToken($algorithm, $signingKey); - */ $token = $this->jwtAuth->createJwt( [ 'uid' => $userData['user_id'], diff --git a/src/Action/Cities/ListCitiesAction.php b/src/Action/Cities/ListCitiesAction.php index d0c790a..554b8eb 100644 --- a/src/Action/Cities/ListCitiesAction.php +++ b/src/Action/Cities/ListCitiesAction.php @@ -41,7 +41,7 @@ public function __construct(CitesList $citiesList, Responder $responder) */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { - // Optional: Pass parameters from the request to the findUsers method + $gh = $this->citiesList->listCities(); return $this->responder->withJson($response, $gh); diff --git a/src/Action/Consulti/GeneraLinkConsultoAction.php b/src/Action/Consulti/GenerateConsultLinkAction.php similarity index 82% rename from src/Action/Consulti/GeneraLinkConsultoAction.php rename to src/Action/Consulti/GenerateConsultLinkAction.php index 4f3de06..4f16d6c 100644 --- a/src/Action/Consulti/GeneraLinkConsultoAction.php +++ b/src/Action/Consulti/GenerateConsultLinkAction.php @@ -5,19 +5,19 @@ namespace App\Action\Consulti; -use App\Domain\Consulti\Repository\ConsultiRepository; +use App\Domain\Consulti\Repository\ConsultRepository; use App\Responder\Responder; use Fig\Http\Message\StatusCodeInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -final class GeneraLinkConsultoAction +final class GenerateConsultLinkAction { private Responder $responder; - private ConsultiRepository $consultiRepository; + private ConsultRepository $consultiRepository; - function __construct(Responder $responder, ConsultiRepository $consultiRepository) + function __construct(Responder $responder, ConsultRepository $consultiRepository) { $this->responder = $responder; $this->consultiRepository = $consultiRepository; @@ -38,7 +38,7 @@ public function __invoke( if (!filter_var($data['email'], FILTER_VALIDATE_EMAIL)) { return $this->responder - ->withJson($response, ['status' => 'error', 'message' => __('Indirizzo E-Mail non corretto')]) + ->withJson($response, ['status' => 'error', 'message' => __('E-Mail Address is not correct')]) ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } diff --git a/src/Action/Consulti/ListLinkConsultoAction.php b/src/Action/Consulti/ListConsultLinkAction.php similarity index 81% rename from src/Action/Consulti/ListLinkConsultoAction.php rename to src/Action/Consulti/ListConsultLinkAction.php index 38f889b..45e5f20 100644 --- a/src/Action/Consulti/ListLinkConsultoAction.php +++ b/src/Action/Consulti/ListConsultLinkAction.php @@ -5,19 +5,19 @@ namespace App\Action\Consulti; -use App\Domain\Consulti\Repository\ConsultiRepository; +use App\Domain\Consulti\Repository\ConsultRepository; use App\Responder\Responder; use Fig\Http\Message\StatusCodeInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -final class ListLinkConsultoAction +final class ListConsultLinkAction { private Responder $responder; - private ConsultiRepository $consultiRepository; + private ConsultRepository $consultiRepository; - function __construct(Responder $responder, ConsultiRepository $consultiRepository) + function __construct(Responder $responder, ConsultRepository $consultiRepository) { $this->responder = $responder; $this->consultiRepository = $consultiRepository; diff --git a/src/Action/Consulti/PinCodeActionCheck.php b/src/Action/Consulti/PinCodeActionCheck.php index c8f254c..4c1d989 100644 --- a/src/Action/Consulti/PinCodeActionCheck.php +++ b/src/Action/Consulti/PinCodeActionCheck.php @@ -5,7 +5,7 @@ namespace App\Action\Consulti; -use App\Domain\Consulti\Repository\ConsultiRepository; +use App\Domain\Consulti\Repository\ConsultRepository; use App\Responder\Responder; use Fig\Http\Message\StatusCodeInterface; use Psr\Http\Message\ResponseInterface; @@ -15,9 +15,9 @@ final class PinCodeActionCheck { private Responder $responder; - private ConsultiRepository $consultiRepository; + private ConsultRepository $consultiRepository; - function __construct(Responder $responder, ConsultiRepository $consultiRepository) + function __construct(Responder $responder, ConsultRepository $consultiRepository) { $this->responder = $responder; $this->consultiRepository = $consultiRepository; diff --git a/src/Action/Diary/DeleteDiaryAction.php b/src/Action/Diary/DeleteDiaryAction.php index 99dc1cb..4967d4e 100644 --- a/src/Action/Diary/DeleteDiaryAction.php +++ b/src/Action/Diary/DeleteDiaryAction.php @@ -51,7 +51,7 @@ public function __invoke( } return $this->responder - ->withJson($response, ['status' => 'success', 'message' => __("Eliminato con successo")]) + ->withJson($response, ['status' => 'success', 'message' => __("Deleted")]) ->withStatus(StatusCodeInterface::STATUS_OK); } } diff --git a/src/Action/Diary/UploadDiaryAction.php b/src/Action/Diary/UploadDiaryAction.php index 79a3297..d75d3bb 100644 --- a/src/Action/Diary/UploadDiaryAction.php +++ b/src/Action/Diary/UploadDiaryAction.php @@ -44,13 +44,13 @@ public function __invoke( $entry = $this->repository->addEntry($user_id, $data); if ($entry) { return $this->responder - ->withJson($response, ['status' => 'success', 'message' => __('Inserito con Successo')]) + ->withJson($response, ['status' => 'success', 'message' => __('Success')]) ->withStatus(StatusCodeInterface::STATUS_OK); } return $this->responder - ->withJson($response, ['status' => 'error', 'message' => __('Errore')]) + ->withJson($response, ['status' => 'error', 'message' => __('Error')]) ->withStatus(StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR); } } diff --git a/src/Action/Doctors/DocDetailAppAction.php b/src/Action/Doctors/DocDetailAppAction.php index 4dff430..1e149a7 100644 --- a/src/Action/Doctors/DocDetailAppAction.php +++ b/src/Action/Doctors/DocDetailAppAction.php @@ -37,7 +37,7 @@ public function __invoke( ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } - $docData = $this->doctorRepository->AppdoctorDetail($userId); + $docData = $this->doctorRepository->AppDoctorDetail($userId); if (empty($docData)) { return $this->responder diff --git a/src/Action/Doctors/InviteDoctorAction.php b/src/Action/Doctors/InviteDoctorAction.php index 04f7540..be070f6 100644 --- a/src/Action/Doctors/InviteDoctorAction.php +++ b/src/Action/Doctors/InviteDoctorAction.php @@ -9,6 +9,7 @@ use App\Domain\Patients\Repository\PatientsRepository; use App\Domain\Users\Repository\UserRepository; use App\Responder\Responder; +use Exception; use Fig\Http\Message\StatusCodeInterface; use PHPMailer\PHPMailer\PHPMailer; use Psr\Http\Message\ResponseInterface; @@ -74,14 +75,14 @@ public function __invoke( //Content $mail->isHTML(true); //Set email format to HTML - $mail->Subject = 'Invito a partecipare a Mental Space'; + $mail->Subject = __('Invite to enter in Mental Space'); $mail_body = file_get_contents(__DIR__ . '/../../../data/mail_template/doctor_invitation'); $search = ['{{PAZ_NOME}}', '{{PAZ_COGNOME}}', '{{PAZ_EMAIL}}', '{{PAZ_USER_ID}}' ]; $replace = [$userData['name'], $userData['surname'], $userData['email'], $userData['user_id']]; $mail_body = str_replace($search, $replace, $mail_body); $mail->Body = $mail_body; $mail->send(); - } catch (\Exception $e) { + } catch (Exception $e) { return $this->responder ->withJson($response, ['status' => 'error', 'messsage' => $e->getMessage()]) ->withStatus(StatusCodeInterface::STATUS_OK); @@ -110,14 +111,14 @@ public function __invoke( //Content $mail->isHTML(true); //Set email format to HTML - $mail->Subject = 'Un Nuovo Assistito per te!'; + $mail->Subject = __('A new Patient for you !'); $mail_body = file_get_contents(__DIR__ . '/../../../data/mail_template/patient_assigned'); $search = ["{{PAZ_NOME}}", '{{PAZ_COGNOME}}', '{{DOC_NOME}}', '{{DOC_COGNOME}}']; $replace = [$userData['name'], $userData['surname']. $docData['doc_name'], $docData['doc_surname']]; $mail_body = str_replace($search, $replace, $mail_body); $mail->Body = $mail_body; $mail->send(); - } catch (\Exception $e) { + } catch (Exception $e) { return $this->responder ->withJson($response, ['status' => 'error', 'messsage' => $e->getMessage()]) ->withStatus(StatusCodeInterface::STATUS_OK); @@ -128,7 +129,7 @@ public function __invoke( ->withStatus(StatusCodeInterface::STATUS_OK); } else { return $this->responder - ->withJson($response, ['status' => 'error', 'message' => 'Errore durante assegnazione medico']) + ->withJson($response, ['status' => 'error', 'message' => __('Error while assigning doctor')]) ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } } diff --git a/src/Action/Dsm/ListDsmAction.php b/src/Action/Dsm/ListDsmAction.php index e70252e..ab38558 100644 --- a/src/Action/Dsm/ListDsmAction.php +++ b/src/Action/Dsm/ListDsmAction.php @@ -23,7 +23,7 @@ final class ListDsmAction /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param DsmList $citiesList The dsm list viewer * @param Responder $responder The responder */ public function __construct(DsmList $dsmList, Responder $responder) diff --git a/src/Action/Files/DocFileDeleteAction.php b/src/Action/Files/DocFileDeleteAction.php index 2580be3..d704a39 100644 --- a/src/Action/Files/DocFileDeleteAction.php +++ b/src/Action/Files/DocFileDeleteAction.php @@ -43,14 +43,14 @@ public function __invoke( if (!is_file($file_path)) { return $this->responder - ->withJson($response, ['status' => 'success', 'message' => __("File non trovato")]) + ->withJson($response, ['status' => 'success', 'message' => __("File not found")]) ->withStatus(StatusCodeInterface::STATUS_OK); } unlink($file_path); return $this->responder - ->withJson($response, ['status' => 'error', 'message' => __("File Cancellato con sucesso")]) + ->withJson($response, ['status' => 'error', 'message' => __("File Deleted")]) ->withStatus(StatusCodeInterface::STATUS_OK); } diff --git a/src/Action/Files/DocFileDownloadAction.php b/src/Action/Files/DocFileDownloadAction.php index 644d2b6..066085b 100644 --- a/src/Action/Files/DocFileDownloadAction.php +++ b/src/Action/Files/DocFileDownloadAction.php @@ -10,6 +10,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\UploadedFileInterface; +use Slim\Psr7\Stream; final class DocFileDownloadAction { @@ -42,7 +43,7 @@ public function __invoke( if (!is_file($filePath)) { return $this->responder - ->withJson($response, ['status' => 'success', 'message'=>__('File non trovato')]) + ->withJson($response, ['status' => 'success', 'message' => __('File not found')]) ->withStatus(StatusCodeInterface::STATUS_OK); } @@ -52,6 +53,6 @@ public function __invoke( ->withAddedHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') ->withHeader('Cache-Control', 'post-check=0, pre-check=0') ->withHeader('Pragma', 'no-cache') - ->withBody((new \Slim\Psr7\Stream(fopen($filePath, 'rb')))); + ->withBody((new Stream(fopen($filePath, 'rb')))); } } diff --git a/src/Action/Files/DocFileListAction.php b/src/Action/Files/DocFileListAction.php index 5e39aca..fa7db44 100644 --- a/src/Action/Files/DocFileListAction.php +++ b/src/Action/Files/DocFileListAction.php @@ -42,11 +42,11 @@ public function __invoke( ->withStatus(StatusCodeInterface::STATUS_OK); } - $listaFiles = scandir($directory); - $listaFiles = array_diff($listaFiles, ['.', '..']); + $filesList = scandir($directory); + $filesList = array_diff($filesList, ['.', '..']); return $this->responder - ->withJson($response, ['status' => 'success', 'files' => $listaFiles]) + ->withJson($response, ['status' => 'success', 'files' => $filesList]) ->withStatus(StatusCodeInterface::STATUS_OK); } diff --git a/src/Action/Files/DocFileUploadAction.php b/src/Action/Files/DocFileUploadAction.php index 514918a..ad3b421 100644 --- a/src/Action/Files/DocFileUploadAction.php +++ b/src/Action/Files/DocFileUploadAction.php @@ -40,7 +40,7 @@ public function __invoke( if (!$uploadedFiles) { return $this->responder - ->withJson($response, ['status' => 'error', 'message' => __("Hai dimenticato di inviare file")]) + ->withJson($response, ['status' => 'error', 'message' => __("Forgot to send the file ?")]) ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } @@ -55,15 +55,16 @@ public function __invoke( if ($uploadedFile->getError() === UPLOAD_ERR_OK) { $filename = $this->moveUploadedFile($directory, $uploadedFile); return $this->responder - ->withJson($response, ['status' => 'success', 'message' => __("Caricato con successo")]) + ->withJson($response, ['status' => 'success', 'message' => __("Uploaded")]) ->withStatus(StatusCodeInterface::STATUS_OK); } return $this->responder - ->withJson($response, ['status' => 'error', 'message' => __("Qualcosa è andato storto")]) + ->withJson($response, ['status' => 'error', 'message' => __("Something went wrong")]) ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } + // @todo move this function in src/Support/functions.php and eliminate the duplicates private function moveUploadedFile(string $directory, UploadedFileInterface $uploadedFile) { $extension = pathinfo($uploadedFile->getClientFilename(), PATHINFO_EXTENSION); diff --git a/src/Action/Files/FileDownloadAction.php b/src/Action/Files/FileDownloadAction.php index 45f4e75..0149459 100644 --- a/src/Action/Files/FileDownloadAction.php +++ b/src/Action/Files/FileDownloadAction.php @@ -10,6 +10,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\UploadedFileInterface; +use Slim\Psr7\Stream; final class FileDownloadAction { @@ -42,7 +43,7 @@ public function __invoke( if (!is_file($filePath)) { return $this->responder - ->withJson($response, ['status' => 'success', 'message'=>__('File non trovato')]) + ->withJson($response, ['status' => 'success', 'message' => __('File not found')]) ->withStatus(StatusCodeInterface::STATUS_OK); } @@ -52,6 +53,6 @@ public function __invoke( ->withAddedHeader('Cache-Control', 'no-store, no-cache, must-revalidate, max-age=0') ->withHeader('Cache-Control', 'post-check=0, pre-check=0') ->withHeader('Pragma', 'no-cache') - ->withBody((new \Slim\Psr7\Stream(fopen($filePath, 'rb')))); + ->withBody((new Stream(fopen($filePath, 'rb')))); } } diff --git a/src/Action/Files/FileUploadAction.php b/src/Action/Files/FileUploadAction.php index 5d3dabe..650e3a5 100644 --- a/src/Action/Files/FileUploadAction.php +++ b/src/Action/Files/FileUploadAction.php @@ -38,7 +38,7 @@ public function __invoke( if (!$uploadedFiles) { return $this->responder - ->withJson($response, ['status' => 'error', 'message' => __("Hai dimenticato di inviare file")]) + ->withJson($response, ['status' => 'error', 'message' => __("Forgot to attach files ?")]) ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } @@ -53,12 +53,12 @@ public function __invoke( if ($uploadedFile->getError() === UPLOAD_ERR_OK) { $filename = $this->moveUploadedFile($directory, $uploadedFile); return $this->responder - ->withJson($response, ['status' => 'success', 'message' => __("Caricato con successo")]) + ->withJson($response, ['status' => 'success', 'message' => __("Uploaded")]) ->withStatus(StatusCodeInterface::STATUS_OK); } return $this->responder - ->withJson($response, ['status' => 'error', 'message' => __("Qualcosa è andato storto")]) + ->withJson($response, ['status' => 'error', 'message' => __("Something went wrong")]) ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } diff --git a/src/Action/Health/AddPassiAction.php b/src/Action/Health/AddStepsAction.php similarity index 96% rename from src/Action/Health/AddPassiAction.php rename to src/Action/Health/AddStepsAction.php index 6311d63..fe5948b 100644 --- a/src/Action/Health/AddPassiAction.php +++ b/src/Action/Health/AddStepsAction.php @@ -13,7 +13,7 @@ /** * Action. */ -final class AddPassiAction +final class AddStepsAction { private HealthRepository $health; @@ -42,7 +42,7 @@ public function __construct(HealthRepository $health, Responder $responder) public function __invoke(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { $data = $request->getParsedBody(); - $gh = $this->health->aggiungiPassi($request->getAttribute('uid'), $data['passi']); + $gh = $this->health->aggiungiPassi($request->getAttribute('uid'), $data['steps']); if ($gh) { $result = ['status' => 'success']; diff --git a/src/Action/Messages/ListContactsAction.php b/src/Action/Messages/ListContactsAction.php index 0a02175..7ee743c 100644 --- a/src/Action/Messages/ListContactsAction.php +++ b/src/Action/Messages/ListContactsAction.php @@ -50,7 +50,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res * This could also be done within a specific Responder class. * * @param ResponseInterface $response The response - * @param array $users The users + * @param array $sbs Dont remember * * @return ResponseInterface The response */ diff --git a/src/Action/Moods/ListMoodAction.php b/src/Action/Moods/ListMoodAction.php index 47959ff..3cd15f0 100644 --- a/src/Action/Moods/ListMoodAction.php +++ b/src/Action/Moods/ListMoodAction.php @@ -38,7 +38,7 @@ public function __invoke( - $mood = $this->repository->ultimi10mood($user_id); + $mood = $this->repository->last10mood($user_id); return $this->responder ->withJson($response, $mood) diff --git a/src/Action/Moods/ListMoodGraphAction.php b/src/Action/Moods/ListMoodGraphAction.php index acd6792..582813d 100644 --- a/src/Action/Moods/ListMoodGraphAction.php +++ b/src/Action/Moods/ListMoodGraphAction.php @@ -38,7 +38,7 @@ public function __invoke( - $mood = $this->repository->ultimi10moodGraph($user_id); + $mood = $this->repository->last10moodGraph($user_id); return $this->responder ->withJson($response, $mood) diff --git a/src/Action/Obiettivi/AddObiettivoAction.php b/src/Action/Obiettivi/AddObjectiveAction.php similarity index 72% rename from src/Action/Obiettivi/AddObiettivoAction.php rename to src/Action/Obiettivi/AddObjectiveAction.php index 126f905..ff38fa0 100644 --- a/src/Action/Obiettivi/AddObiettivoAction.php +++ b/src/Action/Obiettivi/AddObjectiveAction.php @@ -5,7 +5,7 @@ namespace App\Action\Obiettivi; -use App\Domain\Obiettivi\Repository\ObiettiviRepository; +use App\Domain\Obiettivi\Repository\ObjectiveRepository; use App\Responder\Responder; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -13,18 +13,18 @@ /** * Action. */ -final class AddObiettivoAction +final class AddObjectiveAction { - private ObiettiviRepository $obiettiviRepository; + private ObjectiveRepository $objectiveRepository; private Responder $responder; /** - * @param ObiettiviRepository $obiettiviRepository + * @param ObjectiveRepository $obiettiviRepository * @param Responder $responder */ - public function __construct(ObiettiviRepository $obiettiviRepository, Responder $responder) + public function __construct(ObjectiveRepository $obiettiviRepository, Responder $responder) { - $this->obiettiviRepository = $obiettiviRepository; + $this->objectiveRepository = $obiettiviRepository; $this->responder = $responder; } @@ -39,7 +39,7 @@ public function __construct(ObiettiviRepository $obiettiviRepository, Responder public function __invoke(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { $data = $request->getParsedBody(); - $q = $this->obiettiviRepository->addObjective($data, $request->getAttribute('uid')); + $q = $this->objectiveRepository->addObjective($data, $request->getAttribute('uid')); if (!$q) { $status = "error"; diff --git a/src/Action/Obiettivi/DeleteObiettivoAction.php b/src/Action/Obiettivi/DeleteObjectiveAction.php similarity index 81% rename from src/Action/Obiettivi/DeleteObiettivoAction.php rename to src/Action/Obiettivi/DeleteObjectiveAction.php index 2f726ec..5953fb3 100644 --- a/src/Action/Obiettivi/DeleteObiettivoAction.php +++ b/src/Action/Obiettivi/DeleteObjectiveAction.php @@ -5,7 +5,7 @@ namespace App\Action\Obiettivi; -use App\Domain\Obiettivi\Repository\ObiettiviRepository; +use App\Domain\Obiettivi\Repository\ObjectiveRepository; use App\Responder\Responder; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -13,9 +13,9 @@ /** * Action. */ -final class DeleteObiettivoAction +final class DeleteObjectiveAction { - private ObiettiviRepository $obiettiviRepository; + private ObjectiveRepository $obiettiviRepository; private Responder $responder; @@ -25,9 +25,9 @@ final class DeleteObiettivoAction * @param CitiesList $citiesList The user index list viewer * @param Responder $responder The responder */ - public function __construct(ObiettiviRepository $obiettiviRepository, Responder $responder) + public function __construct(ObjectiveRepository $objectiveRepository, Responder $responder) { - $this->obiettiviRepository = $obiettiviRepository; + $this->obiettiviRepository = $objectiveRepository; $this->responder = $responder; } diff --git a/src/Action/Obiettivi/ListObiettivoAction.php b/src/Action/Obiettivi/ListObjectiveAction.php similarity index 80% rename from src/Action/Obiettivi/ListObiettivoAction.php rename to src/Action/Obiettivi/ListObjectiveAction.php index 43474b9..b5c32cd 100644 --- a/src/Action/Obiettivi/ListObiettivoAction.php +++ b/src/Action/Obiettivi/ListObjectiveAction.php @@ -5,7 +5,7 @@ namespace App\Action\Obiettivi; -use App\Domain\Obiettivi\Repository\ObiettiviRepository; +use App\Domain\Obiettivi\Repository\ObjectiveRepository; use App\Responder\Responder; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -13,9 +13,9 @@ /** * Action. */ -final class ListObiettivoAction +final class ListObjectiveAction { - private ObiettiviRepository $obiettiviRepository; + private ObjectiveRepository $obiettiviRepository; /** * The constructor. @@ -23,9 +23,9 @@ final class ListObiettivoAction * @param CitiesList $citiesList The user index list viewer * @param Responder $responder The responder */ - public function __construct(ObiettiviRepository $obiettiviRepository, Responder $responder) + public function __construct(ObjectiveRepository $objectiveRepository, Responder $responder) { - $this->obiettiviRepository = $obiettiviRepository; + $this->obiettiviRepository = $objectiveRepository; $this->responder = $responder; } diff --git a/src/Action/Obiettivi/UpdateObiettivoAction.php b/src/Action/Obiettivi/UpdateObjectiveAction.php similarity index 74% rename from src/Action/Obiettivi/UpdateObiettivoAction.php rename to src/Action/Obiettivi/UpdateObjectiveAction.php index b0cc9c1..1ae89f3 100644 --- a/src/Action/Obiettivi/UpdateObiettivoAction.php +++ b/src/Action/Obiettivi/UpdateObjectiveAction.php @@ -5,7 +5,7 @@ namespace App\Action\Obiettivi; -use App\Domain\Obiettivi\Repository\ObiettiviRepository; +use App\Domain\Obiettivi\Repository\ObjectiveRepository; use App\Responder\Responder; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; @@ -13,21 +13,21 @@ /** * Action. */ -final class UpdateObiettivoAction +final class UpdateObjectiveAction { - private ObiettiviRepository $obiettiviRepository; + private ObjectiveRepository $obiettiviRepository; private Responder $responder; /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param CitiesList $citiesList The cities list viewer * @param Responder $responder The responder */ - public function __construct(ObiettiviRepository $obiettiviRepository, Responder $responder) + public function __construct(ObjectiveRepository $objectiveRepository, Responder $responder) { - $this->obiettiviRepository = $obiettiviRepository; + $this->obiettiviRepository = $objectiveRepository; $this->responder = $responder; } @@ -44,7 +44,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res $uid = $request->getAttribute('uid'); $data = $request->getParsedBody(); // Optional: Pass parameters from the request to the findUsers method - $gh = $this->obiettiviRepository->updateObjective($data['ob_id'], $data['obiettivo'], $uid); + $gh = $this->obiettiviRepository->updateObjective($data['ob_id'], $data['objective'], $uid); return $this->responder->withJson($response, $gh); } diff --git a/src/Action/Pages/ConsultoPageAction.php b/src/Action/Pages/ConsultoPageAction.php index 379eb13..70757fc 100644 --- a/src/Action/Pages/ConsultoPageAction.php +++ b/src/Action/Pages/ConsultoPageAction.php @@ -2,7 +2,7 @@ namespace App\Action\Pages; -use App\Domain\Consulti\Repository\ConsultiRepository; +use App\Domain\Consulti\Repository\ConsultRepository; use App\Domain\Patients\Repository\PatientsRepository; use App\Domain\Reports\Repository\ReportRepository; use App\Domain\Tests\Repository\TestsRepository; @@ -20,7 +20,7 @@ final class ConsultoPageAction private $reportRepository; private $testRepository; - public function __construct(PhpRenderer $renderer, PatientsRepository $repository, ConsultiRepository $consultiRepository, ReportRepository $reportRepository, TestsRepository $testsRepository) + public function __construct(PhpRenderer $renderer, PatientsRepository $repository, ConsultRepository $consultiRepository, ReportRepository $reportRepository, TestsRepository $testsRepository) { $this->renderer = $renderer; $this->repository = $repository; @@ -36,7 +36,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res return $this->renderer->render($response, 'errors/not_found.php'); } - $this->renderer->setLayout('layout/consulto.php'); + $this->renderer->setLayout('layout/consult.php'); $this->renderer->addAttribute('css', [ '/app-assets/vendors/css/forms/select/select2.min.css', @@ -78,7 +78,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res '/app-assets/js/scripts/pages/patient-detail.js', '/app-assets/js/scripts/components/components-popovers.js', '/app-assets/js/scripts/components/mutation.js', - '/app-assets/js/scripts/pages/consulto.js', + '/app-assets/js/scripts/pages/consult.js', ]); @@ -199,7 +199,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res $li .= $this->convertResultPhq($val['result']) . "

"; } - $comportamentiImpulsivi = $this->testRepository->listComportamentoTest($uid); + $comportamentiImpulsivi = $this->testRepository->listBehaviourTest($uid); $cmp = ""; foreach ($comportamentiImpulsivi as $key => $val) { foreach ($val as $a => $b) { @@ -210,7 +210,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res $cmp .= "
"; } - return $this->renderer->render($response, 'consulto/home.php', [ + return $this->renderer->render($response, 'consult/home.php', [ 'patient' => $patientData[0], 'diario' => empty($diario) ? 'Non ha scritto nulla negli ultimi 7 giorni':$diario, 'lista_farmaci' => $farmaci, diff --git a/src/Action/Patients/AddAnnotationPatientAction.php b/src/Action/Patients/AddAnnotationPatientAction.php index f3c80ed..caad614 100644 --- a/src/Action/Patients/AddAnnotationPatientAction.php +++ b/src/Action/Patients/AddAnnotationPatientAction.php @@ -22,7 +22,7 @@ final class AddAnnotationPatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The patient list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/AddPatientAction.php b/src/Action/Patients/AddPatientAction.php index d4556de..f469439 100644 --- a/src/Action/Patients/AddPatientAction.php +++ b/src/Action/Patients/AddPatientAction.php @@ -17,9 +17,9 @@ final class AddPatientAction private PatientsAdd $creator; private Responder $responder; - function __construct(PatientsAdd $smartboxAdd, Responder $responder) + function __construct(PatientsAdd $patientsAdd, Responder $responder) { - $this->creator = $smartboxAdd; + $this->creator = $patientsAdd; $this->responder = $responder; } diff --git a/src/Action/Patients/DeleteAnnotationPatientAction.php b/src/Action/Patients/DeleteAnnotationPatientAction.php index 4fee962..35af3a2 100644 --- a/src/Action/Patients/DeleteAnnotationPatientAction.php +++ b/src/Action/Patients/DeleteAnnotationPatientAction.php @@ -22,7 +22,7 @@ final class DeleteAnnotationPatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The user index list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/List10MoodPatientAction.php b/src/Action/Patients/List10MoodPatientAction.php index 9a36357..88574e5 100644 --- a/src/Action/Patients/List10MoodPatientAction.php +++ b/src/Action/Patients/List10MoodPatientAction.php @@ -22,7 +22,7 @@ final class List10MoodPatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The patient list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/ListAllDeprePatientAction.php b/src/Action/Patients/ListAllDeprePatientAction.php index 31caea0..929c3ae 100644 --- a/src/Action/Patients/ListAllDeprePatientAction.php +++ b/src/Action/Patients/ListAllDeprePatientAction.php @@ -22,7 +22,7 @@ final class ListAllDeprePatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The user index list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/ListAllMoodPatientAction.php b/src/Action/Patients/ListAllMoodPatientAction.php index 4f2db76..f15f163 100644 --- a/src/Action/Patients/ListAllMoodPatientAction.php +++ b/src/Action/Patients/ListAllMoodPatientAction.php @@ -22,7 +22,7 @@ final class ListAllMoodPatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The user index list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/ListAnnotationPatientAction.php b/src/Action/Patients/ListAnnotationPatientAction.php index c2e97af..253e314 100644 --- a/src/Action/Patients/ListAnnotationPatientAction.php +++ b/src/Action/Patients/ListAnnotationPatientAction.php @@ -22,7 +22,7 @@ final class ListAnnotationPatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The user index list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/ListDiaryPatientAction.php b/src/Action/Patients/ListDiaryPatientAction.php index 38e8021..30400d7 100644 --- a/src/Action/Patients/ListDiaryPatientAction.php +++ b/src/Action/Patients/ListDiaryPatientAction.php @@ -22,7 +22,7 @@ final class ListDiaryPatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The user index list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/ListPatAction.php b/src/Action/Patients/ListPatAction.php index 6bbb9a0..d4a0809 100644 --- a/src/Action/Patients/ListPatAction.php +++ b/src/Action/Patients/ListPatAction.php @@ -22,7 +22,7 @@ final class ListPatAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The user index list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) @@ -52,7 +52,7 @@ public function __invoke(ServerRequestInterface $request, ResponseInterface $res * This could also be done within a specific Responder class. * * @param ResponseInterface $response The response - * @param array $users The users + * @param array $sbs I dont remember why i named this "sbs" * * @return ResponseInterface The response */ diff --git a/src/Action/Patients/ListPharmPatientAction.php b/src/Action/Patients/ListPharmPatientAction.php index b9cd074..0e59d75 100644 --- a/src/Action/Patients/ListPharmPatientAction.php +++ b/src/Action/Patients/ListPharmPatientAction.php @@ -22,7 +22,7 @@ final class ListPharmPatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The patient list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/ListPharmPatientMobAction.php b/src/Action/Patients/ListPharmPatientMobAction.php index 09f489a..ee1f514 100644 --- a/src/Action/Patients/ListPharmPatientMobAction.php +++ b/src/Action/Patients/ListPharmPatientMobAction.php @@ -22,7 +22,7 @@ final class ListPharmPatientMobAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The patient list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/LoadRelazionePatientAction.php b/src/Action/Patients/LoadPatientRelationAction.php similarity index 94% rename from src/Action/Patients/LoadRelazionePatientAction.php rename to src/Action/Patients/LoadPatientRelationAction.php index 9a7248c..9ba5ddc 100644 --- a/src/Action/Patients/LoadRelazionePatientAction.php +++ b/src/Action/Patients/LoadPatientRelationAction.php @@ -13,7 +13,7 @@ /** * Action. */ -final class LoadRelazionePatientAction +final class LoadPatientRelationAction { private PatientsList $patientsList; @@ -22,7 +22,7 @@ final class LoadRelazionePatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The patient list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/ReportSearchPatAction.php b/src/Action/Patients/ReportSearchPatAction.php index 5642a4f..1aa73e1 100644 --- a/src/Action/Patients/ReportSearchPatAction.php +++ b/src/Action/Patients/ReportSearchPatAction.php @@ -22,7 +22,7 @@ final class ReportSearchPatAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The patient list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/SalvaRelazionePatientAction.php b/src/Action/Patients/SavePatientRelationAction.php similarity index 94% rename from src/Action/Patients/SalvaRelazionePatientAction.php rename to src/Action/Patients/SavePatientRelationAction.php index 474e390..6b3b6b8 100644 --- a/src/Action/Patients/SalvaRelazionePatientAction.php +++ b/src/Action/Patients/SavePatientRelationAction.php @@ -13,7 +13,7 @@ /** * Action. */ -final class SalvaRelazionePatientAction +final class SavePatientRelationAction { private PatientsList $patientsList; @@ -22,7 +22,7 @@ final class SalvaRelazionePatientAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The patient list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/SearchPatAction.php b/src/Action/Patients/SearchPatAction.php index f2fbf1e..af198ae 100644 --- a/src/Action/Patients/SearchPatAction.php +++ b/src/Action/Patients/SearchPatAction.php @@ -22,7 +22,7 @@ final class SearchPatAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The user index list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Patients/SelectSearchPatAction.php b/src/Action/Patients/SelectSearchPatAction.php index 912136e..686265b 100644 --- a/src/Action/Patients/SelectSearchPatAction.php +++ b/src/Action/Patients/SelectSearchPatAction.php @@ -22,7 +22,7 @@ final class SelectSearchPatAction /** * The constructor. * - * @param PatientsList $smartboxList The user index list viewer + * @param PatientsList $patientsList The user index list viewer * @param Responder $responder The responder */ public function __construct(PatientsList $patientsList, Responder $responder) diff --git a/src/Action/Pharm/AddPharmAction.php b/src/Action/Pharm/AddPharmAction.php index 134f8c8..110a134 100644 --- a/src/Action/Pharm/AddPharmAction.php +++ b/src/Action/Pharm/AddPharmAction.php @@ -23,12 +23,12 @@ final class AddPharmAction /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param PharmList $pharmList The user index list viewer * @param Responder $responder The responder */ - public function __construct(PharmList $dsmList, Responder $responder) + public function __construct(PharmList $pharmList, Responder $responder) { - $this->dsmList = $dsmList; + $this->dsmList = $pharmList; $this->responder = $responder; } diff --git a/src/Action/Pharm/DeletePharmAction.php b/src/Action/Pharm/DeletePharmAction.php index 40e1552..e104ed6 100644 --- a/src/Action/Pharm/DeletePharmAction.php +++ b/src/Action/Pharm/DeletePharmAction.php @@ -23,12 +23,12 @@ final class DeletePharmAction /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param PharmList $pharmList The pharm list viewer * @param Responder $responder The responder */ - public function __construct(PharmList $dsmList, Responder $responder) + public function __construct(PharmList $pharmList, Responder $responder) { - $this->dsmList = $dsmList; + $this->dsmList = $pharmList; $this->responder = $responder; } diff --git a/src/Action/Pharm/ListPharmAction.php b/src/Action/Pharm/ListPharmAction.php index 97744a6..71944ec 100644 --- a/src/Action/Pharm/ListPharmAction.php +++ b/src/Action/Pharm/ListPharmAction.php @@ -23,12 +23,12 @@ final class ListPharmAction /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param PharmList $pharmList The user index list viewer * @param Responder $responder The responder */ - public function __construct(PharmList $dsmList, Responder $responder) + public function __construct(PharmList $pharmList, Responder $responder) { - $this->dsmList = $dsmList; + $this->dsmList = $pharmList; $this->responder = $responder; } diff --git a/src/Action/Pharm/ListPharmSelectAction.php b/src/Action/Pharm/ListPharmSelectAction.php index dcfaad4..cf4152f 100644 --- a/src/Action/Pharm/ListPharmSelectAction.php +++ b/src/Action/Pharm/ListPharmSelectAction.php @@ -23,12 +23,12 @@ final class ListPharmSelectAction /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param PharmList The pharm list viewer * @param Responder $responder The responder */ - public function __construct(PharmList $dsmList, Responder $responder) + public function __construct(PharmList $pharmList, Responder $responder) { - $this->dsmList = $dsmList; + $this->dsmList = $pharmList; $this->responder = $responder; } diff --git a/src/Action/Pharm/MobileListPharmAction.php b/src/Action/Pharm/MobileListPharmAction.php index d2b3a03..b892c53 100644 --- a/src/Action/Pharm/MobileListPharmAction.php +++ b/src/Action/Pharm/MobileListPharmAction.php @@ -23,12 +23,12 @@ final class MobileListPharmAction /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param PharmList $pharmList The user index list viewer * @param Responder $responder The responder */ - public function __construct(PharmList $dsmList, Responder $responder) + public function __construct(PharmList $pharmList, Responder $responder) { - $this->dsmList = $dsmList; + $this->dsmList = $pharmList; $this->responder = $responder; } diff --git a/src/Action/Pharm/SearchByNameAction.php b/src/Action/Pharm/SearchByNameAction.php index 66576c5..bbabc44 100644 --- a/src/Action/Pharm/SearchByNameAction.php +++ b/src/Action/Pharm/SearchByNameAction.php @@ -23,7 +23,7 @@ final class SearchByNameAction /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param PharmList $pharmList The user index list viewer * @param Responder $responder The responder */ public function __construct(PharmList $pharmList, Responder $responder) diff --git a/src/Action/Pharm/WebSearchByNameAction.php b/src/Action/Pharm/WebSearchByNameAction.php index 8b2712d..053cac1 100644 --- a/src/Action/Pharm/WebSearchByNameAction.php +++ b/src/Action/Pharm/WebSearchByNameAction.php @@ -23,7 +23,7 @@ final class WebSearchByNameAction /** * The constructor. * - * @param CitiesList $citiesList The user index list viewer + * @param PharmList $pharmList The user index list viewer * @param Responder $responder The responder */ public function __construct(PharmList $pharmList, Responder $responder) diff --git a/src/Action/Reports/EmozioniTestAction.php b/src/Action/Reports/BehaviourTestAction.php similarity index 78% rename from src/Action/Reports/EmozioniTestAction.php rename to src/Action/Reports/BehaviourTestAction.php index d873074..c7fde6a 100644 --- a/src/Action/Reports/EmozioniTestAction.php +++ b/src/Action/Reports/BehaviourTestAction.php @@ -9,10 +9,11 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -final class EmozioniTestAction +final class BehaviourTestAction { private Responder $responder; private TestsRepository $testsRepository; + function __construct(Responder $responder, TestsRepository $testsRepository, UserRepository $userRepository) { $this->testsRepository = $testsRepository; @@ -31,16 +32,17 @@ function __construct(Responder $responder, TestsRepository $testsRepository, Use public function __invoke( ServerRequestInterface $request, ResponseInterface $response - ): ResponseInterface { + ): ResponseInterface + { $uid = $request->getAttribute('uid'); $data = $request->getParsedBody(); $result = []; - if ($this->testsRepository->addEmozioneTest($uid, $data)) { - $result = ['status' => 'success', 'message' => 'Inviato con successo']; + if ($this->testsRepository->addBehaviourTest($uid, $data)) { + $result = ['status' => 'success', 'message' => 'Sent']; } else { - $result = ['status' => 'error', 'message' => 'Qualcosa è andato storto, riprova o contattaci']; + $result = ['status' => 'error', 'message' => 'Something went wrong']; } return $this->responder diff --git a/src/Action/Reports/ComportamentoTestAction.php b/src/Action/Reports/EmotionsTestAction.php similarity index 78% rename from src/Action/Reports/ComportamentoTestAction.php rename to src/Action/Reports/EmotionsTestAction.php index bd96518..7cc0e00 100644 --- a/src/Action/Reports/ComportamentoTestAction.php +++ b/src/Action/Reports/EmotionsTestAction.php @@ -9,10 +9,11 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -final class ComportamentoTestAction +final class EmotionsTestAction { private Responder $responder; private TestsRepository $testsRepository; + function __construct(Responder $responder, TestsRepository $testsRepository, UserRepository $userRepository) { $this->testsRepository = $testsRepository; @@ -31,16 +32,17 @@ function __construct(Responder $responder, TestsRepository $testsRepository, Use public function __invoke( ServerRequestInterface $request, ResponseInterface $response - ): ResponseInterface { + ): ResponseInterface + { $uid = $request->getAttribute('uid'); $data = $request->getParsedBody(); $result = []; - if ($this->testsRepository->addComportamentoTest($uid, $data)) { - $result = ['status' => 'success', 'message' => 'Inviato con successo']; + if ($this->testsRepository->addEmotionTest($uid, $data)) { + $result = ['status' => 'success', 'message' => 'Sent']; } else { - $result = ['status' => 'error', 'message' => 'Qualcosa è andato storto, riprova o contattaci']; + $result = ['status' => 'error', 'message' => 'Something went wrong']; } return $this->responder diff --git a/src/Action/Reports/ListComportamentoTestAction.php b/src/Action/Reports/ListBehaviourTestAction.php similarity index 91% rename from src/Action/Reports/ListComportamentoTestAction.php rename to src/Action/Reports/ListBehaviourTestAction.php index fb5dff8..93f4fb7 100644 --- a/src/Action/Reports/ListComportamentoTestAction.php +++ b/src/Action/Reports/ListBehaviourTestAction.php @@ -9,10 +9,11 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -final class ListComportamentoTestAction +final class ListBehaviourTestAction { private Responder $responder; private TestsRepository $testsRepository; + function __construct(Responder $responder, TestsRepository $testsRepository, UserRepository $userRepository) { $this->testsRepository = $testsRepository; @@ -35,7 +36,7 @@ public function __invoke( $uid = $request->getAttribute('uid'); - $result = $this->testsRepository->listComportamentoTest($uid); + $result = $this->testsRepository->listBehaviourTest($uid); return $this->responder ->withJson($response, $result) diff --git a/src/Action/Reports/ListEmozioniTestAction.php b/src/Action/Reports/ListEmotionsTestAction.php similarity index 91% rename from src/Action/Reports/ListEmozioniTestAction.php rename to src/Action/Reports/ListEmotionsTestAction.php index bdd728f..48c5f2e 100644 --- a/src/Action/Reports/ListEmozioniTestAction.php +++ b/src/Action/Reports/ListEmotionsTestAction.php @@ -9,10 +9,11 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -final class ListEmozioniTestAction +final class ListEmotionsTestAction { private Responder $responder; private TestsRepository $testsRepository; + function __construct(Responder $responder, TestsRepository $testsRepository, UserRepository $userRepository) { $this->testsRepository = $testsRepository; @@ -35,7 +36,7 @@ public function __invoke( $uid = $request->getAttribute('uid'); - $result = $this->testsRepository->listEmozioniTest($uid); + $result = $this->testsRepository->listEmotionsTest($uid); return $this->responder ->withJson($response, $result) diff --git a/src/Action/Reports/WebListComportamentoTestAction.php b/src/Action/Reports/WebListComportamentoTestAction.php index d5735f2..6d1208d 100644 --- a/src/Action/Reports/WebListComportamentoTestAction.php +++ b/src/Action/Reports/WebListComportamentoTestAction.php @@ -40,7 +40,7 @@ public function __invoke( ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } - $result = $this->testsRepository->listComportamentoTest($args['user_id']); + $result = $this->testsRepository->listBehaviourTest($args['user_id']); return $this->responder ->withJson($response, $result) diff --git a/src/Action/Reports/WebListEmozioniTestAction.php b/src/Action/Reports/WebListEmozioniTestAction.php index 286a480..8361f6b 100644 --- a/src/Action/Reports/WebListEmozioniTestAction.php +++ b/src/Action/Reports/WebListEmozioniTestAction.php @@ -40,7 +40,7 @@ public function __invoke( ->withStatus(StatusCodeInterface::STATUS_BAD_REQUEST); } - $result = $this->testsRepository->listEmozioniTest($args['user_id']); + $result = $this->testsRepository->listEmotionsTest($args['user_id']); return $this->responder ->withJson($response, $result) diff --git a/src/Domain/Consulti/Repository/ConsultiRepository.php b/src/Domain/Consulti/Repository/ConsultRepository.php similarity index 91% rename from src/Domain/Consulti/Repository/ConsultiRepository.php rename to src/Domain/Consulti/Repository/ConsultRepository.php index 36d6e51..8d570d7 100644 --- a/src/Domain/Consulti/Repository/ConsultiRepository.php +++ b/src/Domain/Consulti/Repository/ConsultRepository.php @@ -8,16 +8,18 @@ use App\Moebius\Token; use App\Support\Hydrator; use Cake\Chronos\Chronos; +use DateTime; use Exception; use Fig\Http\Message\StatusCodeInterface; use PHPMailer\PHPMailer\PHPMailer; -final class ConsultiRepository +final class ConsultRepository { private QueryFactory $queryFactory; private Transaction $transaction; private Hydrator $hydrator; private Token $token; + public function __construct(QueryFactory $queryFactory, Transaction $transaction, Hydrator $hydrator, Token $token) { $this->token = $token; @@ -42,8 +44,8 @@ public function checkCode($code): bool return false; } - $data1 = new \DateTime($data[0]['data_creazione']); - $data2 = new \DateTime(date("Y-m-d H:i:s")); + $data1 = new DateTime($data[0]['data_creazione']); + $data2 = new DateTime(date("Y-m-d H:i:s")); $diff = $data2->diff($data1); $hours = $diff->h; @@ -117,24 +119,24 @@ public function generaLink($email, int $paz_id) $mail->Subject = __('Consulto Medico'); $mail_body = file_get_contents(__DIR__ . '/../../../../data/mail_template/'.returnLocale().'/consulto_invitation'); $search = ['{{DOC_NOME}}', '{{DOC_COGNOME}}', '{{FULL_LINK}}', '{{PIN_CODE}}']; - $replace = [$_SESSION['fname'], $_SESSION['lname'], 'https://--INSERT KEY HERE--/public/consulto/' . $codice, $pin_code]; + $replace = [$_SESSION['fname'], $_SESSION['lname'], 'https://--INSERT KEY HERE--/public/consult/' . $codice, $pin_code]; $mail_body = str_replace($search, $replace, $mail_body); $mail->Body = $mail_body; $mail->send(); - } catch (\Exception $e) { + } catch (Exception $e) { return ['status' => 'error', 'message' => __('Errore invio E-Mail, se lo hai scritto correttamente contatta Mental Space Support Team'), - 'link' => 'https://--INSERT KEY HERE--/public/consulto/' . $codice, 'pin_code' => $pin_code ]; + 'link' => 'https://--INSERT KEY HERE--/public/consult/' . $codice, 'pin_code' => $pin_code ]; } - return ['status' => 'success', 'message' => __('Richiesta consulto inviata correttamente'), - 'link' => 'https://--INSERT KEY HERE--/public/consulto/' . $codice, 'pin_code' => $pin_code ]; + return ['status' => 'success', 'message' => __('Richiesta consult inviata correttamente'), + 'link' => 'https://--INSERT KEY HERE--/public/consult/' . $codice, 'pin_code' => $pin_code ]; } public function listaConsulti($paz_id) { return $this->queryFactory->rawQuery("SELECT destinatario, - CONCAT('https://--INSERT KEY HERE--/public/consulto/', codice) AS full_link, + CONCAT('https://--INSERT KEY HERE--/public/consult/', codice) AS full_link, pin_code, (CASE WHEN stato = 1 THEN 'Attivo' diff --git a/src/Domain/Doctors/Repository/DoctorRepository.php b/src/Domain/Doctors/Repository/DoctorRepository.php index 8d6d362..4939c91 100644 --- a/src/Domain/Doctors/Repository/DoctorRepository.php +++ b/src/Domain/Doctors/Repository/DoctorRepository.php @@ -39,7 +39,7 @@ public function doctorDetail(): array return $rows; } - public function AppdoctorDetail($user_id): array + public function AppDoctorDetail($user_id): array { $doc_id = $this->queryFactory->newSelect('patients') ->select(['doc_id']) diff --git a/src/Domain/Moods/Repository/MoodsRepository.php b/src/Domain/Moods/Repository/MoodsRepository.php index 4dc0084..46d946a 100644 --- a/src/Domain/Moods/Repository/MoodsRepository.php +++ b/src/Domain/Moods/Repository/MoodsRepository.php @@ -61,18 +61,18 @@ function insertMood($user_id, $mood, $w_sign): array return ['status' => 'success']; } - function ultimi10mood($uid) + function last10mood($uid) { $data = $this->queryFactory->newSelect('mood_trackings') - ->innerJoin('moods', "mood_trackings.mood_id = moods.mood_id") - ->select(['moods.value', 'mood_trackings.effective_datetime', 'moods.slogan', 'moods.image','mood_trackings.trk_id', 'mood_trackings.warning_sign']) - ->where('mood_trackings.usr_id = ' . $uid) - ->orderDesc('mood_trackings.trk_id')->execute()->fetchAll('assoc'); + ->innerJoin('moods', "mood_trackings.mood_id = moods.mood_id") + ->select(['moods.value', 'mood_trackings.effective_datetime', 'moods.slogan', 'moods.image', 'mood_trackings.trk_id', 'mood_trackings.warning_sign']) + ->where('mood_trackings.usr_id = ' . $uid) + ->orderDesc('mood_trackings.trk_id')->execute()->fetchAll('assoc'); return [$data]; } - function ultimi10moodGraph($uid) + function last10moodGraph($uid) { $data = $this->queryFactory->newSelect('mood_trackings') ->innerJoin('moods', "mood_trackings.mood_id = moods.mood_id") diff --git a/src/Domain/Obiettivi/Repository/ObiettiviRepository.php b/src/Domain/Obiettivi/Repository/ObjectiveRepository.php similarity index 93% rename from src/Domain/Obiettivi/Repository/ObiettiviRepository.php rename to src/Domain/Obiettivi/Repository/ObjectiveRepository.php index f24acf9..01b80af 100644 --- a/src/Domain/Obiettivi/Repository/ObiettiviRepository.php +++ b/src/Domain/Obiettivi/Repository/ObjectiveRepository.php @@ -7,8 +7,9 @@ use App\Factory\QueryFactory; use App\Database\Transaction; +use Cake\Database\StatementInterface; -final class ObiettiviRepository +final class ObjectiveRepository { private QueryFactory $queryFactory; @@ -50,7 +51,7 @@ public function listObjectives($uid): array /** * @param $id int ID Obiettivo * @param $uid int ID User - * @return \Cake\Database\StatementInterface + * @return StatementInterface */ public function deleteObjective($id, $uid) { @@ -62,7 +63,7 @@ public function deleteObjective($id, $uid) /** * @param $data array Array [nome_campo][valore] * @param $uid int User ID - * @return \Cake\Database\StatementInterface + * @return StatementInterface */ public function addObjective($data, $uid) { diff --git a/src/Domain/Tests/Repository/TestsRepository.php b/src/Domain/Tests/Repository/TestsRepository.php index dd03364..bf508a3 100644 --- a/src/Domain/Tests/Repository/TestsRepository.php +++ b/src/Domain/Tests/Repository/TestsRepository.php @@ -25,7 +25,7 @@ public function __construct(QueryFactory $queryFactory, Transaction $transaction $this->transaction = $transaction; } - public function addComportamentoTest(int $uid, array $testData) + public function addBehaviourTest(int $uid, array $testData) { $testData['paz_id'] = $this->getPazIDByUserID($uid); @@ -33,7 +33,7 @@ public function addComportamentoTest(int $uid, array $testData) ->execute(); } - public function addEmozioneTest(int $uid, array $testData) + public function addEmotionTest(int $uid, array $testData) { $testData['paz_id'] = $this->getPazIDByUserID($uid); @@ -48,7 +48,8 @@ public function addPhq9Test(int $uid, array $testData) return $this->queryFactory->newInsert('phq9', $testData) ->execute(); } - public function listComportamentoTest(int $uid) + + public function listBehaviourTest(int $uid) { $paz_id = $this->getPazIDByUserID($uid); return $this->queryFactory->newSelect('behaviours') @@ -59,7 +60,7 @@ public function listComportamentoTest(int $uid) ->fetchAll('assoc'); } - public function listEmozioniTest(int $uid) + public function listEmotionsTest(int $uid) { $paz_id = $this->getPazIDByUserID($uid); return $this->queryFactory->newSelect('emozioni') diff --git a/src/Domain/Users/Repository/UserRepository.php b/src/Domain/Users/Repository/UserRepository.php index e81667e..51358a1 100644 --- a/src/Domain/Users/Repository/UserRepository.php +++ b/src/Domain/Users/Repository/UserRepository.php @@ -172,7 +172,7 @@ public function updateUser($userID, $user): array return ['status'=>'error', 'message' => __('Something went wrong, try again later')]; } - return ['status'=>'success', 'message' => __('Aggiornato con successo')]; + return ['status'=>'success', 'message' => __('Updated')]; } public function updateUserPassword(UserDataDoc $user): array @@ -310,7 +310,7 @@ public function updateUserAddr($userID, $user): array return ['status'=>'error', 'message' => __('Something went wrong, try again later')]; } - return ['status'=>'success', 'message' => __('Aggiornato con successo')]; + return ['status'=>'success', 'message' => __('Updated')]; } function getaddress($coord) @@ -354,17 +354,17 @@ public function pwdUpdate($data, $uid) $data['password'] = hash('sha512', $data['password']); if (!$this->checkPwd($data['old_password'], $uid)) { - return ['status'=>'error', 'message' => __('Password attuale non esatta, riprovare')]; + return ['status'=>'error', 'message' => __('Actual password is not correct, try again')]; } if (!$this->queryFactory->newUpdate('users', ['password' => $data['password']]) ->andWhere(['user_id' => $uid]) ->execute()) { - return ['status'=>'error', 'message' => __('Qualcosa è andato storto')]; + return ['status'=>'error', 'message' => __('Something went wrong')]; } - return ['status'=>'success', 'message' => __('Password Aggiornata con successo')]; + return ['status'=>'success', 'message' => __('Password Updated')]; } public function checkPwd($pwd, $uid) diff --git a/src/Domain/Users/Service/UserCreator.php b/src/Domain/Users/Service/UserCreator.php index b60a913..a12d696 100644 --- a/src/Domain/Users/Service/UserCreator.php +++ b/src/Domain/Users/Service/UserCreator.php @@ -71,7 +71,7 @@ public function createDocUser(array $data): int } if (!$user->locale) { - $user->locale = 'it_IT'; + $user->locale = 'en_EN'; } // Insert user and get new user ID diff --git a/src/Moebius/Definition.php b/src/Moebius/Definition.php index 4b79d0c..3af12af 100644 --- a/src/Moebius/Definition.php +++ b/src/Moebius/Definition.php @@ -8,16 +8,6 @@ */ final class Definition { - /** - * Error Messages - */ - - const ERR_ADD_SMB = "Error while adding smartbox"; - const ERR_ADD_GH = "Error while adding gaming hall"; - const ERR_RESET_SB = "Error while resetting smartbox"; - const ERR_DEL_SB = "Error while deleting smartbox"; - const RESET_SB_OFFLINE = 'Warning, the smartbox is offline. All data has been deleted, remember to do a physical reset on the board'; - /** * API Error Messages */ @@ -31,6 +21,4 @@ final class Definition const ADMIN = 3; const DOCTOR = 2; const PATIENT = 1; - const GAMING_HALL = 4; - const USER = 5; } diff --git a/src/Moebius/Logger.php b/src/Moebius/Logger.php index 26fd253..86fb602 100644 --- a/src/Moebius/Logger.php +++ b/src/Moebius/Logger.php @@ -8,7 +8,7 @@ /** * Class Logger * @package App\Moebius - * @thanks to Luca Tortora + * @thanks to Luca Tortora */ final class Logger { diff --git a/src/Moebius/Token.php b/src/Moebius/Token.php index ec8f73d..526c6c5 100644 --- a/src/Moebius/Token.php +++ b/src/Moebius/Token.php @@ -40,9 +40,9 @@ public function make_token($length = 16) } /** - * Funzione generazione caratteri random + * Generate random chars * - * @return string Caratteri random + * @return string Random Chars */ function rand_alphanumeric() { diff --git a/templates/consulto/home.php b/templates/consult/home.php similarity index 90% rename from templates/consulto/home.php rename to templates/consult/home.php index ed3dbf5..be9a91c 100644 --- a/templates/consulto/home.php +++ b/templates/consult/home.php @@ -18,8 +18,8 @@ User avatar
-

Nominativo Nascosto

- +

Name and Surname are Hidden

+
@@ -30,7 +30,7 @@

- +
@@ -39,20 +39,20 @@

- +
-

+

@@ -70,12 +70,12 @@ - +