daevin 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/Daevin_test/.editorconfig +15 -0
- package/Daevin_test/.env.example +92 -0
- package/Daevin_test/.gitattributes +10 -0
- package/Daevin_test/CODE_OF_CONDUCT.md +3 -0
- package/Daevin_test/CONTRIBUTING.md +3 -0
- package/Daevin_test/LICENSE +21 -0
- package/Daevin_test/README.md +314 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ApiLoginProxyForWebClientAction.php +52 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ApiLogoutAction.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ApiRefreshProxyForWebClientAction.php +47 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ForgotPasswordAction.php +43 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/GetAuthenticatedUserAction.php +19 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/RegisterUserAction.php +39 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/ResetPasswordAction.php +61 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/SendVerificationEmailAction.php +19 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/VerifyEmailAction.php +43 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/WebLoginAction.php +46 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Actions/WebLogoutAction.php +17 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Classes/LoginCustomAttribute.php +97 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Configs/appSection-authentication.php +117 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/EmailNotVerifiedException.php +12 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/InvalidEmailVerificationDataException.php +12 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/InvalidResetPasswordTokenException.php +12 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/LoginFailedException.php +12 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Exceptions/RefreshTokenMissingException.php +12 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Mails/ForgotPassword.php +32 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Mails/Templates/forgot-password.blade.php +73 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Middlewares/RedirectIfAuthenticated.php +35 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Notifications/EmailVerified.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Notifications/PasswordReset.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Notifications/VerifyEmail.php +49 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Notifications/Welcome.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Providers/AuthServiceProvider.php +76 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Providers/MainServiceProvider.php +32 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Providers/MiddlewareServiceProvider.php +19 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/README.md +1 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/CallOAuthServerTask.php +36 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/CreatePasswordResetTokenTask.php +14 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/CreateUserByCredentialsTask.php +34 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/LoginTask.php +14 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/MakeRefreshCookieTask.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tasks/SendVerificationEmailTask.php +16 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Stubs/oauth-private.key +51 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Stubs/oauth-public.key +14 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/TestCase.php +18 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/CreatePasswordResetTokenTaskTest.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/CreateUserByCredentialsTaskTest.php +42 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/ForgotPasswordActionTest.php +28 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/LoginCustomAttributeTest.php +48 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/RedirectIfAuthenticatedMiddlewareTest.php +44 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/RegisterUserActionTest.php +64 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/ResetPasswordActionTest.php +83 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/SendVerificationEmailTaskTest.php +40 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Tests/Unit/WebLoginActionTest.php +75 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/Traits/AuthenticationTrait.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/ForgotPasswordController.php +24 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/GetAuthenticatedUserController.php +24 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/LoginProxyForWebClientController.php +33 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/LogoutController.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/RefreshProxyForWebClientController.php +35 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/RegisterUserController.php +24 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/ResetPasswordController.php +30 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/SendVerificationEmailController.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Controllers/VerifyEmailController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/ForgotPasswordRequest.php +50 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/GetAuthenticatedUserRequest.php +45 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/LoginProxyPasswordGrantRequest.php +57 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/LogoutRequest.php +51 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/RefreshProxyRequest.php +51 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/RegisterUserRequest.php +61 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/ResetPasswordRequest.php +55 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/SendVerificationEmailRequest.php +56 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Requests/VerifyEmailRequest.php +51 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/ForgotPassword.v1.public.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/GetAuthenticatedUser.v1.private.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/LoginProxyForWebClient.v1.public.php +30 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/LoginUsingCredentialGrant.v1.public.php +29 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/LoginUsingPasswordGrant.v1.private.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/Logout.v1.public.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/RefreshProxyForWebClient.v1.public.php +29 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/RegisterUser.v1.private.php +38 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/ResetPassword.v1.public.php +37 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/SendVerificationEmail.v1.public.php +32 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Routes/VerifyEmail.v1.public.php +35 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/ApiTestCase.php +74 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ApiLoginProxyForWebClientTest.php +129 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ApiLogoutTest.php +28 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ApiRefreshProxyForWebClientTest.php +86 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ForgotPasswordTest.php +56 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/GetAuthenticatedUserTest.php +76 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/RegisterUserTest.php +208 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/ResetPasswordTest.php +79 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/SendVerificationEmailTest.php +95 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/Stubs/oauth-private.key +51 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/Stubs/oauth-public.key +14 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/API/Tests/Functional/VerifyEmailTest.php +84 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Controllers/LoginController.php +39 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Controllers/LogoutController.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Requests/LoginRequest.php +54 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Requests/LogoutRequest.php +50 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Routes/GetLogin.v1.public.php +8 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Routes/PostLogin.v1.public.php +8 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Routes/PostLogout.php +7 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/UI/WEB/Views/login.blade.php +121 -0
- package/Daevin_test/app/Containers/AppSection/Authentication/composer.json +11 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/AssignRolesToUserAction.php +32 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/AttachPermissionsToRoleAction.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/AttachPermissionsToUserAction.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/CreatePermissionAction.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/CreateRoleAction.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/DeleteRoleAction.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/DetachPermissionsFromRoleAction.php +30 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/DetachPermissionsFromUserAction.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/FindPermissionAction.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/FindRoleAction.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetAllPermissionsAction.php +21 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetAllRolesAction.php +21 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetRolePermissionsAction.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetUserPermissionsAction.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/GetUserRolesAction.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/RevokeRolesFromUserAction.php +40 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/SyncPermissionsOnRoleAction.php +33 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Actions/SyncUserRolesAction.php +33 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Configs/appSection-authorization.php +24 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Configs/permission.php +161 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Factories/PermissionFactory.php +19 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Factories/RoleFactory.php +28 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Migrations/2016_12_29_201047_create_permission_tables.php +141 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Migrations/2017_04_22_122453_add_extra_fields_to_permissions_tale.php +30 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Migrations/2017_04_22_122522_add_extra_fields_to_roles_table.php +30 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Repositories/PermissionRepository.php +19 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Repositories/RoleRepository.php +19 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationDefaultUsersSeeder_4.php +36 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationGivePermissionsToRolesSeeder_3.php +24 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationPermissionsSeeder_1.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Data/Seeders/AuthorizationRolesSeeder_2.php +21 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Models/Permission.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Models/Role.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Providers/MainServiceProvider.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/README.md +1 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/AssignRolesToUserTask.php +21 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/CreatePermissionTask.php +41 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/CreateRoleTask.php +41 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/DeleteRoleTask.php +35 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/DetachPermissionsFromRoleTask.php +24 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/DetachPermissionsFromUserTask.php +24 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/FindPermissionTask.php +49 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/FindRoleTask.php +49 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/GetAllPermissionsTask.php +40 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/GetAllRolesTask.php +40 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tasks/RevokeRoleFromUserTask.php +21 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/TestCase.php +18 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/CreatePermissionTaskTest.php +29 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/CreateRoleTaskTest.php +29 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/DeleteRoleTaskTest.php +36 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/FindPermissionTaskTest.php +44 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/FindRoleTaskTest.php +44 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/PermissionFactoryTest.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/PermissionMigrationTest.php +95 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Tests/Unit/RoleFactoryTest.php +33 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Traits/AuthorizationTrait.php +11 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/Traits/IsResourceOwnerTrait.php +19 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/AssignRolesToUserController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/AttachPermissionsToRoleController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/AttachPermissionsToUserController.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/CreateRoleController.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/DeleteRoleController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/DetachPermissionsFromRoleController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/DetachPermissionsFromUserController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/FindPermissionController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/FindRoleController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetAllPermissionsController.php +28 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetAllRolesController.php +28 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetRolePermissionsController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetUserPermissionsController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/GetUserRolesController.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/RevokeRolesFromUserController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/SyncPermissionOnRoleController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Controllers/SyncUserRolesController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/AssignRolesToUserRequest.php +48 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/AttachPermissionsToRoleRequest.php +48 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/AttachPermissionsToUserRequest.php +53 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/CreateRoleRequest.php +47 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/DeleteRoleRequest.php +45 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/DetachPermissionsFromRoleRequest.php +48 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/DetachPermissionsFromUserRequest.php +53 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/FindPermissionRequest.php +45 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/FindRoleRequest.php +45 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetAllPermissionsRequest.php +45 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetAllRolesRequest.php +45 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetRolePermissionsRequest.php +51 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetUserPermissionsRequest.php +51 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/GetUserRolesRequest.php +51 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/RevokeRolesFromUserRequest.php +48 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/SyncPermissionsOnRoleRequest.php +48 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Requests/SyncUserRolesRequest.php +48 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/AssignRolesToUser.v1.private.php +29 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/AttachPermissionsToRole.v1.private.php +29 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/AttachPermissionsToUser.v1.private.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/CreateRole.v1.private.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/DeleteRole.v1.private.php +28 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/DetachPermissionsFromRole.v1.private.php +29 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/DetachPermissionsFromUser.v1.private.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/FindPermission.v1.private.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/FindRole.v1.private.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetAllPermissions.v1.private.php +21 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetAllRoles.v1.private.php +21 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetRolePermissions.v1.private.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetUserPermissions.v1.private.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/GetUserRoles.v1.private.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/RevokeRolesFromUser.v1.private.php +29 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/SyncPermissionOnRole.v1.private.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/SyncUserRoles.v1.private.php +27 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/_permission.v1.public.php +25 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/_role.v1.public.php +43 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Routes/_userPermissions.v1.public.php +48 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/ApiTestCase.php +15 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/AssignRolesToUserTest.php +71 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/AttachPermissionToUserTest.php +114 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/AttachPermissionsToRoleTest.php +115 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/CreateRoleTest.php +65 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/DeleteRoleTest.php +40 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/DetachPermissionFromUserTest.php +120 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/DetachPermissionsFromRoleTest.php +115 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/FindPermissionTest.php +42 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/FindRoleTest.php +42 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetAllPermissionsTest.php +30 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetAllRolesTest.php +32 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetRolePermissionsTest.php +39 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetUserPermissionsTest.php +40 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/GetUserRolesTest.php +40 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/RevokeRolesFromUserTest.php +115 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/SyncPermissionsOnRoleTest.php +92 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Tests/Functional/SyncUserRolesTest.php +93 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Transformers/PermissionTransformer.php +28 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/API/Transformers/RoleTransformer.php +34 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/WEB/Controllers/UnauthorizedController.php +19 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/WEB/Requests/UnauthorizedRequest.php +49 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/WEB/Routes/GetUnauthorized.php +7 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/UI/WEB/Views/unauthorized.blade.php +43 -0
- package/Daevin_test/app/Containers/AppSection/Authorization/composer.json +11 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Actions/CreatePostsAction.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Actions/DeletePostsAction.php +18 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Actions/FindPostsByIdAction.php +18 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Actions/GetAllPostsAction.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Actions/UpdatePostsAction.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Configs/appSection-posts.php +14 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Data/Factories/PostsFactory.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Data/Migrations/2023_2_19_55939_create_posts_migration.php +30 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Data/Repositories/PostsRepository.php +17 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Models/Posts.php +42 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Posts.json +7 -0
- package/Daevin_test/app/Containers/AppSection/Posts/README.md +194 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Tasks/CreatePostsTask.php +34 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Tasks/DeletePostsTask.php +35 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Tasks/FindPostsByIdTask.php +33 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Tasks/GetAllPostsTask.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Posts/Tasks/UpdatePostsTask.php +33 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Controllers/Controller.php +94 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/CreatePostsRequest.php +54 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/DeletePostsRequest.php +54 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/FindPostsByIdRequest.php +53 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/GetAllPostsRequest.php +54 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Requests/UpdatePostsRequest.php +56 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/CreatePostsRoute.v1.private.php +52 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/DeletePostsRoute.v1.private.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/FindPostsByIdRoute.v1.private.php +52 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/GetAllPostsRoute.v1.private.php +74 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Routes/UpdatePostsRoute.v1.private.php +52 -0
- package/Daevin_test/app/Containers/AppSection/Posts/UI/API/Transformers/PostsTransformer.php +49 -0
- package/Daevin_test/app/Containers/AppSection/Posts/composer.json +7 -0
- package/Daevin_test/app/Containers/AppSection/User/Actions/CreateAdminAction.php +39 -0
- package/Daevin_test/app/Containers/AppSection/User/Actions/DeleteUserAction.php +22 -0
- package/Daevin_test/app/Containers/AppSection/User/Actions/FindUserByIdAction.php +22 -0
- package/Daevin_test/app/Containers/AppSection/User/Actions/GetAllUsersAction.php +21 -0
- package/Daevin_test/app/Containers/AppSection/User/Actions/UpdateUserAction.php +33 -0
- package/Daevin_test/app/Containers/AppSection/User/Actions/UpdateUserPasswordAction.php +35 -0
- package/Daevin_test/app/Containers/AppSection/User/Configs/appSection-user.php +5 -0
- package/Daevin_test/app/Containers/AppSection/User/Data/Factories/UserFactory.php +44 -0
- package/Daevin_test/app/Containers/AppSection/User/Data/Migrations/2000_01_01_000001_create_users_table.php +34 -0
- package/Daevin_test/app/Containers/AppSection/User/Data/Migrations/2000_01_01_000002_create_password_resets_table.php +28 -0
- package/Daevin_test/app/Containers/AppSection/User/Data/Repositories/UserRepository.php +21 -0
- package/Daevin_test/app/Containers/AppSection/User/Data/Seeders/UserPermissionsSeeder_1.php +26 -0
- package/Daevin_test/app/Containers/AppSection/User/Models/User.php +58 -0
- package/Daevin_test/app/Containers/AppSection/User/Notifications/PasswordUpdatedNotification.php +28 -0
- package/Daevin_test/app/Containers/AppSection/User/Providers/MainServiceProvider.php +39 -0
- package/Daevin_test/app/Containers/AppSection/User/README.md +1 -0
- package/Daevin_test/app/Containers/AppSection/User/Tasks/DeleteUserTask.php +35 -0
- package/Daevin_test/app/Containers/AppSection/User/Tasks/FindUserByEmailTask.php +28 -0
- package/Daevin_test/app/Containers/AppSection/User/Tasks/FindUserByIdTask.php +31 -0
- package/Daevin_test/app/Containers/AppSection/User/Tasks/GetAllUsersTask.php +26 -0
- package/Daevin_test/app/Containers/AppSection/User/Tasks/UpdateUserTask.php +42 -0
- package/Daevin_test/app/Containers/AppSection/User/Tests/TestCase.php +18 -0
- package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/CreateAdminActionTest.php +50 -0
- package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/DeleteUserTaskTest.php +35 -0
- package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/FindUserByIdTaskTest.php +35 -0
- package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/PasswordResetsMigrationTest.php +28 -0
- package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/UpdateUserTaskTest.php +52 -0
- package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/UserFactoryTest.php +36 -0
- package/Daevin_test/app/Containers/AppSection/User/Tests/Unit/UsersMigrationTest.php +34 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/DeleteUserController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/FindUserByIdController.php +26 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/GetAllUsersController.php +28 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/UpdateUserController.php +30 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Controllers/UpdateUserPasswordController.php +30 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/DeleteUserRequest.php +48 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/FindUserByIdRequest.php +45 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/GetAllUsersRequest.php +45 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/UpdateUserPasswordRequest.php +56 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Requests/UpdateUserRequest.php +50 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/DeleteUser.v1.private.php +26 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/FindUserById.v1.private.php +24 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/GetAllUsers.v1.private.php +23 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/UpdateUser.v1.private.php +27 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/UpdateUserPassword.v1.private.php +36 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Routes/_user.v1.public.php +25 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/ApiTestCase.php +15 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/DeleteUserTest.php +50 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/FindUserByIdTest.php +80 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/GetAllUsersTest.php +88 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/UpdateUserPasswordTest.php +126 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Tests/Functional/UpdateUserTest.php +80 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/API/Transformers/UserTransformer.php +52 -0
- package/Daevin_test/app/Containers/AppSection/User/UI/CLI/Commands/CreateAdminCommand.php +37 -0
- package/Daevin_test/app/Containers/AppSection/User/composer.json +7 -0
- package/Daevin_test/app/Containers/AppSection/Users/Actions/CreateUsersAction.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Users/Actions/DeleteUsersAction.php +18 -0
- package/Daevin_test/app/Containers/AppSection/Users/Actions/FindUsersByIdAction.php +18 -0
- package/Daevin_test/app/Containers/AppSection/Users/Actions/GetAllUsersAction.php +23 -0
- package/Daevin_test/app/Containers/AppSection/Users/Actions/UpdateUsersAction.php +26 -0
- package/Daevin_test/app/Containers/AppSection/Users/Configs/appSection-users.php +14 -0
- package/Daevin_test/app/Containers/AppSection/Users/Data/Factories/UsersFactory.php +22 -0
- package/Daevin_test/app/Containers/AppSection/Users/Data/Migrations/2023_2_19_55939_create_users_migration.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Users/Data/Repositories/UsersRepository.php +17 -0
- package/Daevin_test/app/Containers/AppSection/Users/Models/Users.php +44 -0
- package/Daevin_test/app/Containers/AppSection/Users/README.md +194 -0
- package/Daevin_test/app/Containers/AppSection/Users/Tasks/CreateUsersTask.php +34 -0
- package/Daevin_test/app/Containers/AppSection/Users/Tasks/DeleteUsersTask.php +35 -0
- package/Daevin_test/app/Containers/AppSection/Users/Tasks/FindUsersByIdTask.php +33 -0
- package/Daevin_test/app/Containers/AppSection/Users/Tasks/GetAllUsersTask.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Users/Tasks/UpdateUsersTask.php +33 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Controllers/Controller.php +94 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/CreateUsersRequest.php +55 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/DeleteUsersRequest.php +54 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/FindUsersByIdRequest.php +53 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/GetAllUsersRequest.php +54 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Requests/UpdateUsersRequest.php +57 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/CreateUsersRoute.v1.private.php +53 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/DeleteUsersRoute.v1.private.php +31 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/FindUsersByIdRoute.v1.private.php +53 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/GetAllUsersRoute.v1.private.php +75 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Routes/UpdateUsersRoute.v1.private.php +53 -0
- package/Daevin_test/app/Containers/AppSection/Users/UI/API/Transformers/UsersTransformer.php +49 -0
- package/Daevin_test/app/Containers/AppSection/Users/Users.json +7 -0
- package/Daevin_test/app/Containers/AppSection/Users/composer.json +7 -0
- package/Daevin_test/app/Ship/Broadcasts/channels.php +16 -0
- package/Daevin_test/app/Ship/Commands/HelloWorldCommand.php +32 -0
- package/Daevin_test/app/Ship/Commands/closures.php +19 -0
- package/Daevin_test/app/Ship/Configs/apiato.php +185 -0
- package/Daevin_test/app/Ship/Configs/debugbar.php +275 -0
- package/Daevin_test/app/Ship/Configs/fractal.php +43 -0
- package/Daevin_test/app/Ship/Configs/hashids.php +54 -0
- package/Daevin_test/app/Ship/Configs/ide-helper.php +319 -0
- package/Daevin_test/app/Ship/Configs/notification.php +16 -0
- package/Daevin_test/app/Ship/Configs/repository.php +250 -0
- package/Daevin_test/app/Ship/Contracts/MustVerifyEmail.php +14 -0
- package/Daevin_test/app/Ship/Criterias/CreatedTodayCriteria.php +15 -0
- package/Daevin_test/app/Ship/Criterias/GroupByCriteria.php +21 -0
- package/Daevin_test/app/Ship/Criterias/IsNullCriteria.php +21 -0
- package/Daevin_test/app/Ship/Criterias/NotNullCriteria.php +21 -0
- package/Daevin_test/app/Ship/Criterias/OrderByCreationDateAscendingCriteria.php +14 -0
- package/Daevin_test/app/Ship/Criterias/OrderByCreationDateDescendingCriteria.php +14 -0
- package/Daevin_test/app/Ship/Criterias/OrderByFieldCriteria.php +37 -0
- package/Daevin_test/app/Ship/Criterias/OrderByNameCriteria.php +14 -0
- package/Daevin_test/app/Ship/Criterias/OrderByUpdateDateAscendingCriteria.php +14 -0
- package/Daevin_test/app/Ship/Criterias/OrderByUpdateDateDescendingCriteria.php +14 -0
- package/Daevin_test/app/Ship/Criterias/ThisBetweenDatesCriteria.php +21 -0
- package/Daevin_test/app/Ship/Criterias/ThisEqualThatCriteria.php +20 -0
- package/Daevin_test/app/Ship/Criterias/ThisLikeThatCriteria.php +35 -0
- package/Daevin_test/app/Ship/Criterias/ThisUserCriteria.php +19 -0
- package/Daevin_test/app/Ship/Events/.gitkeep +0 -0
- package/Daevin_test/app/Ship/Exceptions/CreateResourceFailedException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/DeleteResourceFailedException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/EmailIsMissedException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/Handlers/ExceptionsHandler.php +107 -0
- package/Daevin_test/app/Ship/Exceptions/InternalErrorException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/NotAuthorizedResourceException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/NotFoundException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/NotImplementedException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/UnsupportedFractalSerializerException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/UpdateResourceFailedException.php +12 -0
- package/Daevin_test/app/Ship/Exceptions/ValidationFailedException.php +12 -0
- package/Daevin_test/app/Ship/Generators/CustomStubs/.gitkeep +0 -0
- package/Daevin_test/app/Ship/Helpers/helpers.php +12 -0
- package/Daevin_test/app/Ship/Kernels/ConsoleKernel.php +46 -0
- package/Daevin_test/app/Ship/Kernels/HttpKernel.php +113 -0
- package/Daevin_test/app/Ship/Listeners/.gitkeep +0 -0
- package/Daevin_test/app/Ship/Mails/.gitkeep +0 -0
- package/Daevin_test/app/Ship/Mails/Templates/.gitkeep +0 -0
- package/Daevin_test/app/Ship/Middlewares/Authenticate.php +16 -0
- package/Daevin_test/app/Ship/Middlewares/EncryptCookies.php +17 -0
- package/Daevin_test/app/Ship/Middlewares/PreventRequestsDuringMaintenance.php +17 -0
- package/Daevin_test/app/Ship/Middlewares/TrimStrings.php +19 -0
- package/Daevin_test/app/Ship/Middlewares/TrustHosts.php +20 -0
- package/Daevin_test/app/Ship/Middlewares/TrustProxies.php +28 -0
- package/Daevin_test/app/Ship/Middlewares/VerifyCsrfToken.php +17 -0
- package/Daevin_test/app/Ship/Migrations/2017_09_12_174826_create_notifications_table.php +35 -0
- package/Daevin_test/app/Ship/Migrations/2019_08_19_000000_create_failed_jobs_table.php +36 -0
- package/Daevin_test/app/Ship/Migrations/2021_03_01_150940_create_jobs_table.php +39 -0
- package/Daevin_test/app/Ship/Notifications/.gitkeep +0 -0
- package/Daevin_test/app/Ship/Parents/Actions/Action.php +10 -0
- package/Daevin_test/app/Ship/Parents/Actions/SubAction.php +10 -0
- package/Daevin_test/app/Ship/Parents/Commands/ConsoleCommand.php +10 -0
- package/Daevin_test/app/Ship/Parents/Controllers/ApiController.php +10 -0
- package/Daevin_test/app/Ship/Parents/Controllers/WebController.php +10 -0
- package/Daevin_test/app/Ship/Parents/Criterias/Criteria.php +10 -0
- package/Daevin_test/app/Ship/Parents/Events/Event.php +10 -0
- package/Daevin_test/app/Ship/Parents/Exceptions/Exception.php +10 -0
- package/Daevin_test/app/Ship/Parents/Factories/Factory.php +10 -0
- package/Daevin_test/app/Ship/Parents/Jobs/Job.php +25 -0
- package/Daevin_test/app/Ship/Parents/Listeners/Listener.php +10 -0
- package/Daevin_test/app/Ship/Parents/Mails/Mail.php +10 -0
- package/Daevin_test/app/Ship/Parents/Middlewares/Middleware.php +10 -0
- package/Daevin_test/app/Ship/Parents/Models/Model.php +11 -0
- package/Daevin_test/app/Ship/Parents/Models/UserModel.php +17 -0
- package/Daevin_test/app/Ship/Parents/Notifications/Notification.php +10 -0
- package/Daevin_test/app/Ship/Parents/Policies/Policy.php +26 -0
- package/Daevin_test/app/Ship/Parents/Providers/AuthServiceProvider.php +20 -0
- package/Daevin_test/app/Ship/Parents/Providers/BroadcastServiceProvider.php +26 -0
- package/Daevin_test/app/Ship/Parents/Providers/EventServiceProvider.php +40 -0
- package/Daevin_test/app/Ship/Parents/Providers/MainServiceProvider.php +24 -0
- package/Daevin_test/app/Ship/Parents/Providers/MiddlewareServiceProvider.php +16 -0
- package/Daevin_test/app/Ship/Parents/Providers/RouteServiceProvider.php +24 -0
- package/Daevin_test/app/Ship/Parents/Repositories/Repository.php +10 -0
- package/Daevin_test/app/Ship/Parents/Requests/Request.php +10 -0
- package/Daevin_test/app/Ship/Parents/Seeders/Seeder.php +10 -0
- package/Daevin_test/app/Ship/Parents/Tasks/Task.php +10 -0
- package/Daevin_test/app/Ship/Parents/Tests/PhpUnit/TestCase.php +51 -0
- package/Daevin_test/app/Ship/Parents/Transformers/Transformer.php +25 -0
- package/Daevin_test/app/Ship/Parents/Values/Value.php +9 -0
- package/Daevin_test/app/Ship/Providers/RouteServiceProvider.php +35 -0
- package/Daevin_test/app/Ship/Providers/ShipProvider.php +44 -0
- package/Daevin_test/app/Ship/Seeders/SeedDeploymentData.php +18 -0
- package/Daevin_test/app/Ship/Seeders/SeedTestingData.php +18 -0
- package/Daevin_test/app/Ship/Tests/TestCase.php +10 -0
- package/Daevin_test/app/Ship/composer.json +21 -0
- package/Daevin_test/artisan +53 -0
- package/Daevin_test/bootstrap/app.php +55 -0
- package/Daevin_test/bootstrap/cache/.gitignore +2 -0
- package/Daevin_test/composer.json +112 -0
- package/Daevin_test/composer.lock +12696 -0
- package/Daevin_test/config/app.php +206 -0
- package/Daevin_test/config/auth.php +117 -0
- package/Daevin_test/config/broadcasting.php +67 -0
- package/Daevin_test/config/cache.php +110 -0
- package/Daevin_test/config/cors.php +34 -0
- package/Daevin_test/config/database.php +151 -0
- package/Daevin_test/config/filesystems.php +76 -0
- package/Daevin_test/config/hashing.php +52 -0
- package/Daevin_test/config/logging.php +119 -0
- package/Daevin_test/config/mail.php +117 -0
- package/Daevin_test/config/queue.php +93 -0
- package/Daevin_test/config/services.php +34 -0
- package/Daevin_test/config/session.php +201 -0
- package/Daevin_test/config/view.php +36 -0
- package/Daevin_test/database/factories/ModelFactory.php +4 -0
- package/Daevin_test/database/migrations/.gitkeep +0 -0
- package/Daevin_test/database/seeders/DatabaseSeeder.php +24 -0
- package/Daevin_test/lang/ar/auth.php +19 -0
- package/Daevin_test/lang/ar/pagination.php +19 -0
- package/Daevin_test/lang/ar/passwords.php +22 -0
- package/Daevin_test/lang/ar/validation.php +149 -0
- package/Daevin_test/lang/en/auth.php +20 -0
- package/Daevin_test/lang/en/pagination.php +19 -0
- package/Daevin_test/lang/en/passwords.php +22 -0
- package/Daevin_test/lang/en/validation.php +169 -0
- package/Daevin_test/lang/es/auth.php +19 -0
- package/Daevin_test/lang/es/pagination.php +19 -0
- package/Daevin_test/lang/es/passwords.php +22 -0
- package/Daevin_test/lang/es/validation.php +149 -0
- package/Daevin_test/lang/fa/auth.php +18 -0
- package/Daevin_test/lang/fa/pagination.php +17 -0
- package/Daevin_test/lang/fa/passwords.php +20 -0
- package/Daevin_test/lang/fa/validation.php +182 -0
- package/Daevin_test/lang/fr/auth.php +19 -0
- package/Daevin_test/lang/fr/pagination.php +19 -0
- package/Daevin_test/lang/fr/passwords.php +22 -0
- package/Daevin_test/lang/fr/validation.php +149 -0
- package/Daevin_test/package-lock.json +10031 -0
- package/Daevin_test/package.json +19 -0
- package/Daevin_test/php_cs.dist.php +39 -0
- package/Daevin_test/phpspec.yml +5 -0
- package/Daevin_test/phpunit.xml +38 -0
- package/Daevin_test/psalm.dist.xml +18 -0
- package/Daevin_test/public/.htaccess +21 -0
- package/Daevin_test/public/favicon.ico +0 -0
- package/Daevin_test/public/index.php +55 -0
- package/Daevin_test/public/robots.txt +2 -0
- package/Daevin_test/public/web.config +28 -0
- package/Daevin_test/resources/css/app.css +0 -0
- package/Daevin_test/resources/js/app.js +1 -0
- package/Daevin_test/resources/js/bootstrap.js +28 -0
- package/Daevin_test/resources/views/.gitkeep +0 -0
- package/Daevin_test/server.php +21 -0
- package/Daevin_test/storage/app/.gitignore +3 -0
- package/Daevin_test/storage/app/public/.gitignore +2 -0
- package/Daevin_test/storage/debugbar/.gitignore +2 -0
- package/Daevin_test/storage/framework/cache/.gitignore +2 -0
- package/Daevin_test/storage/framework/sessions/.gitignore +2 -0
- package/Daevin_test/storage/framework/testing/.gitignore +2 -0
- package/Daevin_test/storage/framework/views/.gitignore +2 -0
- package/Daevin_test/storage/logs/.gitignore +2 -0
- package/Daevin_test/webpack.mix.js +17 -0
- package/bin/classes/Apiato/index.js +208 -0
- package/bin/classes/Containers/Action.js +169 -0
- package/bin/classes/Containers/ComposerJSON.js +27 -0
- package/bin/classes/Containers/Config.js +39 -0
- package/bin/classes/Containers/Controller.js +120 -0
- package/bin/classes/Containers/Factory.js +47 -0
- package/bin/classes/Containers/Migration.js +80 -0
- package/bin/classes/Containers/Model.js +126 -0
- package/bin/classes/Containers/ReadMe.js +212 -0
- package/bin/classes/Containers/Repository.js +54 -0
- package/bin/classes/Containers/Request.js +341 -0
- package/bin/classes/Containers/Route.js +336 -0
- package/bin/classes/Containers/Task.js +225 -0
- package/bin/classes/Containers/Transformer.js +94 -0
- package/bin/classes/Helpers.js +150 -0
- package/bin/classes/tes.js +0 -0
- package/bin/constants.js +11 -0
- package/bin/core/output.json +13 -0
- package/bin/core/schemaToSql.js +118 -0
- package/bin/core/sqlToSchema.js +206 -0
- package/bin/index.js +103 -0
- package/dbconfig.json +74 -0
- package/package.json +39 -0
@@ -0,0 +1,150 @@
|
|
1
|
+
|
2
|
+
//import db_config from '../dbconfig.json';
|
3
|
+
import fs from 'fs';
|
4
|
+
import child_process from "child_process";
|
5
|
+
|
6
|
+
class Helpers{
|
7
|
+
|
8
|
+
static dbConfig = null
|
9
|
+
|
10
|
+
constructor(dbconfig) {
|
11
|
+
this.dbConfig = dbconfig;
|
12
|
+
}
|
13
|
+
static loadDBConfigs(dbconfig){
|
14
|
+
Helpers.dbConfig = dbconfig;
|
15
|
+
//console.log(this.dbConfig)
|
16
|
+
}
|
17
|
+
|
18
|
+
static getDbConfig(){
|
19
|
+
return Helpers.dbConfig
|
20
|
+
}
|
21
|
+
|
22
|
+
static getDbAccess(){
|
23
|
+
return {
|
24
|
+
database: Helpers.getDbConfig().database,
|
25
|
+
username: Helpers.getDbConfig().username,
|
26
|
+
password: Helpers.getDbConfig().password,
|
27
|
+
host: Helpers.getDbConfig().host,
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
static getTables(){
|
32
|
+
//console.log(this.getDbConfig())
|
33
|
+
return Helpers.getDbConfig()?.tables
|
34
|
+
}
|
35
|
+
|
36
|
+
static getTableFromName(table_name){
|
37
|
+
const tables = Helpers.getTables();
|
38
|
+
return tables.filter(table => table.table_name === table_name)[0]
|
39
|
+
}
|
40
|
+
|
41
|
+
static getTableColumns(table_name){
|
42
|
+
return Helpers.getTableFromName(table_name).columns
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
static createPath(path){
|
47
|
+
//console.log(`Creating path ${path}`);
|
48
|
+
if (!fs.existsSync(path)){
|
49
|
+
fs.mkdirSync(path, { recursive: true });
|
50
|
+
return true;
|
51
|
+
}
|
52
|
+
|
53
|
+
return fs.existsSync(path);
|
54
|
+
}
|
55
|
+
|
56
|
+
static writeToFile(path, fileName, content){
|
57
|
+
const filepath = `${path}/${fileName}`;
|
58
|
+
try{
|
59
|
+
const pathCreated = Helpers.createPath(path)
|
60
|
+
if(pathCreated){
|
61
|
+
fs.writeFile(filepath, content, function (err) {
|
62
|
+
// console.log(`Writing to ${filepath}`);
|
63
|
+
if (err) return console.log(err);
|
64
|
+
//console.log(`Writing to ${fileName} completed`);
|
65
|
+
});
|
66
|
+
}
|
67
|
+
return filepath;
|
68
|
+
}catch (e) {
|
69
|
+
throw e
|
70
|
+
}
|
71
|
+
|
72
|
+
}
|
73
|
+
|
74
|
+
static formatColumnsToPhpArraysUsage(columns){
|
75
|
+
let data = "";
|
76
|
+
for (let column of columns) {
|
77
|
+
data += `'${column.column_name}' => $request->${column.column_name},`;
|
78
|
+
}
|
79
|
+
return data;
|
80
|
+
}
|
81
|
+
|
82
|
+
static formatColumnsForRequestUsage(columns)
|
83
|
+
{
|
84
|
+
let data = "";
|
85
|
+
for (let column of columns) {
|
86
|
+
data += `'${column.column_name}' => ${Helpers.formatColumnPropertiesToValidators(column)}`;
|
87
|
+
}
|
88
|
+
return data;
|
89
|
+
}
|
90
|
+
|
91
|
+
static formatColumnPropertiesToValidators(column){
|
92
|
+
let properties = column.properties;
|
93
|
+
if( !properties || typeof properties != "array" || properties.length === 0 ){
|
94
|
+
return 'nullable';
|
95
|
+
}
|
96
|
+
let validator = '';
|
97
|
+
|
98
|
+
for (const validatorElement of properties) {
|
99
|
+
switch (validatorElement) {
|
100
|
+
case 'required':
|
101
|
+
validator += validator === '' ? 'required' : '|required';
|
102
|
+
break
|
103
|
+
case 'unique':
|
104
|
+
validator += validator === '' ? 'required|unique' : '|unique';
|
105
|
+
break
|
106
|
+
case 'string':
|
107
|
+
validator += validator === '' ? 'required|string' : '|string';
|
108
|
+
break
|
109
|
+
case validatorElement.startsWith('max'):
|
110
|
+
validator += validator === '' ? 'required|'+validatorElement : '|'+validatorElement;
|
111
|
+
break
|
112
|
+
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return validator
|
116
|
+
}
|
117
|
+
|
118
|
+
static capitalise(str){
|
119
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
120
|
+
}
|
121
|
+
|
122
|
+
static generateRandomString(length) {
|
123
|
+
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
124
|
+
let result = '';
|
125
|
+
for (let i = 0; i < length; i++) {
|
126
|
+
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
127
|
+
}
|
128
|
+
return result;
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
}
|
135
|
+
|
136
|
+
function executeCommand(command, successMessage, callback) {
|
137
|
+
child_process.exec(command, { stdio: 'inherit' }).on('exit', (code, signal) => {
|
138
|
+
if (code !== 0) {
|
139
|
+
callback(new Error(`Command failed with code ${code} and signal ${signal}`));
|
140
|
+
process.exit(1);
|
141
|
+
} else {
|
142
|
+
//console.clear();
|
143
|
+
console.log(successMessage);
|
144
|
+
callback();
|
145
|
+
}
|
146
|
+
});
|
147
|
+
}
|
148
|
+
|
149
|
+
export default Helpers;
|
150
|
+
export {executeCommand}
|
File without changes
|
package/bin/constants.js
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
// const {PROJECT} = require("./index");
|
2
|
+
//
|
3
|
+
//
|
4
|
+
// const PROJECT_DIR= PROJECT
|
5
|
+
//
|
6
|
+
// console.log('PROJECT_DIR')
|
7
|
+
// console.log('PROJECT_DIR')
|
8
|
+
// console.log('PROJECT_DIR')
|
9
|
+
// console.log(PROJECT_DIR)
|
10
|
+
//
|
11
|
+
// module.exports = { PROJECT_DIR };
|
@@ -0,0 +1,118 @@
|
|
1
|
+
|
2
|
+
// Generate SQL for a single column
|
3
|
+
import path from "path";
|
4
|
+
import fs from "fs/promises";
|
5
|
+
import Helpers from "../classes/Helpers.js";
|
6
|
+
|
7
|
+
function columnToSql(column) {
|
8
|
+
let sql = `${column.column_name} ${column.type}`;
|
9
|
+
|
10
|
+
if (column.properties.includes('notNull')) {
|
11
|
+
sql += ' NOT NULL';
|
12
|
+
}
|
13
|
+
|
14
|
+
if (column.properties.includes('unique')) {
|
15
|
+
sql += ' UNIQUE';
|
16
|
+
}
|
17
|
+
|
18
|
+
if (column.properties.includes('hidden')) {
|
19
|
+
sql += ' HIDDEN';
|
20
|
+
}
|
21
|
+
|
22
|
+
if (column.properties.includes('min') || column.properties.includes('max')) {
|
23
|
+
const lengthProps = column.properties.filter(p => p.startsWith('min:') || p.startsWith('max:'));
|
24
|
+
const lengths = lengthProps.map(p => parseInt(p.slice(4)));
|
25
|
+
const min = Math.min(...lengths);
|
26
|
+
const max = Math.max(...lengths);
|
27
|
+
|
28
|
+
if (min) {
|
29
|
+
sql += ` CHECK (LENGTH(${column.column_name}) >= ${min})`;
|
30
|
+
}
|
31
|
+
|
32
|
+
if (max) {
|
33
|
+
sql += ` CHECK (LENGTH(${column.column_name}) <= ${max})`;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
return sql;
|
38
|
+
}
|
39
|
+
|
40
|
+
function tableToSql(table) {
|
41
|
+
const columns = table.columns.map((column) => {
|
42
|
+
let columnStr = `${column.column_name} `;
|
43
|
+
if (column.type.toString().toUpperCase() === "STRING") {
|
44
|
+
const maxLength = column.properties.find((p) => p.startsWith("max:"));
|
45
|
+
columnStr += `VARCHAR(${maxLength ? maxLength.slice(4) : 255}) `;
|
46
|
+
} else if (column.type.toString().toUpperCase() === "ARRAY") {
|
47
|
+
columnStr += `JSON`;
|
48
|
+
} else {
|
49
|
+
columnStr += `${column.type} `;
|
50
|
+
}
|
51
|
+
if (column.properties.includes("notNull")) {
|
52
|
+
columnStr += "NOT NULL ";
|
53
|
+
}
|
54
|
+
if (column.properties.includes("unique")) {
|
55
|
+
columnStr += "UNIQUE ";
|
56
|
+
}
|
57
|
+
if (column.properties.includes("hidden")) {
|
58
|
+
columnStr += "COMMENT 'hidden' ";
|
59
|
+
}
|
60
|
+
return columnStr.trim();
|
61
|
+
});
|
62
|
+
|
63
|
+
const relations = table.relations.map((relation) => {
|
64
|
+
let relationString = '';
|
65
|
+
relationString += getRelation(relation)
|
66
|
+
return relationString;
|
67
|
+
});
|
68
|
+
|
69
|
+
const primaryKey = "id INT AUTO_INCREMENT PRIMARY KEY";
|
70
|
+
columns.unshift(primaryKey);
|
71
|
+
|
72
|
+
return `CREATE TABLE ${table.table_name} (\n ${columns.join(",\n ")}${relations.toString().trim() === '' ? '' : ','}\n ${relations || ''}\n);`;
|
73
|
+
}
|
74
|
+
|
75
|
+
function getType(type, properties) {
|
76
|
+
let typeString = type.toUpperCase();
|
77
|
+
if (typeString === 'STRING') {
|
78
|
+
let maxLength = 255;
|
79
|
+
for (const property of properties) {
|
80
|
+
if (property.includes('max:')) {
|
81
|
+
const length = parseInt(property.split(':')[1]);
|
82
|
+
if (length && length < maxLength) {
|
83
|
+
maxLength = length;
|
84
|
+
}
|
85
|
+
}
|
86
|
+
}
|
87
|
+
typeString += `(${maxLength})`;
|
88
|
+
}
|
89
|
+
if (typeString === 'ARRAY') {
|
90
|
+
typeString = 'TEXT';
|
91
|
+
}
|
92
|
+
if (properties.includes('notNull')) {
|
93
|
+
typeString += ' NOT NULL';
|
94
|
+
}
|
95
|
+
return typeString;
|
96
|
+
}
|
97
|
+
|
98
|
+
function getRelation(relation) {
|
99
|
+
let relationString = '';
|
100
|
+
if (relation.relation === 'belongsTo') {
|
101
|
+
relationString = ` FOREIGN KEY (${relation.foreignKey}) REFERENCES ${relation.table}(id)`;
|
102
|
+
} else if (relation.relation === 'hasMany') {
|
103
|
+
// relationString = ` FOREIGN KEY (${relation.foreignKey}) REFERENCES ${relation.table}(id) ON DELETE CASCADE`;
|
104
|
+
}
|
105
|
+
|
106
|
+
return relationString;
|
107
|
+
}
|
108
|
+
|
109
|
+
function schemaToSql(schema) {
|
110
|
+
return schema.tables.map((table) => tableToSql(table)).join("\n\n");
|
111
|
+
}
|
112
|
+
|
113
|
+
|
114
|
+
const absolutePath = '../../dbconfig.json'; // Resolve the absolute path
|
115
|
+
const fileData = await fs.readFile(absolutePath, "utf8"); // Read the file data
|
116
|
+
const db_config = JSON.parse(fileData);
|
117
|
+
|
118
|
+
console.log(schemaToSql(db_config))
|
@@ -0,0 +1,206 @@
|
|
1
|
+
|
2
|
+
import fs from 'fs'
|
3
|
+
function sqlToSchema(sql) {
|
4
|
+
// Split the SQL into separate statements and remove whitespace
|
5
|
+
const statements = sql.trim().split(/;\s*\n+/);
|
6
|
+
|
7
|
+
// Create an object to hold the schema
|
8
|
+
const schema = {
|
9
|
+
project: '',
|
10
|
+
database: '',
|
11
|
+
host: '',
|
12
|
+
username: '',
|
13
|
+
password: '',
|
14
|
+
tables: [],
|
15
|
+
};
|
16
|
+
|
17
|
+
// Loop through each statement and process it
|
18
|
+
for (const statement of statements) {
|
19
|
+
// Skip any empty statements
|
20
|
+
if (!statement) {
|
21
|
+
continue;
|
22
|
+
}
|
23
|
+
|
24
|
+
// Determine the type of statement
|
25
|
+
const type = statement.trim().split(/\s+/)[0].toUpperCase();
|
26
|
+
|
27
|
+
// Process the statement based on its type
|
28
|
+
switch (type) {
|
29
|
+
case 'CREATE':
|
30
|
+
processCreateStatement(statement, schema);
|
31
|
+
break;
|
32
|
+
default:
|
33
|
+
console.warn(`Unrecognized SQL statement: ${type}`);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
return schema;
|
38
|
+
}
|
39
|
+
|
40
|
+
function processCreateStatement(statement, schema) {
|
41
|
+
// Extract the table name from the statement
|
42
|
+
const tableNameMatch = statement.match(/CREATE TABLE\s+(\w+)\s*\(/i);
|
43
|
+
if (!tableNameMatch) {
|
44
|
+
console.error(`Could not extract table name from SQL statement: ${statement}`);
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
const tableName = tableNameMatch[1];
|
48
|
+
|
49
|
+
// Extract the column definitions from the statement
|
50
|
+
const columnDefinitionsMatch = statement.match(/\(\s*([\s\S]*)\s*\)/);
|
51
|
+
if (!columnDefinitionsMatch) {
|
52
|
+
console.error(`Could not extract column definitions from SQL statement: ${statement}`);
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
const columnDefinitions = columnDefinitionsMatch[1];
|
56
|
+
|
57
|
+
// Create a table object
|
58
|
+
const table = {
|
59
|
+
table_name: tableName,
|
60
|
+
columns: [],
|
61
|
+
relations: [],
|
62
|
+
};
|
63
|
+
|
64
|
+
// Loop through each column definition and process it
|
65
|
+
const columnDefs = columnDefinitions.split(',');
|
66
|
+
for (const columnDef of columnDefs) {
|
67
|
+
const column = processColumnDefinition(columnDef);
|
68
|
+
if (column) {
|
69
|
+
table.columns.push(column);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
// Add the table to the schema
|
74
|
+
schema.tables.push(table);
|
75
|
+
}
|
76
|
+
|
77
|
+
function processColumnDefinition(columnDef) {
|
78
|
+
// Extract the column name and type from the definition
|
79
|
+
const nameMatch = columnDef.match(/^\s*(\w+)\s+/);
|
80
|
+
const typeMatch = columnDef.match(/\s+(\w+)(?:\((.*?)\))?/);
|
81
|
+
|
82
|
+
if (!nameMatch || !typeMatch) {
|
83
|
+
console.error(`Could not extract column name and/or type from column definition: ${columnDef}`);
|
84
|
+
return null;
|
85
|
+
}
|
86
|
+
|
87
|
+
const name = nameMatch[1];
|
88
|
+
const type = typeMatch[1].toUpperCase();
|
89
|
+
const length = typeMatch[2];
|
90
|
+
|
91
|
+
// Create a column object
|
92
|
+
const column = {
|
93
|
+
column_name: name,
|
94
|
+
type: getColumnType(type, length),
|
95
|
+
properties: [],
|
96
|
+
is_searchable: false,
|
97
|
+
};
|
98
|
+
|
99
|
+
// Determine the column properties
|
100
|
+
if (columnDef.match(/\bNOT\s+NULL\b/i)) {
|
101
|
+
column.properties.push('notNull');
|
102
|
+
}
|
103
|
+
if (columnDef.match(/\bUNIQUE\b/i)) {
|
104
|
+
column.properties.push('unique');
|
105
|
+
}
|
106
|
+
if (columnDef.match(/COMMENT\s+'hidden'/i)) {
|
107
|
+
column.properties.push('hidden');
|
108
|
+
}
|
109
|
+
|
110
|
+
return column;
|
111
|
+
}
|
112
|
+
|
113
|
+
function getColumnType(typeStr) {
|
114
|
+
|
115
|
+
const type = typeStr.toString().toUpperCase();
|
116
|
+
if (type.startsWith('VARCHAR')) {
|
117
|
+
return { type: 'string', properties: [`max:${type.slice(8, -1)}`] };
|
118
|
+
}
|
119
|
+
if (type === 'TEXT' || type === 'LONGTEXT') {
|
120
|
+
return { type: 'string' };
|
121
|
+
}
|
122
|
+
if (type === 'BOOLEAN') {
|
123
|
+
return { type: 'boolean' };
|
124
|
+
}
|
125
|
+
if (type.startsWith('INT') || type === 'YEAR') {
|
126
|
+
return { type: 'integer' };
|
127
|
+
}
|
128
|
+
if (type === 'BIGINT') {
|
129
|
+
return { type: 'bigint' };
|
130
|
+
}
|
131
|
+
if (type === 'FLOAT' || type === 'DOUBLE') {
|
132
|
+
return { type: 'float' };
|
133
|
+
}
|
134
|
+
if (type === 'DECIMAL') {
|
135
|
+
return { type: 'decimal' };
|
136
|
+
}
|
137
|
+
if (type === 'DATE' || type === 'DATETIME' || type === 'TIMESTAMP') {
|
138
|
+
return { type: 'date' };
|
139
|
+
}
|
140
|
+
if (type === 'JSON') {
|
141
|
+
return { type: 'array' };
|
142
|
+
}
|
143
|
+
return { type: type.toLowerCase() };
|
144
|
+
}
|
145
|
+
|
146
|
+
function getColumnsFromSql(tableStr) {
|
147
|
+
const columns = [];
|
148
|
+
const matches = tableStr.match(/\(([^)]+)\)/);
|
149
|
+
if (matches) {
|
150
|
+
const columnDefs = matches[1].split(',\n');
|
151
|
+
columnDefs.forEach((columnDef) => {
|
152
|
+
const [nameAndType, ...properties] = columnDef.trim().split(' ');
|
153
|
+
const [name] = nameAndType.split('`').filter(Boolean);
|
154
|
+
const typeStr = properties[0];
|
155
|
+
console.log(properties)
|
156
|
+
console.log(columnDef)
|
157
|
+
console.log(nameAndType)
|
158
|
+
const column = {
|
159
|
+
column_name: name,
|
160
|
+
...getColumnType(typeStr),
|
161
|
+
properties: properties.map((p) => p.trim()),
|
162
|
+
};
|
163
|
+
columns.push(column);
|
164
|
+
});
|
165
|
+
}
|
166
|
+
return columns;
|
167
|
+
}
|
168
|
+
|
169
|
+
function getRelationsFromSql(sql) {
|
170
|
+
const relations = [];
|
171
|
+
const matches = sql.match(/FOREIGN KEY \(`(.+)`\) REFERENCES `(.+)` \(`(.+)`\)/g);
|
172
|
+
if (matches) {
|
173
|
+
matches.forEach((match) => {
|
174
|
+
const [_, foreignKeyName, tableName, columnName] = match.split(' ');
|
175
|
+
const relation = {
|
176
|
+
table: tableName.slice(1, -1),
|
177
|
+
relation: 'belongsTo',
|
178
|
+
foreignKey: foreignKeyName.slice(2, -1),
|
179
|
+
};
|
180
|
+
relations.push(relation);
|
181
|
+
});
|
182
|
+
}
|
183
|
+
return relations;
|
184
|
+
}
|
185
|
+
|
186
|
+
function getTableFromSql(sql) {
|
187
|
+
const tableName = sql.match(/CREATE TABLE (\w+) \(/)[1];
|
188
|
+
const columns = getColumnsFromSql(sql);
|
189
|
+
const relations = getRelationsFromSql(sql);
|
190
|
+
return { table_name: tableName, columns, relations };
|
191
|
+
}
|
192
|
+
|
193
|
+
const sql = `CREATE TABLE my_table (
|
194
|
+
id int(11) NOT NULL AUTO_INCREMENT,
|
195
|
+
name varchar(255) NOT NULL,
|
196
|
+
is_active tinyint(1) NOT NULL DEFAULT '0',
|
197
|
+
price decimal(10,2) NOT NULL DEFAULT '0.00',
|
198
|
+
created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
199
|
+
status enum('ACTIVE','INACTIVE') NOT NULL DEFAULT 'ACTIVE',
|
200
|
+
PRIMARY KEY (id),
|
201
|
+
UNIQUE KEY name (name)
|
202
|
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;`;
|
203
|
+
|
204
|
+
const table = getTableFromSql(sql);
|
205
|
+
fs.writeFileSync('output.json', JSON.stringify(table, null, 4));
|
206
|
+
console.log(table);
|
package/bin/index.js
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
#!/usr/bin/env node
|
2
|
+
|
3
|
+
import yargs from "yargs";
|
4
|
+
import fs from "fs/promises";
|
5
|
+
import path from "path";
|
6
|
+
import Helpers from './classes/Helpers.js';
|
7
|
+
import chalk from "chalk";
|
8
|
+
import boxen from "boxen";
|
9
|
+
import { hideBin } from "yargs/helpers";
|
10
|
+
import generateApiatoproject, {serveWithValet} from "./classes/Apiato/index.js";
|
11
|
+
import inquirer from 'inquirer';
|
12
|
+
|
13
|
+
const banner = boxen(chalk.bold.white('Daevin gen CLI Tool'), {
|
14
|
+
padding: 1,
|
15
|
+
margin: 1,
|
16
|
+
borderStyle: 'double',
|
17
|
+
borderColor: 'green',
|
18
|
+
});
|
19
|
+
|
20
|
+
console.info(`${banner}\n`);
|
21
|
+
|
22
|
+
yargs(hideBin(process.argv))
|
23
|
+
.command(['gen', 'generate'], 'Generate Backend Source code', (yargs) => {
|
24
|
+
yargs.command('apiato', 'Generate Apiato Source project', (yargs) => {
|
25
|
+
yargs.option('path', {
|
26
|
+
alias: 'p',
|
27
|
+
describe: 'Path to config file',
|
28
|
+
type: 'string',
|
29
|
+
demandOption: true
|
30
|
+
})
|
31
|
+
}, async (argv) => {
|
32
|
+
console.info(chalk.magenta.bold('Generating Apiato Source project with options:'));
|
33
|
+
const absolutePath = path.resolve(argv.path);
|
34
|
+
const fileData = await fs.readFile(absolutePath, "utf8");
|
35
|
+
const db_config = JSON.parse(fileData);
|
36
|
+
|
37
|
+
Helpers.loadDBConfigs(db_config);
|
38
|
+
|
39
|
+
await generateApiatoproject();
|
40
|
+
|
41
|
+
|
42
|
+
console.info(chalk.bgGreenBright.bold('Code generation Completed !'));
|
43
|
+
});
|
44
|
+
yargs.command('nestjs', 'Generate Nestjs Source project', (yargs) => {
|
45
|
+
yargs.option('path', {
|
46
|
+
alias: 'p',
|
47
|
+
describe: 'Path to config file',
|
48
|
+
type: 'string',
|
49
|
+
demandOption: true
|
50
|
+
})
|
51
|
+
}, async () => {
|
52
|
+
console.info(chalk.magenta.bold('Generating Nest js Source project with options:'));
|
53
|
+
console.info(chalk.red.bold('!!! Comming soon'));
|
54
|
+
});
|
55
|
+
}, (argv) => {
|
56
|
+
console.info('argv for daevin');
|
57
|
+
console.info(argv);
|
58
|
+
})
|
59
|
+
.demandCommand(1)
|
60
|
+
.parse();
|
61
|
+
|
62
|
+
const questions = [
|
63
|
+
{
|
64
|
+
type: 'list',
|
65
|
+
name: 'command',
|
66
|
+
message: 'Which command would you like to execute?',
|
67
|
+
choices: ['apiato', 'nestjs'],
|
68
|
+
},
|
69
|
+
{
|
70
|
+
type: 'input',
|
71
|
+
name: 'path',
|
72
|
+
message: 'Enter the path to the configuration file:',
|
73
|
+
when: (answers) => answers.command === 'apiato',
|
74
|
+
},
|
75
|
+
];
|
76
|
+
|
77
|
+
inquirer.prompt(questions).then(async (answers) => {
|
78
|
+
if (answers.command === 'apiato') {
|
79
|
+
if (answers.path === '') {
|
80
|
+
console.info(chalk.red.bold('No config path provided.'));
|
81
|
+
process.exit(1);
|
82
|
+
}
|
83
|
+
console.info(chalk.magenta.bold('Generating Apiato Source project with options:'));
|
84
|
+
const absolutePath = path.resolve(answers.path);
|
85
|
+
const fileData = await fs.readFile(absolutePath, 'utf8');
|
86
|
+
const db_config = JSON.parse(fileData);
|
87
|
+
|
88
|
+
Helpers.loadDBConfigs(db_config);
|
89
|
+
|
90
|
+
await generateApiatoproject();
|
91
|
+
|
92
|
+
|
93
|
+
console.info(chalk.bgGreenBright.bold('Code generation Completed !'));
|
94
|
+
} else if (answers.command === 'nestjs') {
|
95
|
+
console.info(chalk.magenta.bold('Generating Nest js Source project with options:'));
|
96
|
+
console.info(chalk.red.bold('!!! Coming soon'));
|
97
|
+
}
|
98
|
+
});
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
package/dbconfig.json
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
{
|
2
|
+
"project": "Daevin_test",
|
3
|
+
"database" : "test_db",
|
4
|
+
"host": "",
|
5
|
+
"username": "",
|
6
|
+
"password": "",
|
7
|
+
"tables": [
|
8
|
+
{
|
9
|
+
"table_name": "users",
|
10
|
+
"columns": [
|
11
|
+
{
|
12
|
+
"column_name": "email",
|
13
|
+
"type": "string",
|
14
|
+
"properties": ["unique", "string", "max:40"],
|
15
|
+
"is_searchable": true
|
16
|
+
},
|
17
|
+
{
|
18
|
+
"column_name": "is_active",
|
19
|
+
"type": "boolean",
|
20
|
+
"properties": ["notNull"],
|
21
|
+
"is_searchable": true
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"column_name": "password",
|
25
|
+
"type": "string",
|
26
|
+
"properties": ["notNull", "min:8", "max:20", "string", "hidden" ]
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"column_name": "name",
|
30
|
+
"type": "string",
|
31
|
+
"properties": ["string"]
|
32
|
+
}
|
33
|
+
],
|
34
|
+
"relations": [
|
35
|
+
{
|
36
|
+
"table": "post",
|
37
|
+
"relation": "hasMany",
|
38
|
+
"foreignKey": "user_id"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"table_name": "posts",
|
44
|
+
"columns": [
|
45
|
+
{
|
46
|
+
"column_name": "message",
|
47
|
+
"type": "string",
|
48
|
+
"properties": [ "min:8"],
|
49
|
+
"is_searchable": true
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"column_name": "user_id",
|
53
|
+
"type": "string",
|
54
|
+
"properties": [ "min:8"],
|
55
|
+
"is_searchable": true
|
56
|
+
},
|
57
|
+
{
|
58
|
+
"column_name": "reposted_by",
|
59
|
+
"type": "array",
|
60
|
+
"properties": ["nullable"],
|
61
|
+
"is_searchable": true
|
62
|
+
}
|
63
|
+
],
|
64
|
+
"relations": [
|
65
|
+
{
|
66
|
+
"table": "users",
|
67
|
+
"relation": "belongsTo",
|
68
|
+
"foreignKey": "user_id"
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
72
|
+
]
|
73
|
+
|
74
|
+
}
|