├── packages ├── server │ ├── input │ │ └── test.json │ ├── config │ │ ├── database │ │ │ └── test │ │ └── db.js │ ├── .gitignore │ ├── constants │ │ ├── queryBuilder.js │ │ ├── master.js │ │ ├── envVariables.js │ │ ├── jsonInput.js │ │ └── dataTypes │ │ │ ├── sequelize │ │ │ ├── index.js │ │ │ ├── postGreSqlDataTypes.js │ │ │ ├── sqlDataTypes.js │ │ │ └── mySqlDataTypes.js │ │ │ └── props.js │ ├── usecase │ │ ├── application │ │ │ ├── node-generator │ │ │ │ ├── templates │ │ │ │ │ ├── mvc │ │ │ │ │ │ ├── .gitignore │ │ │ │ │ │ ├── .env.ejs │ │ │ │ │ │ ├── customEnv.ejs │ │ │ │ │ │ ├── config │ │ │ │ │ │ │ ├── requestConstant.js.ejs │ │ │ │ │ │ │ └── db.js.ejs │ │ │ │ │ │ ├── individualRoutes │ │ │ │ │ │ │ ├── existIndexRoute.js.ejs │ │ │ │ │ │ │ ├── indexRoutes.js.ejs │ │ │ │ │ │ │ ├── platformIndexRoutes.js.ejs │ │ │ │ │ │ │ └── service.js.ejs │ │ │ │ │ │ ├── utils │ │ │ │ │ │ │ ├── response │ │ │ │ │ │ │ │ ├── responseCode.js │ │ │ │ │ │ │ │ └── responseStatus.js │ │ │ │ │ │ │ └── validateRequest.js │ │ │ │ │ │ ├── routes │ │ │ │ │ │ │ ├── commonIndexRoutes.js.ejs │ │ │ │ │ │ │ └── platformIndexRoutes.js.ejs │ │ │ │ │ │ ├── middleware │ │ │ │ │ │ │ └── sampleMiddleware.js.ejs │ │ │ │ │ │ └── views │ │ │ │ │ │ │ └── resetPassword.ejs │ │ │ │ │ ├── cleanCode │ │ │ │ │ │ ├── .gitignore │ │ │ │ │ │ ├── config │ │ │ │ │ │ │ ├── requestConstant.js.ejs │ │ │ │ │ │ │ └── db.js.ejs │ │ │ │ │ │ ├── .env.ejs │ │ │ │ │ │ ├── customEnv.ejs │ │ │ │ │ │ ├── individualRoutes │ │ │ │ │ │ │ ├── existIndexRoute.js.ejs │ │ │ │ │ │ │ ├── indexRoutes.js.ejs │ │ │ │ │ │ │ ├── platformIndexRoutes.js.ejs │ │ │ │ │ │ │ ├── service.js.ejs │ │ │ │ │ │ │ └── controller.js.ejs │ │ │ │ │ │ ├── utils │ │ │ │ │ │ │ ├── response │ │ │ │ │ │ │ │ ├── responseCode.js │ │ │ │ │ │ │ │ └── responseStatus.js │ │ │ │ │ │ │ ├── convertObjectToEnum.js │ │ │ │ │ │ │ ├── generateRandomNumber.js │ │ │ │ │ │ │ ├── generateToken.js │ │ │ │ │ │ │ └── makeDirectory.js │ │ │ │ │ │ ├── routes │ │ │ │ │ │ │ ├── commonIndexRoutes.js.ejs │ │ │ │ │ │ │ ├── platformIndexRoutes.js.ejs │ │ │ │ │ │ │ └── index.js.ejs │ │ │ │ │ │ ├── controllers │ │ │ │ │ │ │ ├── fileUploadControllerIndex.js.ejs │ │ │ │ │ │ │ └── fileUploadController.js.ejs │ │ │ │ │ │ ├── middleware │ │ │ │ │ │ │ ├── sampleMiddleware.js.ejs │ │ │ │ │ │ │ └── index.js.ejs │ │ │ │ │ │ ├── validation │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ └── validateSchema.js.ejs │ │ │ │ │ │ ├── use-case │ │ │ │ │ │ │ ├── customRouteOfModel.js.ejs │ │ │ │ │ │ │ ├── count.js.ejs │ │ │ │ │ │ │ ├── findById.js.ejs │ │ │ │ │ │ │ ├── bulkUpdate.js.ejs │ │ │ │ │ │ │ ├── partialUpdate.js.ejs │ │ │ │ │ │ │ └── authentication │ │ │ │ │ │ │ │ └── authentication.js.ejs │ │ │ │ │ │ ├── data-access │ │ │ │ │ │ │ ├── sequenceDb.js.ejs │ │ │ │ │ │ │ └── dbFile.js.ejs │ │ │ │ │ │ ├── helpers │ │ │ │ │ │ │ └── date.js │ │ │ │ │ │ └── views │ │ │ │ │ │ │ └── resetPassword.ejs │ │ │ │ │ ├── mvcSequelize │ │ │ │ │ │ ├── .gitignore │ │ │ │ │ │ ├── .env.ejs │ │ │ │ │ │ ├── customEnv.ejs │ │ │ │ │ │ ├── config │ │ │ │ │ │ │ ├── requestConstant.js.ejs │ │ │ │ │ │ │ ├── dbConnection.js.ejs │ │ │ │ │ │ │ └── db.js.ejs │ │ │ │ │ │ ├── individualRoutes │ │ │ │ │ │ │ ├── existIndexRoute.js.ejs │ │ │ │ │ │ │ ├── indexRoutes.js.ejs │ │ │ │ │ │ │ ├── platformIndexRoutes.js.ejs │ │ │ │ │ │ │ └── service.js.ejs │ │ │ │ │ │ ├── utils │ │ │ │ │ │ │ ├── response │ │ │ │ │ │ │ │ ├── responseCode.js │ │ │ │ │ │ │ │ └── responseStatus.js │ │ │ │ │ │ │ └── validateRequest.js │ │ │ │ │ │ ├── routes │ │ │ │ │ │ │ ├── commonIndexRoutes.js.ejs │ │ │ │ │ │ │ ├── platformIndexRoutes.js.ejs │ │ │ │ │ │ │ └── index.js.ejs │ │ │ │ │ │ ├── middleware │ │ │ │ │ │ │ └── sampleMiddleware.js.ejs │ │ │ │ │ │ ├── services │ │ │ │ │ │ │ └── customQueryService.js.ejs │ │ │ │ │ │ └── views │ │ │ │ │ │ │ └── resetPassword.ejs │ │ │ │ │ ├── cleanCodeSequelize │ │ │ │ │ │ ├── .gitignore │ │ │ │ │ │ ├── config │ │ │ │ │ │ │ ├── requestConstant.js.ejs │ │ │ │ │ │ │ ├── dbConnection.js.ejs │ │ │ │ │ │ │ └── db.js.ejs │ │ │ │ │ │ ├── .env.ejs │ │ │ │ │ │ ├── customEnv.ejs │ │ │ │ │ │ ├── individualRoutes │ │ │ │ │ │ │ ├── existIndexRoute.js.ejs │ │ │ │ │ │ │ ├── indexRoutes.js.ejs │ │ │ │ │ │ │ ├── platformIndexRoutes.js.ejs │ │ │ │ │ │ │ ├── service.js.ejs │ │ │ │ │ │ │ └── controller.js.ejs │ │ │ │ │ │ ├── utils │ │ │ │ │ │ │ ├── responseCode.js │ │ │ │ │ │ │ ├── response │ │ │ │ │ │ │ │ ├── responseCode.js │ │ │ │ │ │ │ │ └── responseStatus.js │ │ │ │ │ │ │ ├── convertObjectToEnum.js │ │ │ │ │ │ │ ├── generateRandomNumber.js │ │ │ │ │ │ │ ├── generateToken.js │ │ │ │ │ │ │ ├── makeDirectory.js │ │ │ │ │ │ │ ├── validateRequest.js │ │ │ │ │ │ │ └── replaceAll.js │ │ │ │ │ │ ├── routes │ │ │ │ │ │ │ ├── commonIndexRoutes.js.ejs │ │ │ │ │ │ │ ├── platformIndexRoutes.js.ejs │ │ │ │ │ │ │ └── index.js.ejs │ │ │ │ │ │ ├── controllers │ │ │ │ │ │ │ ├── fileUploadControllerIndex.js.ejs │ │ │ │ │ │ │ └── fileUploadController.js.ejs │ │ │ │ │ │ ├── middleware │ │ │ │ │ │ │ └── sampleMiddleware.js.ejs │ │ │ │ │ │ ├── validation │ │ │ │ │ │ │ ├── index.js │ │ │ │ │ │ │ └── genericValidator.js │ │ │ │ │ │ ├── use-case │ │ │ │ │ │ │ ├── findById.js.ejs │ │ │ │ │ │ │ ├── authentication │ │ │ │ │ │ │ │ ├── logout.js.ejs │ │ │ │ │ │ │ │ ├── authentication.js.ejs │ │ │ │ │ │ │ │ └── validateResetPasswordOtp.js.ejs │ │ │ │ │ │ │ ├── customRouteOfModel.js.ejs │ │ │ │ │ │ │ ├── partialUpdate.js.ejs │ │ │ │ │ │ │ ├── count.js.ejs │ │ │ │ │ │ │ ├── bulkUpdate.js.ejs │ │ │ │ │ │ │ ├── findAll.js.ejs │ │ │ │ │ │ │ └── createBulk.js.ejs │ │ │ │ │ │ ├── services │ │ │ │ │ │ │ └── customQueryService.js.ejs │ │ │ │ │ │ ├── helpers │ │ │ │ │ │ │ └── date.js │ │ │ │ │ │ ├── data-access │ │ │ │ │ │ │ └── dbFile.js.ejs │ │ │ │ │ │ └── views │ │ │ │ │ │ │ └── resetPassword.ejs │ │ │ │ │ └── logs │ │ │ │ │ │ └── error.log.ejs │ │ │ │ └── createApplication │ │ │ │ │ ├── makeCustomPolicy.js │ │ │ │ │ ├── generateFakeData │ │ │ │ │ └── fakeDataType.js │ │ │ │ │ ├── generateFakeDataSequelize │ │ │ │ │ └── fakeDataType.js │ │ │ │ │ ├── createCommonRoutes │ │ │ │ │ └── index.js │ │ │ │ │ ├── createDataAccessFiles │ │ │ │ │ └── index.js │ │ │ │ │ ├── applyEslint.js │ │ │ │ │ └── createEntities.js │ │ │ ├── getLastApplication.js │ │ │ ├── openCode.js │ │ │ ├── delete.js │ │ │ └── actionWiseCount.js │ │ ├── projectRoleAccessPermissions │ │ │ ├── util │ │ │ │ └── index.js │ │ │ └── delete.js │ │ ├── util │ │ │ ├── getBaseUrl.js │ │ │ ├── randomNumber.js │ │ │ └── validation │ │ │ │ ├── projectUpsert.js │ │ │ │ ├── schemaDetail.js │ │ │ │ ├── applicationUpsert.js │ │ │ │ ├── applicationId.js │ │ │ │ ├── accessPermission.js │ │ │ │ ├── group.js │ │ │ │ └── actionValidation.js │ │ ├── schema │ │ │ ├── util │ │ │ │ ├── isRegExp.js │ │ │ │ └── index.js │ │ │ ├── dataTypeSuggestions.js │ │ │ ├── get.js │ │ │ └── delete.js │ │ ├── jsonInput │ │ │ └── util │ │ │ │ └── index.js │ │ ├── project │ │ │ ├── noOfProjectAndApplication.js │ │ │ ├── archivedProjects.js │ │ │ └── delete.js │ │ ├── queryBuilder │ │ │ ├── insertMany.js │ │ │ └── delete.js │ │ ├── nestedQueryBuilder │ │ │ ├── insertMany.js │ │ │ └── delete.js │ │ ├── projectRoute │ │ │ └── delete.js │ │ ├── schemaDetail │ │ │ └── delete.js │ │ ├── applicationConfig │ │ │ └── deleteDependency.js │ │ ├── projectPolicy │ │ │ └── delete.js │ │ ├── generator │ │ │ └── deleteDependency.js │ │ └── projectConstant │ │ │ └── delete.js │ ├── models │ │ ├── constants │ │ │ ├── projectDefinition.js │ │ │ ├── method.js │ │ │ ├── master.js │ │ │ ├── action.js │ │ │ ├── jobQueue.js │ │ │ ├── activityLog.js │ │ │ ├── version.js │ │ │ └── applicationConfig.js │ │ ├── responses │ │ │ ├── index.js │ │ │ ├── setResponse.js │ │ │ ├── error.js │ │ │ ├── ok.js │ │ │ ├── forbidden.js │ │ │ ├── notFound.js │ │ │ ├── badRequest.js │ │ │ ├── serverError.js │ │ │ └── unauthorized.js │ │ ├── Models │ │ │ └── Queue.js │ │ └── usecase │ │ │ └── getSetting.js │ ├── util-service │ │ ├── common │ │ │ ├── index.js │ │ │ └── common.js │ │ └── crypto │ │ │ ├── index.js │ │ │ └── crypto.js │ ├── routes │ │ ├── web │ │ │ ├── master │ │ │ │ ├── index.js │ │ │ │ └── master.js │ │ │ ├── schema │ │ │ │ ├── index.js │ │ │ │ └── schema.js │ │ │ ├── project │ │ │ │ ├── index.js │ │ │ │ └── project.js │ │ │ ├── jsonInput │ │ │ │ ├── index.js │ │ │ │ └── jsonInput.js │ │ │ ├── schemaDetail │ │ │ │ ├── index.js │ │ │ │ └── schemaDetail.js │ │ │ ├── application │ │ │ │ ├── index.js │ │ │ │ └── application.js │ │ │ ├── projectRoute │ │ │ │ ├── index.js │ │ │ │ └── projectRoute.js │ │ │ ├── envVariables │ │ │ │ ├── index.js │ │ │ │ └── envVariables.js │ │ │ ├── applicationConfig │ │ │ │ ├── index.js │ │ │ │ └── applicationConfig.js │ │ │ ├── projectPolicy │ │ │ │ ├── index.js │ │ │ │ └── projectPolicy.js │ │ │ ├── projectConstant │ │ │ │ ├── index.js │ │ │ │ └── projectConstant.js │ │ │ └── projectRoleAccessPermissions │ │ │ │ ├── index.js │ │ │ │ └── projectRoleAccessPermissions.js │ │ └── index.js │ ├── controllers │ │ └── web │ │ │ ├── jsonInput │ │ │ ├── jsonInput.js │ │ │ └── index.js │ │ │ ├── master │ │ │ ├── master.js │ │ │ └── index.js │ │ │ ├── envVariables │ │ │ ├── envVariables.js │ │ │ └── index.js │ │ │ ├── projectRoleAccessPermissions │ │ │ └── roleAccessPermissions.js │ │ │ ├── schemaDetail │ │ │ └── schemaDetail.js │ │ │ ├── projectPolicy │ │ │ └── projectPolicy.js │ │ │ └── projectConstant │ │ │ └── projectConstant.js │ ├── repo │ │ ├── port.js │ │ ├── project.js │ │ ├── schema.js │ │ ├── envVariables.js │ │ ├── generate.js │ │ ├── application.js │ │ ├── schemaDetail.js │ │ ├── projectPolicy.js │ │ ├── projectRoute.js │ │ ├── queryBuilder.js │ │ ├── projectConstant.js │ │ ├── applicationConfig.js │ │ ├── nestedQueryBuilder.js │ │ ├── dataTypeSuggestions.js │ │ └── projectRoleAccessPermissions.js │ ├── responses │ │ └── index.js │ └── middleware │ │ └── responses │ │ └── ok.js └── client │ ├── src │ ├── assets │ │ ├── css │ │ │ ├── main.css │ │ │ ├── popoverCss.js │ │ │ ├── Table1.css │ │ │ ├── components │ │ │ │ └── components.css │ │ │ ├── tooltip.css │ │ │ ├── logo.css │ │ │ ├── tableViewCss.js │ │ │ └── dropdown.css │ │ ├── images │ │ │ ├── logo.png │ │ │ └── gif │ │ │ │ └── logo-loader.gif │ │ └── fonts │ │ │ └── circular │ │ │ ├── CustomFont-Black.woff2 │ │ │ ├── CustomFont-Bold.woff2 │ │ │ ├── CustomFont-Book.woff2 │ │ │ └── CustomFont-Medium.woff2 │ ├── components │ │ ├── Select │ │ │ └── selectCss.css │ │ ├── CardView │ │ │ ├── card.css │ │ │ └── cardCss.js │ │ ├── hooks │ │ │ ├── index.js │ │ │ └── useBoolean.js │ │ ├── ErrorMsg │ │ │ ├── errorCss.js │ │ │ └── index.js │ │ ├── DropdownMenu │ │ │ ├── index.js │ │ │ └── dropdown.js │ │ ├── MenuList │ │ │ └── menuListCss.js │ │ ├── Label │ │ │ └── index.js │ │ ├── Radio │ │ │ └── radioCss.js │ │ ├── Count │ │ │ └── index.js │ │ ├── Spinner │ │ │ └── index.js │ │ ├── ReactDrawer │ │ │ ├── DrawerClose.js │ │ │ ├── DrawerHead.js │ │ │ └── reactDrawerCss.js │ │ ├── BoxLayout │ │ │ ├── boxLayoutCss.js │ │ │ └── index.js │ │ ├── TextArea │ │ │ └── textareaCss.js │ │ ├── Description │ │ │ ├── descriptionCss.js │ │ │ └── index.js │ │ ├── SidebarMenuList │ │ │ └── sidebarMenuListCss.js │ │ ├── SearchBox │ │ │ ├── searchBoxCss.js │ │ │ └── RecentSearch.js │ │ ├── ContainerBox │ │ │ └── index.js │ │ ├── ListBox │ │ │ └── LIstTitle.js │ │ ├── DatePicker │ │ │ └── datepickerCss.js │ │ ├── Loader │ │ │ └── index.js │ │ ├── Heading │ │ │ ├── index.js │ │ │ └── headingCss.js │ │ ├── ToggleBox │ │ │ └── index.js │ │ ├── MessageNotify │ │ │ └── informessageCss.js │ │ ├── Tag │ │ │ └── tagCss.js │ │ └── LinkTag │ │ │ └── index.js │ ├── constant │ │ ├── policy.js │ │ ├── envVariable.js │ │ ├── common.js │ │ ├── master.js │ │ ├── buildProcessConstant.js │ │ ├── rolePermission.js │ │ └── applicationConstant.js │ ├── container │ │ ├── Shared │ │ │ └── Layout │ │ │ │ ├── Sidebar │ │ │ │ ├── SubSidebar │ │ │ │ │ └── SidebarlistCss.js │ │ │ │ └── sidebarCss.js │ │ │ │ ├── LanguageHeader │ │ │ │ └── languageHeaderCss.js │ │ │ │ └── index.js │ │ ├── common.js │ │ ├── CRUD │ │ │ ├── Modal │ │ │ │ ├── Editor │ │ │ │ │ └── TableView │ │ │ │ │ │ └── TableData │ │ │ │ │ │ ├── RowSuspense.js │ │ │ │ │ │ └── Sortable.js │ │ │ │ ├── Indexing │ │ │ │ │ ├── indexingCss.js │ │ │ │ │ └── Draggable │ │ │ │ │ │ └── useDraggable.js │ │ │ │ └── LibraryPreview │ │ │ │ │ ├── HookSetup │ │ │ │ │ └── HookEditor │ │ │ │ │ │ └── index.js │ │ │ │ │ └── PreviewTable │ │ │ │ │ └── EditableCell.js │ │ │ ├── Routes │ │ │ │ └── AddRoutes │ │ │ │ │ └── QueryBuilder │ │ │ │ │ └── ResponseProvider.js │ │ │ └── Permission │ │ │ │ └── Header.js │ │ ├── hooks │ │ │ ├── useComponentDidMount.js │ │ │ ├── useBoolean.js │ │ │ ├── useComponentWillUnmount.js │ │ │ ├── useQueryParams.js │ │ │ ├── index.js │ │ │ └── useToastNotifications.js │ │ ├── RoleAccess │ │ │ └── RoleAccessList │ │ │ │ └── roleAccessListCss.js │ │ ├── EnvironmentVariable │ │ │ └── enviromentVaribleCss.js │ │ └── Configuration │ │ │ └── CodeGenerateConfiguration │ │ │ ├── DataFormatConfig │ │ │ └── Head │ │ │ │ └── index.js │ │ │ └── CodeGenerateConfiguration.loader.js │ ├── api │ │ ├── index.js │ │ ├── master.js │ │ ├── envVariable.js │ │ ├── projectRoleAccess.js │ │ ├── policy.js │ │ ├── applicationConfig.js │ │ ├── routes.js │ │ ├── applicationPolicy.js │ │ ├── applicationConstant.js │ │ ├── project.js │ │ └── models.js │ ├── setupTests.js │ ├── redux │ │ ├── thunks │ │ │ ├── policy.js │ │ │ ├── constants.js │ │ │ ├── buildCode.js │ │ │ └── models.js │ │ ├── reducers │ │ │ └── index.js │ │ └── store.js │ ├── utils │ │ ├── mergeRefs.js │ │ ├── dataTypes.js │ │ ├── applicationPlatform.js │ │ ├── localStorage.js │ │ └── validationMsgs.js │ ├── config │ │ ├── Loader.js │ │ └── LazyLoader.js │ ├── index.css │ ├── reportWebVitals.js │ ├── index.js │ └── App.css │ ├── .env │ ├── public │ ├── robots.txt │ ├── favicon.ico │ ├── logo192.png │ ├── logo512.png │ └── manifest.json │ ├── README.md │ ├── postcss.config.js │ ├── babel-plugin-macros.config.js │ ├── babel.config.json │ ├── .gitignore │ └── config-overrides.js ├── .gitignore ├── lerna.json └── .github ├── workflows └── eslint.yml └── ISSUE_TEMPLATE ├── feature_request.md └── bug_report.md /packages/server/input/test.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/server/config/database/test: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/client/src/assets/css/main.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/client/src/components/Select/selectCss.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | package-lock.json 3 | .history -------------------------------------------------------------------------------- /packages/server/.gitignore: -------------------------------------------------------------------------------- 1 | config/database 2 | input 3 | output -------------------------------------------------------------------------------- /packages/client/.env: -------------------------------------------------------------------------------- 1 | REACT_APP_PROJECT_SERVICE_URL='http://localhost:3053' 2 | -------------------------------------------------------------------------------- /packages/server/constants/queryBuilder.js: -------------------------------------------------------------------------------- 1 | module.exports = { TYPES: { ROUTES: 1 } }; 2 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dhiwise -------------------------------------------------------------------------------- /packages/client/src/components/CardView/card.css: -------------------------------------------------------------------------------- 1 | .groupbox:hover .perviewHover{ 2 | opacity: 0.8; 3 | } -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dhiwise -------------------------------------------------------------------------------- /packages/client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dhiwise -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .dhiwise -------------------------------------------------------------------------------- /packages/client/src/constant/policy.js: -------------------------------------------------------------------------------- 1 | export const POLICY_GENERATE_TYPE = { 2 | AUTO: 1, 3 | MANUAL: 2, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/public/favicon.ico -------------------------------------------------------------------------------- /packages/client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/public/logo192.png -------------------------------------------------------------------------------- /packages/client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/public/logo512.png -------------------------------------------------------------------------------- /packages/client/src/components/hooks/index.js: -------------------------------------------------------------------------------- 1 | import useBoolean from './useBoolean'; 2 | 3 | export { 4 | useBoolean, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/server/models/constants/projectDefinition.js: -------------------------------------------------------------------------------- 1 | module.exports = { PROJECT_DEFINITION_CODE: { NODE_EXPRESS: 'NODE_EXPRESS' } }; 2 | -------------------------------------------------------------------------------- /packages/client/src/assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/src/assets/images/logo.png -------------------------------------------------------------------------------- /packages/client/src/components/ErrorMsg/errorCss.js: -------------------------------------------------------------------------------- 1 | export const errorCss = { 2 | errorClass: 'text-error text-sm mt-1 block', 3 | }; 4 | -------------------------------------------------------------------------------- /packages/client/src/container/Shared/Layout/Sidebar/SubSidebar/SidebarlistCss.js: -------------------------------------------------------------------------------- 1 | export const SidebarListCss = { 2 | sidebar: '', 3 | }; 4 | -------------------------------------------------------------------------------- /packages/server/constants/master.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | PARENT_CODES: { 3 | EMAIL: 'EMAIL', 4 | SMS: 'SMS', 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/config/requestConstant.js.ejs: -------------------------------------------------------------------------------- 1 | module.exports=<%=JSON.parse(CONSTANTS)%> 2 | -------------------------------------------------------------------------------- /packages/server/constants/envVariables.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | QA: 'QA', 3 | DEVELOPMENT: 'DEVELOPMENT', 4 | PRODUCTION: 'PRODUCTION', 5 | }; 6 | -------------------------------------------------------------------------------- /packages/server/util-service/common/index.js: -------------------------------------------------------------------------------- 1 | const { getAllDirFilesCount } = require('./common'); 2 | 3 | module.exports = { getAllDirFilesCount }; 4 | -------------------------------------------------------------------------------- /packages/server/constants/jsonInput.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | JSON_INPUT: { 3 | AUTH_MODEL: 'user', 4 | PROJECT_TYPE: 'MVC', 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/config/requestConstant.js.ejs: -------------------------------------------------------------------------------- 1 | module.exports=<%=JSON.parse(CONSTANTS)%> 2 | -------------------------------------------------------------------------------- /packages/client/src/api/index.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from './config'; 2 | import { API_URLS } from './constants'; 3 | 4 | export { apiClient, API_URLS }; 5 | -------------------------------------------------------------------------------- /packages/client/src/assets/css/popoverCss.js: -------------------------------------------------------------------------------- 1 | export const PopoverCss = { 2 | popoverWrap: ' relative p-3 bg-popover shadows-dw rounded z-1000000', 3 | }; 4 | -------------------------------------------------------------------------------- /packages/server/models/constants/method.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | PUT: 'PUT', 4 | POST: 'POST', 5 | GET: 'GET', 6 | DELETE: 'DELETE', 7 | 8 | }; 9 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/.env.ejs: -------------------------------------------------------------------------------- 1 | <%_for(const [key,value] of Object.entries(ENV)) {_%> 2 | <%-key%>=<%-value%> 3 | <%_}_%> -------------------------------------------------------------------------------- /packages/client/src/assets/images/gif/logo-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/src/assets/images/gif/logo-loader.gif -------------------------------------------------------------------------------- /packages/server/models/constants/master.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | MASTER_MEDIUM: { GENERAL: 1 }, 3 | MASTER_PARENT_CODES: { SOCIAL_AUTH: 'SOCIAL_AUTH' }, 4 | }; 5 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/.env.ejs: -------------------------------------------------------------------------------- 1 | <%_for(const [key,value] of Object.entries(ENV)) {_%> 2 | <%-key%>=<%-value%> 3 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/.env.ejs: -------------------------------------------------------------------------------- 1 | <%_for(const [key,value] of Object.entries(ENV)) {_%> 2 | <%-key%>=<%-value%> 3 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/.env.ejs: -------------------------------------------------------------------------------- 1 | <%_for(const [key,value] of Object.entries(ENV)) {_%> 2 | <%-key%>=<%-value%> 3 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/customEnv.ejs: -------------------------------------------------------------------------------- 1 | <%_for(const [key,value] of Object.entries(CUSTOM_ENV)) {_%> 2 | <%-key%>=<%-value%> 3 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/util-service/crypto/index.js: -------------------------------------------------------------------------------- 1 | const { 2 | encrypt, decrypt, 3 | } = require('./crypto'); 4 | 5 | module.exports = { 6 | encrypt, 7 | decrypt, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/customEnv.ejs: -------------------------------------------------------------------------------- 1 | <%_for(const [key,value] of Object.entries(CUSTOM_ENV)) {_%> 2 | <%-key%>=<%-value%> 3 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/customEnv.ejs: -------------------------------------------------------------------------------- 1 | <%_for(const [key,value] of Object.entries(CUSTOM_ENV)) {_%> 2 | <%-key%>=<%-value%> 3 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/usecase/projectRoleAccessPermissions/util/index.js: -------------------------------------------------------------------------------- 1 | const RemoveModelDetails = require('./RemoveModelDetails'); 2 | 3 | module.exports = { RemoveModelDetails }; 4 | -------------------------------------------------------------------------------- /packages/client/src/assets/fonts/circular/CustomFont-Black.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/src/assets/fonts/circular/CustomFont-Black.woff2 -------------------------------------------------------------------------------- /packages/client/src/assets/fonts/circular/CustomFont-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/src/assets/fonts/circular/CustomFont-Bold.woff2 -------------------------------------------------------------------------------- /packages/client/src/assets/fonts/circular/CustomFont-Book.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/src/assets/fonts/circular/CustomFont-Book.woff2 -------------------------------------------------------------------------------- /packages/client/src/assets/fonts/circular/CustomFont-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DhiWise/dhiwise-nodejs/HEAD/packages/client/src/assets/fonts/circular/CustomFont-Medium.woff2 -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/config/requestConstant.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * <%-FILE_NAME%>.js 3 | */ 4 | 5 | module.exports=<%=JSON.parse(CONSTANTS)%> 6 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/customEnv.ejs: -------------------------------------------------------------------------------- 1 | <%_for(const [key,value] of Object.entries(CUSTOM_ENV)) {_%> 2 | <%-key%>=<%-value%> 3 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/individualRoutes/existIndexRoute.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ ROUTES.forEach((v,i)=>{ _%> 2 | router.use("/",require("./<%-v%>/index")); 3 | <%_ }) _%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/config/requestConstant.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * <%-FILE_NAME%>.js 3 | */ 4 | 5 | module.exports=<%=JSON.parse(CONSTANTS)%> 6 | -------------------------------------------------------------------------------- /packages/client/src/components/DropdownMenu/index.js: -------------------------------------------------------------------------------- 1 | import DropdownMenu from './DropdownMenu'; 2 | import MenuItem from './MenuItem'; 3 | 4 | export { 5 | DropdownMenu, 6 | MenuItem, 7 | }; 8 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/individualRoutes/existIndexRoute.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ ROUTES.forEach((v,i)=>{ _%> 2 | router.use("/",require("./<%-v%>/index")); 3 | <%_ }) _%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/individualRoutes/existIndexRoute.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ ROUTES.forEach((v,i)=>{ _%> 2 | router.use("/<%-v%>",require("./<%-v%>/index")); 3 | <%_ }) _%> -------------------------------------------------------------------------------- /packages/client/src/api/master.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from './config'; 2 | import { API_URLS } from './constants'; 3 | 4 | export const fetchByCode = (payload) => apiClient(API_URLS.master.getByCode, payload); 5 | -------------------------------------------------------------------------------- /packages/server/models/constants/action.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | VIEW: 'VIEW', 3 | UPDATE: 'UPDATE', 4 | DELETE: 'DELETE', 5 | CREATE: 'CREATE', 6 | DOWNLOAD: 'DOWNLOAD', 7 | BUILD: 'BUILD', 8 | }; 9 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/individualRoutes/existIndexRoute.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ ROUTES.forEach((v,i)=>{ _%> 2 | router.use("/<%-v%>",require("./<%-v%>/index")); 3 | <%_ }) _%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/individualRoutes/indexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ ROUTES.forEach((v,i)=>{ _%> 2 | router.use("/",require("./<%-v.platform.toLowerCase()%>Route")); 3 | <%_ }) _%> -------------------------------------------------------------------------------- /packages/client/src/components/MenuList/menuListCss.js: -------------------------------------------------------------------------------- 1 | export const MenulistCss = { 2 | menuItem: 'flex items-center hover:bg-gray-100 ', 3 | menuListLink: 'pt-2 pb-2 pl-3 pr-3', 4 | menuSpace: 'pt-2 pb-2 pl-3 pr-3', 5 | }; 6 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/individualRoutes/indexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | 2 | <%_ ROUTES.forEach(function(route){ _%> 3 | router.use("/<%-route%>",require("./<%-route%>Routes")) 4 | <%_ })_%> 5 | -------------------------------------------------------------------------------- /packages/server/routes/web/master/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const master = require('./master'); 5 | 6 | router.use('/master', master); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/server/routes/web/schema/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const schema = require('./schema'); 5 | 6 | router.use('/schema', schema); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/client/README.md: -------------------------------------------------------------------------------- 1 | # Client 2 | 3 | This is a node code generator panel by using you can give input's and generate code. 4 | 5 | ## Run 6 | ##### `npm start` 7 | 8 | Open http://localhost:3000 to view it in the browser. 9 | -------------------------------------------------------------------------------- /packages/client/src/container/common.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | function Common() { 4 | return ( 5 |
6 | Hello.....Welcome To DhiWise 7 |
8 | ); 9 | } 10 | 11 | export default Common; 12 | -------------------------------------------------------------------------------- /packages/server/routes/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const webRoute = require('./web'); 6 | 7 | router.use('/web', webRoute); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /packages/server/routes/web/project/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const project = require('./project'); 5 | 6 | router.use('/project', project); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/individualRoutes/indexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | 2 | <%_ ROUTES.forEach(function(route){ _%> 3 | router.use("/<%-route%>",require("./<%-route%>Routes")) 4 | <%_ })_%> 5 | -------------------------------------------------------------------------------- /packages/server/routes/web/jsonInput/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const jsonInput = require('./jsonInput'); 5 | 6 | router.use('/json-input', jsonInput); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/server/routes/web/schemaDetail/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const schema = require('./schemaDetail'); 5 | 6 | router.use('/schema-detail', schema); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/server/routes/web/application/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const application = require('./application'); 5 | 6 | router.use('/application', application); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/client/src/components/Label/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export const LabelBox = ({ children, className }) => ( 4 | 5 | ); 6 | -------------------------------------------------------------------------------- /packages/server/controllers/web/jsonInput/jsonInput.js: -------------------------------------------------------------------------------- 1 | const jsonInput = ({ jsonInputUseCase }) => async (req, res) => { 2 | const response = await jsonInputUseCase(req.body); 3 | return res.setResponse(response); 4 | }; 5 | 6 | module.exports = { jsonInput }; 7 | -------------------------------------------------------------------------------- /packages/server/routes/web/projectRoute/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const projectRoute = require('./projectRoute'); 5 | 6 | router.use('/project-route', projectRoute); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /lerna.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "packages/*" 4 | ], 5 | "npmClient": "npm", 6 | "version": "1.3.1", 7 | "lerna": "4.0.0", 8 | "command": { 9 | "publish": { 10 | "conventionalCommits": true, 11 | "yes": true 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /packages/client/src/constant/envVariable.js: -------------------------------------------------------------------------------- 1 | export const ENV = { 2 | DEVELOPMENT: 'DEVELOPMENT', 3 | QA: 'QA', 4 | PRODUCTION: 'PRODUCTION', 5 | }; 6 | 7 | export const TYPE_OPTIONS = (type) => (type ? Object.keys(type).map((x) => ({ id: type[x], name: x })) : []); 8 | -------------------------------------------------------------------------------- /packages/server/controllers/web/master/master.js: -------------------------------------------------------------------------------- 1 | const getByCode = ({ getByCodeUseCase }) => async (req, res) => { 2 | const response = await getByCodeUseCase(req.body, null, null); 3 | return res.setResponse(response); 4 | }; 5 | 6 | module.exports = { getByCode }; 7 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/utils/response/responseCode.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 200, 3 | badRequest: 400, 4 | internalServerError: 500, 5 | unAuthorized: 401, 6 | notFound: 404, 7 | validationError: 422, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/client/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('tailwindcss'), 5 | require('postcss-nested'), 6 | require('postcss-custom-properties'), 7 | require('autoprefixer'), 8 | ], 9 | }; 10 | -------------------------------------------------------------------------------- /packages/client/src/components/Radio/radioCss.js: -------------------------------------------------------------------------------- 1 | export const radioCss = { 2 | radioLabel: 'text-primary-text text-base block w-full font-normal leading-6', 3 | radioBoxLabel: 'text-primary-text text-sm block w-full font-normal', 4 | radioWrap: 'flex items-center', 5 | }; 6 | -------------------------------------------------------------------------------- /packages/client/src/container/CRUD/Modal/Editor/TableView/TableData/RowSuspense.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const RowSuspense = ({ children }) => Loading...}>{children}; 4 | export default React.memo(RowSuspense); 5 | -------------------------------------------------------------------------------- /packages/client/src/container/Shared/Layout/LanguageHeader/languageHeaderCss.js: -------------------------------------------------------------------------------- 1 | export const languageHeaderCss = { 2 | headWrap: 'bg-gray-200 flex sticky top-0 z-1000000 justify-between', 3 | menuSelect: 'bg-gray-300 hover:bg-gray-300 border-b-2 border-primary-dark', 4 | }; 5 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/utils/response/responseCode.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 200, 3 | badRequest: 400, 4 | internalServerError: 500, 5 | unAuthorized: 401, 6 | notFound: 404, 7 | validationError: 422, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/responseCode.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 200, 3 | badRequest: 400, 4 | internalServerError: 500, 5 | unAuthorized: 401, 6 | notFound: 404, 7 | validationError: 422, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/utils/response/responseCode.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 200, 3 | badRequest: 400, 4 | internalServerError: 500, 5 | unAuthorized: 401, 6 | notFound: 404, 7 | validationError: 422, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/client/babel-plugin-macros.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | twin: { 3 | config: 'tailwind.config.js', 4 | preset: 'styled-components', 5 | autoCssProp: true, 6 | dataTwProp: true, 7 | debugPlugins: false, 8 | debug: false, 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /packages/server/routes/web/envVariables/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const environmentVariables = require('./envVariables'); 5 | 6 | router.use('/env-variables', environmentVariables); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/client/src/components/Count/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export const Count = ({ total, className }) => ( 4 |
5 | {total} 6 |
7 | ); 8 | -------------------------------------------------------------------------------- /packages/server/routes/web/master/master.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { getByCode } = require('../../../controllers/web/master'); 6 | 7 | router.post('/get-by-code', getByCode); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/response/responseCode.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 200, 3 | badRequest: 400, 4 | internalServerError: 500, 5 | unAuthorized: 401, 6 | notFound: 404, 7 | validationError: 422, 8 | }; 9 | -------------------------------------------------------------------------------- /packages/client/src/setupTests.js: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom'; 6 | -------------------------------------------------------------------------------- /packages/server/routes/web/applicationConfig/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const applicationConfig = require('./applicationConfig'); 5 | 6 | router.use('/application-config', applicationConfig); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/server/routes/web/jsonInput/jsonInput.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { jsonInput } = require('../../../controllers/web/jsonInput'); 6 | 7 | router.post('/store', jsonInput); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/individualRoutes/indexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * index.js 3 | * @description :: API routes 4 | */ 5 | 6 | <%_ ROUTES.forEach((v,i)=>{ _%> 7 | router.use("/",require("./<%-v.platform.toLowerCase()%>Route")); 8 | <%_ }) _%> -------------------------------------------------------------------------------- /packages/server/usecase/util/getBaseUrl.js: -------------------------------------------------------------------------------- 1 | const getBaseUrl = () => { 2 | if (process.env.BASE_URL) { 3 | return process.env.BASE_URL; 4 | } 5 | const port = 3053; 6 | const host = 'localhost'; 7 | return `${host}:${port}`; 8 | }; 9 | module.exports = { getBaseUrl }; 10 | -------------------------------------------------------------------------------- /packages/client/src/api/envVariable.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from '.'; 2 | import { API_URLS } from './constants'; 3 | 4 | export const getEnvs = (payload) => apiClient(API_URLS.envVariables.get, payload); 5 | export const upsertEnvs = (payload) => apiClient(API_URLS.envVariables.upsert, payload); 6 | -------------------------------------------------------------------------------- /packages/server/controllers/web/jsonInput/index.js: -------------------------------------------------------------------------------- 1 | const jsonInputUseCase = require('../../../usecase/jsonInput/jsonInput')(); 2 | 3 | const jsonInputData = require('./jsonInput'); 4 | 5 | const jsonInput = jsonInputData.jsonInput({ jsonInputUseCase }); 6 | 7 | module.exports = { jsonInput }; 8 | -------------------------------------------------------------------------------- /packages/server/routes/web/projectPolicy/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const projectPolicyRoute = require('./projectPolicy'); 6 | 7 | router.use('/project-policy', projectPolicyRoute); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/utils/convertObjectToEnum.js: -------------------------------------------------------------------------------- 1 | const convertObjectToEnum = (obj) => { 2 | const enumArr = []; 3 | Object.values(obj).map((val) => enumArr.push(val)); 4 | return enumArr; 5 | }; 6 | 7 | module.exports = convertObjectToEnum; 8 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/routes/commonIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | 4 | <%_ PLATFORM.forEach((p) =>{ _%> 5 | router.use(require("./<%-p%>Routes")); 6 | <%_})_%> 7 | 8 | module.exports = router; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/routes/commonIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | 4 | <%_PLATFORM.forEach((p) =>{ _%> 5 | router.use(require("./<%-p%>Routes")); 6 | <%_ }) _%> 7 | 8 | module.exports = router; -------------------------------------------------------------------------------- /packages/server/routes/web/projectConstant/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const projectConstantRoute = require('./projectConstant'); 6 | 7 | router.use('/project-constant', projectConstantRoute); 8 | 9 | module.exports = router; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/convertObjectToEnum.js: -------------------------------------------------------------------------------- 1 | const convertObjectToEnum = (obj) => { 2 | const enumArr = []; 3 | Object.values(obj).map((val) => enumArr.push(val)); 4 | return enumArr; 5 | }; 6 | 7 | module.exports = convertObjectToEnum; 8 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/routes/commonIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | 4 | <%_ PLATFORM.forEach((p) =>{ _%> 5 | router.use(require("./<%-p%>Routes")); 6 | <%_})_%> 7 | 8 | module.exports = router; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/routes/commonIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | 4 | <%_PLATFORM.forEach((p) =>{ _%> 5 | router.use(require("./<%-p%>Routes")); 6 | <%_ }) _%> 7 | 8 | module.exports = router; -------------------------------------------------------------------------------- /packages/client/src/components/ErrorMsg/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { errorCss } from './errorCss'; 3 | 4 | const ErrorMsg = ({ error, className = '' }) => ( 5 | <> 6 | {error} 7 | 8 | ); 9 | export default ErrorMsg; 10 | -------------------------------------------------------------------------------- /packages/server/repo/port.js: -------------------------------------------------------------------------------- 1 | const { MODULE } = require('../models/constants/common'); 2 | const CommonQueryRepository = require('../models/Repo'); 3 | 4 | class PortRepository extends CommonQueryRepository { 5 | constructor () { 6 | super(MODULE.PORT); 7 | } 8 | } 9 | module.exports = PortRepository; 10 | -------------------------------------------------------------------------------- /packages/client/src/components/DropdownMenu/dropdown.js: -------------------------------------------------------------------------------- 1 | export const DropdownCss = { 2 | dropdownitemWrap: 'relative flex items-center justify-between pr-2 hover:bg-primary-dark hover:text-defaultWhite text-primary-text whitespace-nowrap', 3 | // dropdown-menu 4 | dropdownitem: 'px-2 py-1 block w-full text-sm', 5 | }; 6 | -------------------------------------------------------------------------------- /packages/server/repo/project.js: -------------------------------------------------------------------------------- 1 | const { MODULE } = require('../models/constants/common'); 2 | const CommonQueryRepository = require('../models/Repo'); 3 | 4 | class ProjectRepository extends CommonQueryRepository { 5 | constructor () { 6 | super(MODULE.PROJECT); 7 | } 8 | } 9 | module.exports = ProjectRepository; 10 | -------------------------------------------------------------------------------- /packages/server/repo/schema.js: -------------------------------------------------------------------------------- 1 | const MongoAtlasRepository = require('../models/Repo'); 2 | const { MODULE } = require('../models/constants/common'); 3 | 4 | class SchemaRepository extends MongoAtlasRepository { 5 | constructor () { 6 | super(MODULE.SCHEMA); 7 | } 8 | } 9 | 10 | module.exports = SchemaRepository; 11 | -------------------------------------------------------------------------------- /packages/server/responses/index.js: -------------------------------------------------------------------------------- 1 | const { 2 | ok, badRequest, serverError, forbidden, notFound, setResponse, unauthorized, 3 | } = require('../models/responses'); 4 | 5 | module.exports = { 6 | ok, 7 | badRequest, 8 | serverError, 9 | notFound, 10 | forbidden, 11 | unauthorized, 12 | setResponse, 13 | }; 14 | -------------------------------------------------------------------------------- /packages/client/src/components/Spinner/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './spinner.css'; 3 | 4 | export function Spinner({ className }) { 5 | return ( 6 |
7 |
8 |
9 |
10 |
11 |
12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /packages/client/src/container/hooks/useComponentDidMount.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | // usage: useComponentDidMount(() => console.log('Component did mount')); 3 | const useComponentDidMount = (onMountHandler) => { 4 | React.useEffect(() => { 5 | onMountHandler(); 6 | }, []); 7 | }; 8 | export default useComponentDidMount; 9 | -------------------------------------------------------------------------------- /packages/server/constants/dataTypes/sequelize/index.js: -------------------------------------------------------------------------------- 1 | const sqlDataTypes = require('./sqlDataTypes'); 2 | const mySqlDataTypes = require('./mySqlDataTypes'); 3 | const postGreSqlDataTypes = require('./postGreSqlDataTypes'); 4 | 5 | module.exports = { 6 | sqlDataTypes, 7 | mySqlDataTypes, 8 | postGreSqlDataTypes, 9 | }; 10 | -------------------------------------------------------------------------------- /packages/server/models/constants/jobQueue.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | JOB_QUEUE: { 3 | STATUS: { 4 | IN_QUEUE: 1, 5 | PROCESSING: 2, 6 | FINISHED: 3, 7 | FAILED: 4, 8 | ON_HOLD: 5, 9 | }, 10 | TYPE: { 11 | ORDER_GENERATE: 1, 12 | TODO_ACTION: 2, 13 | }, 14 | }, 15 | }; 16 | -------------------------------------------------------------------------------- /packages/server/repo/envVariables.js: -------------------------------------------------------------------------------- 1 | const MongoAtlasRepository = require('../models/Repo'); 2 | const { MODULE } = require('../models/constants/common'); 3 | 4 | class envVariables extends MongoAtlasRepository { 5 | constructor () { 6 | super(MODULE.ENV_VARIABLES); 7 | } 8 | } 9 | 10 | module.exports = envVariables; 11 | -------------------------------------------------------------------------------- /packages/server/repo/generate.js: -------------------------------------------------------------------------------- 1 | const { MODULE } = require('../models/constants/common'); 2 | const MongoAtlasRepository = require('../models/Repo'); 3 | 4 | class SchemaRepository extends MongoAtlasRepository { 5 | constructor () { 6 | super(MODULE.GENERATOR); 7 | } 8 | } 9 | 10 | module.exports = SchemaRepository; 11 | -------------------------------------------------------------------------------- /packages/server/routes/web/projectRoleAccessPermissions/index.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | const projectRoleAccessPermissions = require('./projectRoleAccessPermissions'); 5 | 6 | router.use('/project-role-access', projectRoleAccessPermissions); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /packages/client/src/components/ReactDrawer/DrawerClose.js: -------------------------------------------------------------------------------- 1 | import { Icons } from '@dhiwise/icons'; 2 | import React from 'react'; 3 | import { IconBox } from '../IconBox'; 4 | 5 | export const DrawerClose = ({ onClick }) => ( 6 | } /> 7 | ); 8 | -------------------------------------------------------------------------------- /packages/client/src/redux/thunks/policy.js: -------------------------------------------------------------------------------- 1 | import { createAsyncThunk } from '@reduxjs/toolkit'; 2 | import { fetchPolicy } from '../../api/applicationPolicy'; 3 | 4 | export const listPolicy = createAsyncThunk( 5 | 'policy/pagination', 6 | // eslint-disable-next-line no-return-await 7 | async (data) => await fetchPolicy(data), 8 | ); 9 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/individualRoutes/platformIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | 4 | <%_ CONTROLLERS.forEach(function(controller){ _%> 5 | router.use("/",require("./<%-controller%>Routes")) 6 | <%_ })_%> 7 | 8 | module.exports =router -------------------------------------------------------------------------------- /packages/client/src/components/BoxLayout/boxLayoutCss.js: -------------------------------------------------------------------------------- 1 | export const boxLayoutCss = { 2 | boxmainRight: 'w-sidebarRight', 3 | boxsubSidebar: 'xxl:w-1.5/12 w-2.5/12', // h-body sticky top-49 z-1 4 | boxsubRight: 'xxl:w-10.5/12 w-9.5/12 overflow-auto flex justify-between', // h-body 5 | boxfullscreen: 'xxl:w-1.5/12 w-2/12 h-full', 6 | }; 7 | -------------------------------------------------------------------------------- /packages/server/models/constants/activityLog.js: -------------------------------------------------------------------------------- 1 | module.exports = [ 2 | { 3 | url: '/web/v1/application-config/paginate', 4 | model: 'applicationConfig', 5 | action: 'paginate', 6 | }, 7 | { 8 | url: '/web/v1/project-constant/paginate', 9 | model: 'projectConstant', 10 | action: 'paginate', 11 | }, 12 | ]; 13 | -------------------------------------------------------------------------------- /packages/server/repo/application.js: -------------------------------------------------------------------------------- 1 | const MongoAtlasRepository = require('../models/Repo'); 2 | const { MODULE } = require('../models/constants/common'); 3 | 4 | class ProjectRepository extends MongoAtlasRepository { 5 | constructor () { 6 | super(MODULE.APPLICATION); 7 | } 8 | } 9 | 10 | module.exports = ProjectRepository; 11 | -------------------------------------------------------------------------------- /packages/server/repo/schemaDetail.js: -------------------------------------------------------------------------------- 1 | const MongoAtlasRepository = require('../models/Repo'); 2 | const { MODULE } = require('../models/constants/common'); 3 | 4 | class SchemaRepository extends MongoAtlasRepository { 5 | constructor () { 6 | super(MODULE.SCHEMA_DETAIL); 7 | } 8 | } 9 | 10 | module.exports = SchemaRepository; 11 | -------------------------------------------------------------------------------- /packages/server/routes/web/envVariables/envVariables.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | upsert, get, 7 | } = require('../../../controllers/web/envVariables'); 8 | 9 | router.post('/upsert', upsert); 10 | router.post('/details', get); 11 | 12 | module.exports = router; 13 | -------------------------------------------------------------------------------- /packages/server/repo/projectPolicy.js: -------------------------------------------------------------------------------- 1 | const { MODULE } = require('../models/constants/common'); 2 | const CommonQueryRepository = require('../models/Repo'); 3 | 4 | class ProjectCronRepository extends CommonQueryRepository { 5 | constructor () { 6 | super(MODULE.PROJECT_POLICY); 7 | } 8 | } 9 | module.exports = ProjectCronRepository; 10 | -------------------------------------------------------------------------------- /packages/server/repo/projectRoute.js: -------------------------------------------------------------------------------- 1 | const { MODULE } = require('../models/constants/common'); 2 | const CommonQueryRepository = require('../models/Repo'); 3 | 4 | class ProjectRouteRepository extends CommonQueryRepository { 5 | constructor () { 6 | super(MODULE.PROJECT_ROUTE); 7 | } 8 | } 9 | module.exports = ProjectRouteRepository; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/individualRoutes/platformIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | 4 | <%_ CONTROLLERS.forEach(function(controller){ _%> 5 | router.use("/",require("./<%-controller%>Routes")) 6 | <%_ })_%> 7 | 8 | module.exports =router -------------------------------------------------------------------------------- /packages/client/src/redux/thunks/constants.js: -------------------------------------------------------------------------------- 1 | import { createAsyncThunk } from '@reduxjs/toolkit'; 2 | import { fetchConstant } from '../../api/applicationConstant'; 3 | 4 | export const listConstants = createAsyncThunk( 5 | 'constant/pagination', 6 | // eslint-disable-next-line no-return-await 7 | async (data) => await fetchConstant(data), 8 | ); 9 | -------------------------------------------------------------------------------- /packages/server/repo/queryBuilder.js: -------------------------------------------------------------------------------- 1 | const MongoAtlasRepository = require('../models/Repo'); 2 | const { MODULE } = require('../models/constants/common'); 3 | 4 | class QueryBuilderRepository extends MongoAtlasRepository { 5 | constructor () { 6 | super(MODULE.QUERY_BUILDER); 7 | } 8 | } 9 | 10 | module.exports = QueryBuilderRepository; 11 | -------------------------------------------------------------------------------- /packages/client/src/container/hooks/useBoolean.js: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | const useBoolean = (status) => { 4 | const [boolean, setBoolean] = useState(status); 5 | const setTrue = () => setBoolean(true); 6 | const setFalse = () => setBoolean(false); 7 | return [boolean, setTrue, setFalse]; 8 | }; 9 | export default useBoolean; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/controllers/fileUploadControllerIndex.js.ejs: -------------------------------------------------------------------------------- 1 | const fileUploadUsecase = require('<%-USECASE_PATH%>/fileUpload/upload'); 2 | const fileUploadController = require('./fileUploadController'); 3 | 4 | const upload = fileUploadController.upload(fileUploadUsecase); 5 | 6 | module.exports = { upload }; -------------------------------------------------------------------------------- /packages/server/repo/projectConstant.js: -------------------------------------------------------------------------------- 1 | const { MODULE } = require('../models/constants/common'); 2 | const CommonQueryRepository = require('../models/Repo'); 3 | 4 | class ProjectConstantRepository extends CommonQueryRepository { 5 | constructor () { 6 | super(MODULE.PROJECT_CONSTANT); 7 | } 8 | } 9 | module.exports = ProjectConstantRepository; 10 | -------------------------------------------------------------------------------- /packages/client/src/redux/thunks/buildCode.js: -------------------------------------------------------------------------------- 1 | import { createAsyncThunk } from '@reduxjs/toolkit'; 2 | import { apiClient, API_URLS } from '../../api'; 3 | 4 | export const codeGenerator = createAsyncThunk( 5 | 'build/codeGeneration', 6 | // eslint-disable-next-line no-return-await 7 | async (data) => await apiClient(API_URLS.application.generate, data), 8 | ); 9 | -------------------------------------------------------------------------------- /packages/server/controllers/web/master/index.js: -------------------------------------------------------------------------------- 1 | const MasterRepository = require('../../../repo/master'); 2 | 3 | const masterRepo = new MasterRepository(); 4 | const getByCodeUseCase = require('../../../usecase/master/getByCode')(masterRepo); 5 | 6 | const master = require('./master'); 7 | 8 | module.exports = { getByCode: master.getByCode({ getByCodeUseCase }) }; 9 | -------------------------------------------------------------------------------- /packages/server/repo/applicationConfig.js: -------------------------------------------------------------------------------- 1 | const { MODULE } = require('../models/constants/common'); 2 | const CommonQueryRepository = require('../models/Repo'); 3 | 4 | class ApplicationConfigRepository extends CommonQueryRepository { 5 | constructor () { 6 | super(MODULE.APPLICATION_CONFIG); 7 | } 8 | } 9 | module.exports = ApplicationConfigRepository; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/controllers/fileUploadControllerIndex.js.ejs: -------------------------------------------------------------------------------- 1 | const fileUploadUsecase = require('<%-USECASE_PATH%>/fileUpload/upload'); 2 | const fileUploadController = require('./fileUploadController'); 3 | 4 | const upload = fileUploadController.upload(fileUploadUsecase); 5 | 6 | module.exports = { upload }; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/utils/response/responseStatus.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 'SUCCESS', 3 | failure: 'FAILURE', 4 | serverError: 'SERVER_ERROR', 5 | badRequest: 'BAD_REQUEST', 6 | recordNotFound: 'RECORD_NOT_FOUND', 7 | validationError: 'VALIDATION_ERROR', 8 | unauthorized: 'UNAUTHORIZED', 9 | }; 10 | -------------------------------------------------------------------------------- /packages/client/src/utils/mergeRefs.js: -------------------------------------------------------------------------------- 1 | export default function mergeRefs(refs) { 2 | return (value) => { 3 | refs.forEach((ref) => { 4 | if (typeof ref === 'function') { 5 | ref(value); 6 | } else if (ref != null) { 7 | // eslint-disable-next-line no-param-reassign 8 | ref.current = value; 9 | } 10 | }); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /packages/server/repo/nestedQueryBuilder.js: -------------------------------------------------------------------------------- 1 | const MongoAtlasRepository = require('../models/Repo'); 2 | const { MODULE } = require('../models/constants/common'); 3 | 4 | class NestedQueryBuilderRepository extends MongoAtlasRepository { 5 | constructor () { 6 | super(MODULE.NESTED_QUERY_BUILDER); 7 | } 8 | } 9 | 10 | module.exports = NestedQueryBuilderRepository; 11 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/utils/response/responseStatus.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 'SUCCESS', 3 | failure: 'FAILURE', 4 | serverError: 'SERVER_ERROR', 5 | badRequest: 'BAD_REQUEST', 6 | recordNotFound: 'RECORD_NOT_FOUND', 7 | validationError: 'VALIDATION_ERROR', 8 | unauthorized: 'UNAUTHORIZED', 9 | }; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/utils/response/responseStatus.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 'SUCCESS', 3 | failure: 'FAILURE', 4 | serverError: 'SERVER_ERROR', 5 | badRequest: 'BAD_REQUEST', 6 | recordNotFound: 'RECORD_NOT_FOUND', 7 | validationError: 'VALIDATION_ERROR', 8 | unauthorized: 'UNAUTHORIZED', 9 | }; 10 | -------------------------------------------------------------------------------- /packages/client/src/components/ReactDrawer/DrawerHead.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Heading } from '../Heading'; 3 | 4 | export const DrawerHead = ({ children, title, className }) => ( 5 |
6 | {title} 7 | {children} 8 |
9 | ); 10 | -------------------------------------------------------------------------------- /packages/server/repo/dataTypeSuggestions.js: -------------------------------------------------------------------------------- 1 | const MongoAtlasRepository = require('../models/Repo'); 2 | const { MODULE } = require('../models/constants/common'); 3 | 4 | class DataTypeSuggestionsRepository extends MongoAtlasRepository { 5 | constructor () { 6 | super(MODULE.DATATYPE_SUGGESTIONS); 7 | } 8 | } 9 | 10 | module.exports = DataTypeSuggestionsRepository; 11 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/response/responseStatus.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | success: 'SUCCESS', 3 | failure: 'FAILURE', 4 | serverError: 'SERVER_ERROR', 5 | badRequest: 'BAD_REQUEST', 6 | recordNotFound: 'RECORD_NOT_FOUND', 7 | validationError: 'VALIDATION_ERROR', 8 | unauthorized: 'UNAUTHORIZED', 9 | }; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/middleware/sampleMiddleware.js.ejs: -------------------------------------------------------------------------------- 1 | <%_if(POLICY.code){_%> 2 | <%-POLICY.code%> 3 | <%_}else{_%> 4 | const <%-POLICY.functionName%>=(req,res,next)=>{ 5 | try { 6 | next(); 7 | } catch (error) { 8 | throw error; 9 | } 10 | } 11 | 12 | module.exports=<%-POLICY.functionName%> 13 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/middleware/sampleMiddleware.js.ejs: -------------------------------------------------------------------------------- 1 | <%_if(POLICY.code){_%> 2 | <%-POLICY.code%> 3 | <%_}else{_%> 4 | const <%-POLICY.functionName%>=(req,res,next)=>{ 5 | try { 6 | next() 7 | } catch (error) { 8 | throw error; 9 | } 10 | } 11 | 12 | module.exports=<%-POLICY.functionName%> 13 | <%_}_%> -------------------------------------------------------------------------------- /packages/server/usecase/util/randomNumber.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-plusplus */ 2 | const randomNumber = (length = 6) => { 3 | const numbers = '01234567890123456789'; 4 | let result = ''; 5 | for (let i = length; i > 0; --i) { 6 | result += numbers[Math.round(Math.random() * (numbers.length - 1))]; 7 | } 8 | return result; 9 | }; 10 | 11 | module.exports = { randomNumber }; 12 | -------------------------------------------------------------------------------- /packages/server/middleware/responses/ok.js: -------------------------------------------------------------------------------- 1 | /* global _, */ 2 | module.exports = (data, config) => { 3 | const response = _.assign({ 4 | code: _.get(config, 'code', 'OK'), 5 | message: _.get(config, 'message', 'Operation is successfully executed'), 6 | data: data || {}, 7 | }, _.get(config, 'root', {})); 8 | 9 | this.res.status(200); 10 | this.res.json(response); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/middleware/sampleMiddleware.js.ejs: -------------------------------------------------------------------------------- 1 | <%_if(POLICY.code){_%> 2 | <%-POLICY.code%> 3 | <%_}else{_%> 4 | const <%-POLICY.functionName%>=(req,res,next)=>{ 5 | try { 6 | next(); 7 | } catch (error) { 8 | throw error; 9 | } 10 | } 11 | 12 | module.exports=<%-POLICY.functionName%> 13 | <%_}_%> -------------------------------------------------------------------------------- /packages/client/src/container/CRUD/Modal/Indexing/indexingCss.js: -------------------------------------------------------------------------------- 1 | export const indexingCss = { 2 | tableHeadTop: 'pl-8 items-center sticky top-0 z-10 bg-gray-black border-b border-gray-200', 3 | tableHeadTr: 'py-2 px-5 text-base text-primary-text font-normal text-left sticky top-0 bg-gray-200 z-1', 4 | tableBodyTop: 'border-b border-r border-gray-200', 5 | tableBodyTd: 'relative py-2 px-5', 6 | }; 7 | -------------------------------------------------------------------------------- /packages/client/src/components/TextArea/textareaCss.js: -------------------------------------------------------------------------------- 1 | export const TextAreaCss = { 2 | lebel: 'mb-1.5 text-primary-text text-sm block w-full font-normal leading-5', 3 | desc: 'mt-1', 4 | textarea: 'block text-primary-text text-sm placeholder-primary font-normal text-sm py-1.5 px-2 w-full focus:border-primary-dark focus:outline-none border-1 border-gray-70 leading-normal rounded bg-gray-input h-32', 5 | }; 6 | -------------------------------------------------------------------------------- /packages/client/src/container/hooks/useComponentWillUnmount.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | // usage : useComponentWillUnmount(() => console.log('Component will unmount')); 4 | 5 | const useComponentWillUnmount = (onUnmountHandler) => { 6 | React.useEffect( 7 | () => () => { 8 | onUnmountHandler(); 9 | }, 10 | [], 11 | ); 12 | }; 13 | export default useComponentWillUnmount; 14 | -------------------------------------------------------------------------------- /packages/client/src/constant/common.js: -------------------------------------------------------------------------------- 1 | export const PLATFORMS = [ 2 | { name: 'admin', id: 'admin' }, 3 | { name: 'mobile app', id: 'device' }, 4 | { name: 'desktop', id: 'desktop' }, 5 | { name: 'client', id: 'client' }, 6 | ]; 7 | 8 | export const MAX_INPUT_FIELD_LIMIT = { 9 | title: 250, // fileName,functionName 10 | description: 500, // description 11 | key: 250, // attribute name 12 | }; 13 | -------------------------------------------------------------------------------- /packages/server/repo/projectRoleAccessPermissions.js: -------------------------------------------------------------------------------- 1 | const { MODULE } = require('../models/constants/common'); 2 | const CommonQueryRepository = require('../models/Repo'); 3 | 4 | class ProjectRoleAccessPermissionsRepository extends CommonQueryRepository { 5 | constructor () { 6 | super(MODULE.PROJECT_ROLE_ACCESS_PERMISSIONS); 7 | } 8 | } 9 | module.exports = ProjectRoleAccessPermissionsRepository; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/config/dbConnection.js.ejs: -------------------------------------------------------------------------------- 1 | const { Sequelize, DataTypes } = require('sequelize'); 2 | const dbConfig = require('../../config/db'); 3 | const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, dbConfig.PASSWORD, { 4 | host: dbConfig.HOST, 5 | dialect: dbConfig.dialect, 6 | port: dbConfig.port, 7 | }); 8 | module.exports = sequelize; 9 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/individualRoutes/platformIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * index.js 3 | * @description :: API routes 4 | */ 5 | 6 | const express = require("express") 7 | const router = express.Router() 8 | 9 | <%_ CONTROLLERS.forEach((controller)=>{ _%> 10 | router.use("/",require("./<%-controller.toLowerCase()%>Routes")); 11 | <%_ }) _%> 12 | module.exports =router -------------------------------------------------------------------------------- /packages/client/src/components/Description/descriptionCss.js: -------------------------------------------------------------------------------- 1 | export const DescriptionCss = { 2 | // decWrap: 'text-body-text text-sm leading-snug', 3 | descnormal: 'text-body-text text-xs leading-5 xxl:leading-5 xxl:text-sm', 4 | desclight: 'text-primary-text text-sm md:text-base leading-5 sm:leading-6 font-normal', 5 | descsubTitle: 'text-primary-text text-sm md:text-lg leading-5 md:leading-6 font-normal', 6 | }; 7 | -------------------------------------------------------------------------------- /packages/client/src/constant/master.js: -------------------------------------------------------------------------------- 1 | import { Input, Select, Checkbox } from '../components'; 2 | 3 | export const MASTER_PARENT_CODE = { 4 | NOTIFICATION: 'NOTIFICATION', 5 | SOCIAL_AUTH: 'SOCIAL_AUTH', 6 | ANDROID_SOCIAL_AUTH: 'ANDROID_SOCIAL_AUTH', 7 | }; 8 | 9 | export const COMPONENT_TYPE = { 10 | text: Input, 11 | number: Input.Number, 12 | select: Select, 13 | checkbox: Checkbox, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/client/src/redux/reducers/index.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from '@reduxjs/toolkit'; 2 | import models from './models'; 3 | import projects from './projects'; 4 | import constants from './constants'; 5 | import policy from './policy'; 6 | import buildCode from './buildCode'; 7 | 8 | export default combineReducers({ 9 | models, 10 | projects, 11 | constants, 12 | policy, 13 | buildCode, 14 | }); 15 | -------------------------------------------------------------------------------- /packages/client/src/assets/css/Table1.css: -------------------------------------------------------------------------------- 1 | .dhiTable_second thead th{ 2 | text-transform: uppercase; 3 | font-size: 14px; 4 | font-weight: bold; 5 | padding: 9px 10px; 6 | } 7 | .dhiTable_second tbody tr{ 8 | box-shadow: 5px 0px 19px -5px var(--color-gray-100); 9 | background-color: var(--color-gray-black); 10 | } 11 | .dhiTable_second td{ 12 | padding: 6px 10px; 13 | font-size: 14px; 14 | } -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/utils/generateRandomNumber.js: -------------------------------------------------------------------------------- 1 | const generateRandomNumber = (length = 4) => { 2 | const numbers = '12345678901234567890'; 3 | let result = ''; 4 | for (let i = length; i > 0; i -= 1) { 5 | result += numbers[Math.round(Math.random() * (numbers.length - 1))]; 6 | } 7 | return result; 8 | }; 9 | 10 | module.exports = generateRandomNumber; 11 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/individualRoutes/platformIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * index.js 3 | * @description :: API routes 4 | */ 5 | 6 | const express = require("express") 7 | const router = express.Router() 8 | 9 | <%_ CONTROLLERS.forEach((controller)=>{ _%> 10 | router.use("/",require("./<%-controller.toLowerCase()%>Routes")); 11 | <%_ }) _%> 12 | module.exports =router -------------------------------------------------------------------------------- /packages/server/routes/web/schemaDetail/schemaDetail.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | create, paginate, update, upsert, 7 | } = require('../../../controllers/web/schemaDetail'); 8 | 9 | router.post('/create', create); 10 | router.post('/paginate', paginate); 11 | router.put('/:id', update); 12 | router.post('/upsert', upsert); 13 | module.exports = router; 14 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/generateRandomNumber.js: -------------------------------------------------------------------------------- 1 | const generateRandomNumber = (length = 4) => { 2 | const numbers = '12345678901234567890'; 3 | let result = ''; 4 | for (let i = length; i > 0; i -= 1) { 5 | result += numbers[Math.round(Math.random() * (numbers.length - 1))]; 6 | } 7 | return result; 8 | }; 9 | 10 | module.exports = generateRandomNumber; 11 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/middleware/sampleMiddleware.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | <%-POLICY.functionName%>.js 3 | */ 4 | 5 | <%_if(POLICY.code){_%> 6 | <%-POLICY.code%> 7 | <%_}else{_%> 8 | const <%-POLICY.functionName%>=(req,res,next)=>{ 9 | try { 10 | next(); 11 | } catch (error) { 12 | throw error; 13 | } 14 | } 15 | 16 | module.exports=<%-POLICY.functionName%> 17 | <%_}_%> -------------------------------------------------------------------------------- /packages/client/babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-react", 4 | [ 5 | "@babel/env", 6 | { 7 | "targets": { 8 | "edge": "17", 9 | "firefox": "60", 10 | "chrome": "67", 11 | "safari": "11.1" 12 | }, 13 | "useBuiltIns": "usage", 14 | "corejs": "3.6.4" 15 | } 16 | ] 17 | ], 18 | "plugins": ["@babel/plugin-transform-react-jsx","@babel/plugin-proposal-class-properties"] 19 | } -------------------------------------------------------------------------------- /packages/client/src/config/Loader.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default function Loader() { 4 | return ( 5 |
6 | 7 | 8 | 9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /packages/server/routes/web/projectPolicy/projectPolicy.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | create, paginate, update, destroy, 7 | } = require('../../../controllers/web/projectPolicy'); 8 | 9 | router.post('/create', create); 10 | router.post('/paginate', paginate); 11 | router.put('/:id', update); 12 | router.post('/destroy', destroy); 13 | 14 | module.exports = router; 15 | -------------------------------------------------------------------------------- /packages/client/src/container/RoleAccess/RoleAccessList/roleAccessListCss.js: -------------------------------------------------------------------------------- 1 | export const roleAccessListCss = { 2 | roleListHead: 'bg-gray-200 px-5 py-1.5 flex justify-between items-center w-full sticky top-0 z-1', 3 | roleListHeadBox: 'flex justify-between text-primary-text text-sm w-96', 4 | roleListHeadTitle: 'text-primary-text text-sm', 5 | roleListWrap: 'bg-gray-black p-3 cursor-pointer flex justify-between border-t border-gray-200', 6 | }; 7 | -------------------------------------------------------------------------------- /packages/client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /packages/server/controllers/web/envVariables/envVariables.js: -------------------------------------------------------------------------------- 1 | const upsert = ({ upsertUseCase }) => async (req, res) => { 2 | const response = await upsertUseCase(req.body); 3 | return res.setResponse(response); 4 | }; 5 | 6 | const get = ({ getUseCase }) => async (req, res) => { 7 | const response = await getUseCase(req.body); 8 | return res.setResponse(response); 9 | }; 10 | 11 | module.exports = { 12 | upsert, 13 | get, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/server/routes/web/projectConstant/projectConstant.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | create, paginate, update, destroy, 7 | } = require('../../../controllers/web/projectConstant'); 8 | 9 | router.post('/create', create); 10 | router.post('/paginate', paginate); 11 | router.put('/:id', update); 12 | router.post('/destroy', destroy); 13 | 14 | module.exports = router; 15 | -------------------------------------------------------------------------------- /packages/server/routes/web/projectRoleAccessPermissions/projectRoleAccessPermissions.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | upsert, paginate, destroy, 7 | } = require('../../../controllers/web/projectRoleAccessPermissions'); 8 | 9 | router.post('/upsert', upsert); 10 | router.post('/paginate', paginate); 11 | router.post('/destroy', destroy); 12 | 13 | module.exports = router; 14 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/utils/generateToken.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | const jwt = require('jsonwebtoken'); 3 | const { JWT } = require('../constants/authConstant'); 4 | 5 | async function generateToken (user, secret) { 6 | return jwt.sign({ 7 | id: user.id, 8 | username: user.username, 9 | }, secret, { expiresIn: JWT.EXPIRES_IN }); 10 | } 11 | 12 | module.exports = generateToken; 13 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/validation/index.js: -------------------------------------------------------------------------------- 1 | const schemaValidation = (schema) => (data) => { 2 | const { error } = schema.validate(data); 3 | if (error) { 4 | const message = error.details.map((el) => el.message).join('\n'); 5 | return { 6 | isValid: false, 7 | message, 8 | }; 9 | } 10 | return { isValid: true }; 11 | }; 12 | 13 | module.exports = schemaValidation; 14 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/logs/error.log.ejs: -------------------------------------------------------------------------------- 1 | ERRORS IN MODELS: 2 | <% ERRORS.forEach(function(errorObj){ %> 3 | ERR at model : <%- errorObj.model %> 4 | ERR at attribute : <%- errorObj.attribute %> 5 | <%if(errorObj.value){%>ERR at value : <%- errorObj.value %><%}%> 6 | <%if(errorObj.message){%>ERR message : <%- errorObj.message %><%}%> 7 | <%if(errorObj.suggestion){%>suggestion : <%- errorObj.suggestion %><%}%> 8 | <% }); %> -------------------------------------------------------------------------------- /packages/client/src/api/projectRoleAccess.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from './config'; 2 | import { API_URLS } from './constants'; 3 | 4 | export const getProjectRoleAccess = (payload) => apiClient(API_URLS.projectRoleAccess.paginate, payload); 5 | export const upsertProjectRoleAccess = (payload) => apiClient(API_URLS.projectRoleAccess.upsert, payload); 6 | export const deleteProjectRoleAccess = (payload) => apiClient(API_URLS.projectRoleAccess.delete, payload); 7 | -------------------------------------------------------------------------------- /packages/client/src/components/hooks/useBoolean.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | const useBoolean = (status) => { 4 | const [boolean, setBoolean] = React.useState(status); 5 | const setTrue = () => setBoolean(true); 6 | const setFalse = () => setBoolean(false); 7 | const setToggle = () => { 8 | setBoolean((value) => !value); 9 | }; 10 | return [boolean, setTrue, setFalse, setToggle]; 11 | }; 12 | export default useBoolean; 13 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/generateToken.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | const jwt = require('jsonwebtoken'); 3 | const { JWT } = require('../constants/authConstant'); 4 | 5 | async function generateToken (user, secret) { 6 | return jwt.sign({ 7 | id: user.id, 8 | username: user.username, 9 | }, secret, { expiresIn: JWT.EXPIRES_IN }); 10 | } 11 | 12 | module.exports = generateToken; 13 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/individualRoutes/service.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ROUTES.forEach((v,i)=>{_%> 2 | /* 3 | * <%-v.descriptions%> 4 | */ 5 | const <%-v.functionName%>=()=>{ 6 | try { 7 | return true; 8 | } catch (error) { 9 | throw error; 10 | } 11 | } 12 | <%_ })_%> 13 | module.exports={ 14 | <%_ROUTES.forEach((v,i)=>{_%> 15 | <%- v.functionName %>, 16 | <%_ })_%> 17 | } 18 | 19 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/validation/index.js: -------------------------------------------------------------------------------- 1 | const schemaValidation = (schema) => (data) => { 2 | const { error } = schema.validate(data); 3 | if (error) { 4 | const message = error.details.map((el) => el.message).join('\n'); 5 | return { 6 | isValid: false, 7 | message, 8 | }; 9 | } 10 | return { isValid: true }; 11 | }; 12 | 13 | module.exports = schemaValidation; 14 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/individualRoutes/service.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ROUTES.forEach((v,i)=>{_%> 2 | /* 3 | * <%-v.descriptions%> 4 | */ 5 | const <%-v.functionName%>=()=>{ 6 | try { 7 | return true; 8 | } catch (error) { 9 | throw error; 10 | } 11 | } 12 | <%_ })_%> 13 | module.exports={ 14 | <%_ROUTES.forEach((v,i)=>{_%> 15 | <%- v.functionName %>, 16 | <%_ })_%> 17 | } 18 | 19 | -------------------------------------------------------------------------------- /packages/client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.history 6 | /.pnp 7 | .pnp.js 8 | package-lock.json 9 | yarn.lock 10 | /.vscode 11 | 12 | # production 13 | /build 14 | 15 | # misc 16 | .DS_Store 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | -------------------------------------------------------------------------------- /packages/client/src/components/SidebarMenuList/sidebarMenuListCss.js: -------------------------------------------------------------------------------- 1 | export const SidebarMenuListCss = { 2 | menuList: 'text-primary-text border-b-1 border-gray-100 py-1', 3 | menuActive: 'bg-primary-dark text-primary-defaultWhite border-primary-dark', 4 | subMenuList: 'text-primary-text w-full', 5 | sidebarMenu: 'text-primary-text border-b-1 border-gray-100 py-1', 6 | sidebarBottomAction: 'absolute bottom-0 w-full', 7 | thumbMenuActive: 'border-primary-dark', 8 | }; 9 | -------------------------------------------------------------------------------- /packages/client/src/reportWebVitals.js: -------------------------------------------------------------------------------- 1 | const reportWebVitals = (onPerfEntry) => { 2 | if (onPerfEntry && onPerfEntry instanceof Function) { 3 | import('web-vitals').then(({ 4 | getCLS, getFID, getFCP, getLCP, getTTFB, 5 | }) => { 6 | getCLS(onPerfEntry); 7 | getFID(onPerfEntry); 8 | getFCP(onPerfEntry); 9 | getLCP(onPerfEntry); 10 | getTTFB(onPerfEntry); 11 | }); 12 | } 13 | }; 14 | 15 | export default reportWebVitals; 16 | -------------------------------------------------------------------------------- /packages/client/src/container/EnvironmentVariable/enviromentVaribleCss.js: -------------------------------------------------------------------------------- 1 | export const enviromentVaribleCss = { 2 | // sticky -left-3 3 | enviroTableHead: 'top-0 z-1 bg-gray-black cursor-pointer py-3 px-4 text-base text-primary-text', 4 | enviroTableHeadFirst: 'sticky top-0 z-10 pl-12 bg-gray-black cursor-pointer py-3 px-4 w-100', 5 | keyValueItem: 'border-t border-gray-200 py-4 pr-5 px-4', 6 | keyValueItemFirst: 'bg-gray-black pl-5 border-t border-gray-200 py-4 pr-10 w-100', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/server/routes/web/applicationConfig/applicationConfig.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | create, update, get, destroy, paginate, 7 | } = require('../../../controllers/web/applicationConfig'); 8 | 9 | router.post('/create', create); 10 | router.post('/paginate', paginate); 11 | router.put('/:id', update); 12 | router.get('/:id', get); 13 | router.post('/destroy', destroy); 14 | 15 | module.exports = router; 16 | -------------------------------------------------------------------------------- /packages/client/config-overrides.js: -------------------------------------------------------------------------------- 1 | const rewireAliases = require('react-app-rewire-aliases'); 2 | const { paths } = require('react-app-rewired'); 3 | const path = require('path'); 4 | 5 | /* config-overrides.js */ 6 | module.exports = function override(config, env) { 7 | return rewireAliases.aliasesOptions({ 8 | '@assets': path.resolve(__dirname, `./${paths.appSrc}/assets`), 9 | '@constant': path.resolve(__dirname, `./${paths.appSrc}/constant/`), 10 | })(config, env); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/client/src/api/policy.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from '.'; 2 | import { API_URLS } from './constants'; 3 | 4 | export const createPolicy = (payload) => apiClient(API_URLS.policy.create, payload); 5 | export const updatePolicy = (policyId, payload) => apiClient(`${API_URLS.policy.url}/${policyId}`, payload, 'PUT'); 6 | export const getPolicies = (payload) => apiClient(API_URLS.policy.paginate, payload); 7 | export const deletePolicy = (payload) => apiClient(API_URLS.policy.delete, payload); 8 | -------------------------------------------------------------------------------- /packages/client/src/constant/buildProcessConstant.js: -------------------------------------------------------------------------------- 1 | export const CODE_ARCHITECTURE = { 2 | MVC: 'MVC', 3 | CC: 'Clean Code', 4 | }; 5 | 6 | export const PROCESS_STEP_TYPE = { 7 | PENDING: 1, 8 | COMPLETE: 2, 9 | }; 10 | 11 | export const BUILD_PROCESS_STATUS = { 12 | IN_QUEUE: 1, 13 | IN_PROCESS: 2, 14 | COMPLETED: 3, 15 | FAILED: 4, 16 | QUEUE_BUILD_REJECTED: 5, 17 | }; 18 | 19 | export const BUILD_ARCHITECTURE_CODE = { 20 | MVC: 'MVC', 21 | CC: 'CC', 22 | }; 23 | -------------------------------------------------------------------------------- /packages/server/constants/dataTypes/sequelize/postGreSqlDataTypes.js: -------------------------------------------------------------------------------- 1 | const DATA_TYPES = require('../dataTypes'); 2 | /** 3 | * To omit some properties from defined dataTypes. 4 | * Ex: 5 | */ 6 | 7 | /* 8 | * const STRING = { ...DATA_TYPES.STRING, ...{ NA_PROPS: [PROPS.DEFAULT] } }; 9 | * const ARRAY = { ...DATA_TYPES.ARRAY, ...{ NA_PROPS: [PROPS.REQUIRED] } }; 10 | * 11 | * DATA_TYPES = { ...DATA_TYPES, ...{ STRING, ARRAY } }; 12 | */ 13 | 14 | module.exports = { DATA_TYPES }; 15 | -------------------------------------------------------------------------------- /.github/workflows/eslint.yml: -------------------------------------------------------------------------------- 1 | name: Check ESLint on Pull Request 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | fix: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Check out Git repository 14 | uses: actions/checkout@v2 15 | - name: installing eslint 16 | run: npm i -g eslint && npm run install --force 17 | - name: Fixing Files 18 | run: eslint . --ext .js --fix 19 | -------------------------------------------------------------------------------- /packages/client/src/constant/rolePermission.js: -------------------------------------------------------------------------------- 1 | export const MODULE_NO = { 2 | USER: 1, 3 | PROJECT: 7, 4 | APPLICATION: 11, 5 | PLANS: 21, 6 | INVITATION: 109, 7 | PERMISSION: 28, 8 | MANAGE_MEMBER: 1001, 9 | GIT_INTEGRATION: 1002, 10 | }; 11 | export const MODULE_URL = { 12 | [MODULE_NO.USER]: '/account/profile', 13 | [MODULE_NO.PROJECT]: '/project-list', 14 | [MODULE_NO.INVITATION]: '/account/invite', 15 | [MODULE_NO.MANAGE_MEMBER]: '/account/manage-member', 16 | }; 17 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/validation/genericValidator.js: -------------------------------------------------------------------------------- 1 | function makeValidator (schema) { 2 | return function validator (payload) { 3 | const { error } = schema.validate(payload, { abortEarly: false }); 4 | if (error) { 5 | const message = error.details.map((el) => el.message).join('\n'); 6 | return { error: message }; 7 | } 8 | return { error: false }; 9 | }; 10 | } 11 | 12 | module.exports = makeValidator; 13 | -------------------------------------------------------------------------------- /packages/client/src/components/ReactDrawer/reactDrawerCss.js: -------------------------------------------------------------------------------- 1 | export const ReactDrawerCss = { 2 | drawer: 'fixed block bg-gray-black border-gray-100 border-t border-1 shadows-dw1 z-1000000', 3 | drawerbottom: 'bottom-0', 4 | drawertop: 'top-0', 5 | drawerright: 'right-0', 6 | drawerleft: 'left-0', 7 | drawervertical: 'w-6/12 top-0 bottom-0', 8 | drawerhorizontal: 'h-64 w-full left-0 right-0', 9 | overlay: 'w-full h-full fixed top-0 left-0 z-1000000 bg-overlay transition-all', 10 | }; 11 | -------------------------------------------------------------------------------- /packages/client/src/components/SearchBox/searchBoxCss.js: -------------------------------------------------------------------------------- 1 | export const SearchBoxCss = { 2 | wrapper: 'h-full flex items-center justify-center relative', 3 | InputBox: 'bg-gray-input border-1 border-gray-70 placeholder-primary text-body-text focus:outline-none focus:border-primary-dark w-full pr-8 rounded-3 h-full text-xs', 4 | HeaderSearchCss: 'bg-headerSearch border-none', 5 | IconBox: 'w-3 h-3 contain absolute right-5 cursor-pointer', 6 | recentcss: 'w-4 h-4 absolute left-4 cursor-pointer', 7 | }; 8 | -------------------------------------------------------------------------------- /packages/client/src/utils/dataTypes.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-param-reassign */ 2 | export function filterObjectTruthyValues(obj) { 3 | return Object.keys(obj) 4 | .reduce((o, key) => { 5 | !!obj[key] && (o[key] = obj[key]); 6 | return o; 7 | }, {}); 8 | } 9 | 10 | export function filterObjectUndefinedValues(obj) { 11 | return Object.keys(obj) 12 | .reduce((o, key) => { 13 | obj[key] !== undefined && (o[key] = obj[key]); 14 | return o; 15 | }, {}); 16 | } 17 | -------------------------------------------------------------------------------- /packages/server/constants/dataTypes/sequelize/sqlDataTypes.js: -------------------------------------------------------------------------------- 1 | /* global _ */ 2 | 3 | let DATA_TYPES = require('../dataTypes'); 4 | 5 | DATA_TYPES = _.omit(DATA_TYPES, [ 6 | DATA_TYPES.UUID.VALUE, 7 | DATA_TYPES.UUIDV4.VALUE, 8 | DATA_TYPES.BLOB.VALUE, 9 | DATA_TYPES.JSONB.VALUE, 10 | DATA_TYPES.JSON.VALUE, 11 | DATA_TYPES.ARRAY.VALUE, 12 | DATA_TYPES.GEOMETRY.VALUE, 13 | DATA_TYPES.GEOGRAPHY.VALUE, 14 | DATA_TYPES.RANGE.VALUE, 15 | ]); 16 | 17 | module.exports = { DATA_TYPES }; 18 | -------------------------------------------------------------------------------- /packages/client/src/api/applicationConfig.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from './config'; 2 | import { API_URLS } from './constants'; 3 | 4 | export const createApplicationConfig = (payload) => apiClient(API_URLS.applicationConfig.create, payload); 5 | export const getApplicationConfig = (payload) => apiClient(API_URLS.applicationConfig.paginate, payload); 6 | export const updateApplicationConfig = (applicationConfigId, payload) => apiClient(`${API_URLS.applicationConfig.url}/${applicationConfigId}`, payload, 'PUT'); 7 | -------------------------------------------------------------------------------- /packages/client/src/api/routes.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from './config'; 2 | import { API_URLS } from './constants'; 3 | 4 | export const createNodeRoute = (payload) => apiClient(API_URLS.route.create, payload); 5 | export const updateNodeRoute = (routeId, payload) => apiClient(`${API_URLS.route.url}/${routeId}`, payload, 'PUT'); 6 | export const getModelRoutes = (payload) => apiClient(API_URLS.route.paginate, payload); 7 | export const deleteModelRoute = (payload) => apiClient(API_URLS.route.delete, payload); 8 | -------------------------------------------------------------------------------- /packages/client/src/container/CRUD/Modal/LibraryPreview/HookSetup/HookEditor/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { CodeEditor } from '../../../../../../components'; 3 | 4 | export const HookEditor = ({ curHook }) => ( 5 |
6 | 13 |
14 | ); 15 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/utils/makeDirectory.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | /** 3 | * 4 | * Function used to create directory. 5 | * 6 | * @param {string} dirPath 7 | * @returns {boolean} 8 | */ 9 | const makeDirectory = async (directoryPath) => { 10 | if (!fs.existsSync(directoryPath)) { 11 | fs.mkdirSync(directoryPath, { recursive: true }); 12 | return true; 13 | } 14 | return true; 15 | }; 16 | 17 | module.exports = makeDirectory; 18 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/findById.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | findById.js 3 | */ 4 | 5 | const response = require('../../utils/response'); 6 | 7 | const findById = ({ <%-MODEL_NAME-%>Db }) => async (params) => { 8 | let result = await <%-MODEL_NAME-%>Db.findOne(params.query, params.options); 9 | if(!result){ 10 | return response.recordNotFound(); 11 | } 12 | return response.success({data:result}); 13 | } 14 | module.exports = findById; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/config/dbConnection.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * dbConnection.js 3 | * @description :: database connection using sequelize 4 | */ 5 | const { Sequelize, DataTypes } = require('sequelize'); 6 | const dbConfig = require('./db'); 7 | 8 | const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, dbConfig.PASSWORD, { 9 | host: dbConfig.HOST, 10 | dialect: dbConfig.dialect, 11 | port: dbConfig.port, 12 | }); 13 | module.exports = sequelize; 14 | -------------------------------------------------------------------------------- /packages/server/usecase/schema/util/isRegExp.js: -------------------------------------------------------------------------------- 1 | const isRegExp = (string) => { 2 | try { 3 | // eslint-disable-next-line no-new-func 4 | return new Function(` 5 | "use strict"; 6 | try { 7 | new RegExp(${string}); 8 | return true; 9 | } catch (e) { 10 | return false; 11 | } 12 | `)(); 13 | } catch (e) { 14 | return false; 15 | } 16 | }; 17 | 18 | module.exports = isRegExp; 19 | -------------------------------------------------------------------------------- /packages/client/src/utils/applicationPlatform.js: -------------------------------------------------------------------------------- 1 | import { isEmpty, toLower } from 'lodash'; 2 | import { DEVICE_TYPE_NAME } from '../constant/permission'; 3 | 4 | export const getApplicationPlatforms = (loginAccess) => { 5 | const allPlatforms = []; 6 | loginAccess?.forEach((platform) => { 7 | allPlatforms.push({ id: platform, name: (!isEmpty(toLower(DEVICE_TYPE_NAME[platform?.toUpperCase()])) ? toLower(DEVICE_TYPE_NAME[platform?.toUpperCase()]) : platform) }); 8 | }); 9 | return allPlatforms; 10 | }; 11 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/makeDirectory.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | /** 3 | * 4 | * Function used to create directory. 5 | * 6 | * @param {string} dirPath 7 | * @returns {boolean} 8 | */ 9 | const makeDirectory = async (directoryPath) => { 10 | if (!fs.existsSync(directoryPath)) { 11 | fs.mkdirSync(directoryPath, { recursive: true }); 12 | return true; 13 | } 14 | return true; 15 | }; 16 | 17 | module.exports = makeDirectory; 18 | -------------------------------------------------------------------------------- /packages/server/models/responses/index.js: -------------------------------------------------------------------------------- 1 | const ok = require('./ok'); 2 | const badRequest = require('./badRequest'); 3 | const notFound = require('./notFound'); 4 | const forbidden = require('./forbidden'); 5 | const serverError = require('./serverError'); 6 | const setResponse = require('./setResponse'); 7 | const unauthorized = require('./unauthorized'); 8 | 9 | module.exports = { 10 | ok, 11 | badRequest, 12 | serverError, 13 | notFound, 14 | forbidden, 15 | unauthorized, 16 | setResponse, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/individualRoutes/service.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ROUTES.forEach((v,i)=>{_%> 2 | /* 3 | * <%-v.descriptions%> 4 | */ 5 | const <%-v.functionName%>=()=>{ 6 | try { 7 | console.log("<%-v.functionName%> service called") 8 | return true; 9 | } catch (error) { 10 | throw error; 11 | } 12 | } 13 | <%_ })_%> 14 | module.exports={ 15 | <%_ROUTES.forEach((v,i)=>{_%> 16 | <%- v.functionName %>, 17 | <%_ })_%> 18 | } 19 | 20 | -------------------------------------------------------------------------------- /packages/server/usecase/util/validation/projectUpsert.js: -------------------------------------------------------------------------------- 1 | const Joi = require('joi'); 2 | const { 3 | validateSchema, validationCustomMessage, 4 | } = require('../validation'); 5 | 6 | const projectUpsertValidation = (params) => { 7 | const schema = Joi.object({ 8 | isArchive: Joi.boolean() 9 | .required() 10 | .messages(validationCustomMessage('isArchive')), 11 | }).unknown(true); 12 | 13 | return validateSchema(schema, params); 14 | }; 15 | 16 | module.exports = { projectUpsertValidation }; 17 | -------------------------------------------------------------------------------- /packages/client/src/assets/css/components/components.css: -------------------------------------------------------------------------------- 1 | @import "../../../components/Checkbox/checkbox.css"; 2 | @import "../../../components/DatePicker/datepicker.css"; 3 | @import "../../../components/SelectTree/selectTreeCss.css"; 4 | @import "../Table.css"; 5 | @import "../Table1.css"; 6 | @import "../scroll.css"; 7 | @import "../dropdown.css"; 8 | @import "../popover.css"; 9 | @import "../logo.css"; 10 | @import "../tooltip.css"; 11 | @import "../editor.css"; 12 | @import "../notification.css"; 13 | @import "../method.css"; -------------------------------------------------------------------------------- /packages/client/src/container/CRUD/Modal/Editor/TableView/TableData/Sortable.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { SortableHandle } from 'react-sortable-hoc'; 3 | import { Icons } from '@dhiwise/icons'; 4 | import { TableViewCss } from '../../../../../../assets/css/tableViewCss'; 5 | 6 | export const DragHandle = SortableHandle((props) => { 7 | const { style } = props; 8 | return ( 9 |
10 | 11 |
12 | ); 13 | }); 14 | -------------------------------------------------------------------------------- /packages/client/src/container/CRUD/Modal/Indexing/Draggable/useDraggable.js: -------------------------------------------------------------------------------- 1 | // import React from 'react'; 2 | import { useDrag } from 'react-dnd'; 3 | 4 | const DND_ITEM_TYPE = 'row'; 5 | export const useDraggable = ({ index, type }) => { 6 | const [{ isDragging }, drag, preview] = useDrag({ 7 | item: { type: type || DND_ITEM_TYPE, index }, 8 | collect: (monitor) => ({ 9 | isDragging: monitor.isDragging(), 10 | }), 11 | }); 12 | 13 | return { 14 | isDragging, preview, drag, 15 | }; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/client/src/container/Shared/Layout/Sidebar/sidebarCss.js: -------------------------------------------------------------------------------- 1 | export const SidebarCss = { 2 | wrap: 'border-gray-100 h-full w-sidebar', 3 | menulist: 'text-gray-900 hover:bg-gary-200 hover:text-gray-900', 4 | projectSiebar: 'py-2 flex justify-center my-dw5', 5 | bottomButton: 'border-t boredr-1 border-gray-80', 6 | bottomButtonwrap: 'w-full text-md my-4 flex justify-center items-center font-bold text-sm cursor-pointer', 7 | folderMenu: 'border-b-1 border-gray-100', 8 | menuActive: 'bg-primary-dark', 9 | }; 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/individualRoutes/service.js.ejs: -------------------------------------------------------------------------------- 1 | <%_ROUTES.forEach((v,i)=>{_%> 2 | /* 3 | * <%-v.descriptions%> 4 | */ 5 | const <%-v.functionName%>=()=>{ 6 | try { 7 | console.log("<%-v.functionName%> service called") 8 | return true; 9 | } catch (error) { 10 | throw error; 11 | } 12 | } 13 | <%_ })_%> 14 | module.exports={ 15 | <%_ROUTES.forEach((v,i)=>{_%> 16 | <%- v.functionName %>, 17 | <%_ })_%> 18 | } 19 | 20 | -------------------------------------------------------------------------------- /packages/server/usecase/util/validation/schemaDetail.js: -------------------------------------------------------------------------------- 1 | const Joi = require('joi'); 2 | const { 3 | validateSchema, validationCustomMessage, 4 | } = require('../validation'); 5 | 6 | const schemaDetailCreateValidation = (params) => { 7 | const schema = Joi.object({ 8 | schemaId: Joi.string() 9 | .required() 10 | .messages(validationCustomMessage('schemaId')), 11 | }).unknown(true); 12 | 13 | return validateSchema(schema, params); 14 | }; 15 | 16 | module.exports = { schemaDetailCreateValidation }; 17 | -------------------------------------------------------------------------------- /packages/client/src/components/ContainerBox/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | 4 | export const ContainerBox = ({ 5 | className, 6 | children, 7 | }) => ( 8 |
9 | {children} 10 |
11 | ); 12 | 13 | ContainerBox.propTypes = { 14 | /** 15 | * Additional classname 16 | */ 17 | className: PropTypes.string, 18 | }; 19 | 20 | ContainerBox.defaultProps = { 21 | className: '', 22 | }; 23 | -------------------------------------------------------------------------------- /packages/server/usecase/util/validation/applicationUpsert.js: -------------------------------------------------------------------------------- 1 | const Joi = require('joi'); 2 | const { 3 | validateSchema, validationCustomMessage, 4 | } = require('../validation'); 5 | 6 | const applicationUpsertValidation = (params) => { 7 | const schema = Joi.object({ 8 | isArchive: Joi.boolean() 9 | .required() 10 | .messages(validationCustomMessage('isArchive')), 11 | }).unknown(true); 12 | 13 | return validateSchema(schema, params); 14 | }; 15 | 16 | module.exports = { applicationUpsertValidation }; 17 | -------------------------------------------------------------------------------- /packages/server/usecase/util/validation/applicationId.js: -------------------------------------------------------------------------------- 1 | const Joi = require('joi'); 2 | const { 3 | validateSchema, validationCustomMessage, 4 | } = require('../../../util-service/validation'); 5 | 6 | const applicationIdValidation = (params) => { 7 | const schema = Joi.object({ 8 | applicationId: Joi.string() 9 | .required() 10 | .messages(validationCustomMessage('applicationId')), 11 | }).unknown(true); 12 | 13 | return validateSchema(schema, params); 14 | }; 15 | 16 | module.exports = { applicationIdValidation }; 17 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/services/customQueryService.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * customQueryService.js 3 | * @description :: exports functions used in manipulating data from database 4 | */ 5 | 6 | const find = async (model,{ 7 | filter = {}, attributes=[], order=[] 8 | }) => { 9 | const result = await model.findAll({ 10 | where: filter 11 | }, 12 | {attributes: attributes}, 13 | {order: order}) 14 | return result; 15 | }; 16 | 17 | module.exports = { 18 | find, 19 | } 20 | -------------------------------------------------------------------------------- /packages/server/usecase/util/validation/accessPermission.js: -------------------------------------------------------------------------------- 1 | const Joi = require('joi'); 2 | const { 3 | validateSchema, validationCustomMessage, 4 | } = require('../validation'); 5 | 6 | const accessPermissionCreateValidation = (params) => { 7 | const schema = Joi.object({ 8 | permissionJson: Joi.array() 9 | .required() 10 | .messages(validationCustomMessage('Permission Json')), 11 | }).unknown(true); 12 | 13 | return validateSchema(schema, params); 14 | }; 15 | 16 | module.exports = { accessPermissionCreateValidation }; 17 | -------------------------------------------------------------------------------- /packages/client/src/utils/localStorage.js: -------------------------------------------------------------------------------- 1 | export const encryptStorage = { 2 | set: (key, value) => { 3 | const setKey = JSON.stringify(key); 4 | const setValue = JSON.stringify(value); 5 | localStorage.setItem(setKey, setValue); 6 | }, 7 | get: (key) => { 8 | const setKey = JSON.stringify(key); 9 | const data = localStorage.getItem(setKey); 10 | return data ? JSON.parse(data) : null; 11 | }, 12 | remove: (key) => { 13 | const setKey = JSON.stringify(key); 14 | localStorage.removeItem(setKey); 15 | }, 16 | }; 17 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/services/customQueryService.js.ejs: -------------------------------------------------------------------------------- 1 | function makeMongoCustomQueryService(model){ 2 | const find = async ({ 3 | filter = {}, attributes=[], order=[] 4 | }) => { 5 | const result = await model.findAll({ 6 | where: filter 7 | }, 8 | {attributes: attributes}, 9 | {order: order}) 10 | return result; 11 | }; 12 | return Object.freeze({ 13 | find, 14 | }) 15 | } 16 | 17 | module.exports = makeMongoCustomQueryService 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/validateRequest.js: -------------------------------------------------------------------------------- 1 | const joi = require('joi'); 2 | 3 | exports.validateParamsWithJoi = (body, schemaKeys) => { 4 | const schema = joi.object(schemaKeys); 5 | 6 | const { error } = schema.validate(body, { abortEarly: false }); 7 | 8 | if (error && error.details) { 9 | const message = error.details.map((el) => el.message).join('\n'); 10 | return { 11 | isValid: false, 12 | message, 13 | }; 14 | } 15 | return { isValid: true }; 16 | }; 17 | -------------------------------------------------------------------------------- /packages/client/src/api/applicationPolicy.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from './config'; 2 | import { API_URLS } from './constants'; 3 | 4 | // Application node Constant Services 5 | 6 | export const createPolicy = (payload) => apiClient(API_URLS.policy.create, payload); 7 | export const updatePolicy = (policyId, payload) => apiClient(`${API_URLS.policy.url}/${policyId}`, payload, 'PUT'); 8 | export const fetchPolicy = (payload) => apiClient(API_URLS.policy.paginate, payload); 9 | export const deletePolicy = (payload) => apiClient(API_URLS.policy.delete, payload); 10 | -------------------------------------------------------------------------------- /packages/server/usecase/jsonInput/util/index.js: -------------------------------------------------------------------------------- 1 | const projectConstants = require('./projectConstant/projectConstant'); 2 | const projectPolicy = require('./projectPolicy/projectPolicy'); 3 | const schema = require('./schema/schema'); 4 | const projectRoleAccessPermission = require('./projectRoleAccessPermission/projectRoleAccessPermission'); 5 | const projectRoutes = require('./projectRoutes/projectRoutes'); 6 | 7 | module.exports = { 8 | projectConstants, 9 | projectPolicy, 10 | schema, 11 | projectRoleAccessPermission, 12 | projectRoutes, 13 | }; 14 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/authentication/logout.js.ejs: -------------------------------------------------------------------------------- 1 | const response = require('../../utils/response'); 2 | 3 | const logout = ({userTokensDb}) => async (user, token) => { 4 | let userToken = await userTokensDb.findOne({ token:token ,userId:user.id }); 5 | let updatedDocument = { 6 | isTokenExpired : true 7 | } 8 | await userTokensDb.updateOne( {id:userToken.id},updatedDocument); 9 | return response.success({message:"Logged out Successfully"}); 10 | } 11 | module.exports = logout; -------------------------------------------------------------------------------- /packages/client/src/redux/thunks/models.js: -------------------------------------------------------------------------------- 1 | import { createAsyncThunk } from '@reduxjs/toolkit'; 2 | import { API_URLS, apiClient } from '../../api'; 3 | import { getModel } from '../../api/models'; 4 | 5 | export const listModels = createAsyncThunk( 6 | 'model/paginate', 7 | // eslint-disable-next-line no-return-await 8 | async (data) => await apiClient(API_URLS.schema.paginate, data), 9 | ); 10 | 11 | export const getModelDetail = createAsyncThunk( 12 | '', 13 | // eslint-disable-next-line no-return-await 14 | async (data) => await getModel(data), 15 | ); 16 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/createApplication/makeCustomPolicy.js: -------------------------------------------------------------------------------- 1 | const { forEach } = require('lodash'); 2 | const writeOperations = require('../writeOperations'); 3 | 4 | module.exports = { 5 | makeIndividualPolicy (policies, middlewarePath) { 6 | const returnPolicy = {}; 7 | forEach(policies, (value, i) => { 8 | const policy = writeOperations.loadTemplate(`${middlewarePath}/sampleMiddleware.js`); 9 | policy.locals.POLICY = value; 10 | returnPolicy[i] = policy; 11 | }); 12 | return returnPolicy; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /packages/server/routes/web/projectRoute/projectRoute.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | create, paginate, update, destroy, uploadPostmanFile, 7 | requestApi, 8 | } = require('../../../controllers/web/projectRoute'); 9 | 10 | router.post('/create', create); 11 | router.post('/paginate', paginate); 12 | router.put('/:id', update); 13 | router.post('/destroy', destroy); 14 | router.post('/upload-postman-file', uploadPostmanFile); 15 | router.post('/request', requestApi); 16 | 17 | module.exports = router; 18 | -------------------------------------------------------------------------------- /packages/client/src/api/applicationConstant.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from './config'; 2 | import { API_URLS } from './constants'; 3 | 4 | // Application node Constant Services 5 | 6 | export const createConstant = (payload) => apiClient(API_URLS.constant.create, payload); 7 | export const updateConstant = (constantId, payload) => apiClient(`${API_URLS.constant.url}/${constantId}`, payload, 'PUT'); 8 | export const fetchConstant = (payload) => apiClient(API_URLS.constant.paginate, payload); 9 | export const deleteConstant = (payload) => apiClient(API_URLS.constant.delete, payload); 10 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/controllers/fileUploadController.js.ejs: -------------------------------------------------------------------------------- 1 | const response = require('../../../utils/response'); 2 | const responseHandler = require('../../../utils/response/responseHandler'); 3 | 4 | const upload = (fileUploadUsecase) => async (req,res) => { 5 | try { 6 | let result = await fileUploadUsecase(req,res); 7 | return responseHandler(res,result); 8 | } catch (error) { 9 | return responseHandler(res,response.internalServerError({ message:error.message })); 10 | } 11 | }; 12 | 13 | module.exports = {upload} -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/routes/platformIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | <%_ if(IS_AUTH){ _%> 4 | router.use("/<%-PLATFORM_NAME.toLowerCase()%>/auth",require("./auth")); 5 | <%_ } _%> 6 | <%_ for(let i in PLATFORM){ _%> 7 | router.use(require("./<%-i%>Routes")); 8 | <%_}_%> 9 | <%_if(typeof ROUTES!=="undefined"){_%> 10 | <%_ ROUTES.forEach((v,i)=>{ _%> 11 | router.use("/",require("./<%-v.controller%>Routes")); 12 | <%_})_%> 13 | <%_}_%> 14 | 15 | module.exports = router; 16 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/config/db.js.ejs: -------------------------------------------------------------------------------- 1 | /* 2 | * Database connection file. 3 | */ 4 | const mongoose = require("mongoose") 5 | const uri = process.env.NODE_ENV === 'test' ? process.env.DB_TEST_URL : process.env.DB_URL; 6 | mongoose.connect(uri, { useNewUrlParser: true, useUnifiedTopology: true}) 7 | var db = mongoose.connection 8 | 9 | db.once("open", () => { 10 | console.log("Connection Successful") 11 | }) 12 | 13 | db.on("error", () => { 14 | console.log("Error in mongodb connection") 15 | }) 16 | 17 | module.exports = mongoose -------------------------------------------------------------------------------- /packages/server/models/Models/Queue.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const QueueSchema = new mongoose.Schema({ 4 | isUpdated: { 5 | type: 'boolean', 6 | default: false, 7 | }, 8 | syncApi: { type: 'string' }, 9 | data: { type: [] }, 10 | homeAreaId: { 11 | type: 'ObjectId', 12 | ref: 'org-home', 13 | }, 14 | dataId: { type: 'string' }, 15 | }, { toJSON: { virtuals: true } }, { timestamp: true }); 16 | QueueSchema.index({ 17 | dataId: 1, 18 | isActive: 1, 19 | isDeleted: 1, 20 | }); 21 | module.exports = mongoose.model('queue', QueueSchema); 22 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/controllers/fileUploadController.js.ejs: -------------------------------------------------------------------------------- 1 | const response = require('../../../utils/response'); 2 | const responseHandler = require('../../../utils/response/responseHandler'); 3 | 4 | const upload = (fileUploadUsecase) => async (req,res) => { 5 | try { 6 | let result = await fileUploadUsecase(req,res); 7 | return responseHandler(res,result); 8 | } catch (error) { 9 | return responseHandler(res,response.internalServerError({message:error.message})); 10 | } 11 | }; 12 | 13 | module.exports = {upload} -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/routes/platformIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | <%_ if(IS_AUTH){ _%> 4 | router.use("/<%-PLATFORM_NAME.toLowerCase()%>/auth",require("./auth")); 5 | <%_ } _%> 6 | <%_ for(let i in PLATFORM){ _%> 7 | router.use(require("./<%-i%>Routes")); 8 | <%_}_%> 9 | <%_if(typeof ROUTES!=="undefined"){_%> 10 | <%_ ROUTES.forEach((v,i)=>{ _%> 11 | router.use("/",require("./<%-v.controller%>Routes")); 12 | <%_})_%> 13 | <%_}_%> 14 | 15 | module.exports = router; 16 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/utils/replaceAll.js: -------------------------------------------------------------------------------- 1 | /** 2 | * replaceAll: find and replace all occurrence of a string in a searched string 3 | * @param {string} string : string to be replace 4 | * @param {string} search : string which you want to replace 5 | * @param {string} replace : string with which you want to replace a string 6 | * @return {string} : replaced new string 7 | */ 8 | 9 | function replaceAll (string, search, replace) { 10 | return string.split(search).join(replace); 11 | } 12 | 13 | module.exports = replaceAll; 14 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/createApplication/generateFakeData/fakeDataType.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: ['name', 'firstname', 'middlename', 'lastname'], 3 | email: ['mailid', 'mail', 'email', 'emailid', 'gmail'], 4 | age: ['age'], 5 | gender: ['sex', 'gender'], 6 | phone: ['phone', 'mobile', 'contact', 'mobileno', 'phoneno', 'contactno'], 7 | price: ['rate', 'price', 'amount', 'totalamount'], 8 | address: ['address', 'place', 'addr'], 9 | color: ['color', 'colour'], 10 | password: ['password', 'pass'], 11 | username: ['username', 'uname'], 12 | }; 13 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/use-case/customRouteOfModel.js.ejs: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | *<%-FUNCTION_NAME%>.js 4 | */ 5 | const response = require('../../utils/response'); 6 | 7 | const <%-FUNCTION_NAME%> = ({<%-MODELS.join()%>}) => async (req,res) => { 8 | let combinedOutput = {}; 9 | <%_ for(let i=0;i< QUERY.length;i++){ _%> 10 | combinedOutput.<%-QUERY[i].outputVariable%> = await <%-QUERY[i].model%>Db.findOne(<%-QUERY[i].filter%>); 11 | <%_}_%> 12 | return response.success({data:combinedOutput}); 13 | }; 14 | 15 | module.exports = <%-FUNCTION_NAME %>; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/createApplication/generateFakeDataSequelize/fakeDataType.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: ['name', 'firstname', 'middlename', 'lastname'], 3 | email: ['mailid', 'mail', 'email', 'emailid', 'gmail'], 4 | age: ['age'], 5 | gender: ['sex', 'gender'], 6 | phone: ['phone', 'mobile', 'contact', 'mobileno', 'phoneno', 'contactno'], 7 | price: ['rate', 'price', 'amount', 'totalamount'], 8 | address: ['address', 'place', 'addr'], 9 | color: ['color', 'colour'], 10 | password: ['password', 'pass'], 11 | username: ['username', 'uname'], 12 | }; 13 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/createApplication/createCommonRoutes/index.js: -------------------------------------------------------------------------------- 1 | /* global MODE_0666 */ 2 | const path = require('path'); 3 | const writeOperations = require('../../writeOperations'); 4 | 5 | async function createCommonRoutes (dir, templateFolder, platforms, toPath) { 6 | const commonIndex = writeOperations.loadTemplate(`${templateFolder}/commonIndexRoutes.js`); 7 | commonIndex.locals.PLATFORM = platforms; 8 | writeOperations.write(path.join(dir, `${toPath}/common/index.js`), commonIndex.render(), MODE_0666); 9 | } 10 | 11 | module.exports = { createCommonRoutes }; 12 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/customRouteOfModel.js.ejs: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | *<%-FUNCTION_NAME%>.js 4 | */ 5 | const response = require('../../utils/response'); 6 | 7 | const <%-FUNCTION_NAME%> = ({<%-MODELS.join()%>}) => async (req,res) => { 8 | let combinedOutput = {}; 9 | <%_ for(let i=0;i< QUERY.length;i++){ _%> 10 | combinedOutput.<%-QUERY[i].outputVariable%> = await <%-QUERY[i].model%>Db.findOne(<%-QUERY[i].filter%>); 11 | <%_}_%> 12 | return response.success({data:combinedOutput}); 13 | }; 14 | 15 | module.exports = <%-FUNCTION_NAME %>; -------------------------------------------------------------------------------- /packages/server/models/usecase/getSetting.js: -------------------------------------------------------------------------------- 1 | /* global */ 2 | const Repo = require('../Repo/Connection'); 3 | const { MODULE } = require('../constants/common'); 4 | 5 | const repo = new Repo(MODULE.SETTING); 6 | 7 | const getSetting = async () => repo.getOne({}); 8 | 9 | const getSettingByKey = async (key) => { 10 | const setting = await getSetting(); 11 | return setting?.[key] || ''; 12 | }; 13 | 14 | const getFrontSiteVersionTag = async () => { await getSettingByKey('frontSiteVersionTag'); }; 15 | 16 | module.exports = { 17 | getSetting, 18 | getSettingByKey, 19 | getFrontSiteVersionTag, 20 | }; 21 | -------------------------------------------------------------------------------- /packages/server/usecase/project/noOfProjectAndApplication.js: -------------------------------------------------------------------------------- 1 | /* global MESSAGE */ 2 | 3 | const resourceCount = ({ 4 | projectRepo, applicationRepo, 5 | }) => async () => { 6 | try { 7 | const filter = {}; 8 | const response = { 9 | noOfProject: await projectRepo.getCount(filter), 10 | noOfApplication: await applicationRepo.getCount(filter), 11 | }; 12 | return { 13 | ...MESSAGE.OK, 14 | data: response, 15 | }; 16 | } catch (err) { 17 | // console.log('error', err); 18 | return MESSAGE.SERVER_ERROR; 19 | } 20 | }; 21 | module.exports = resourceCount; 22 | -------------------------------------------------------------------------------- /packages/client/src/components/ListBox/LIstTitle.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | import { ListBoxCss } from './listboxCss'; 4 | 5 | export const ListTitle = ({ 6 | title, smallTitle, titleClass, onClick, 7 | }) => ( 8 | <> 9 | {!!title 10 | && ( 11 |

15 | {title} 16 |

17 | )} 18 | {!!smallTitle 19 | && ( 20 |
21 | {smallTitle} 22 |
23 | )} 24 | 25 | ); 26 | -------------------------------------------------------------------------------- /packages/server/models/constants/version.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | service: { 3 | version: { 4 | PLATFORM: { 5 | WINDOWS_PLATFORM: 1, 6 | ANDROID_PLATFORM: 2, 7 | IOS_PLATFORM: 3, 8 | HOME_BACKUP: 4, 9 | PRINT_EXE: 5, 10 | }, 11 | INCLUDES: { 12 | CREATED_BY: 'created_by', 13 | UPDATED_BY: 'updated_by', 14 | }, 15 | DEFAULT_USER_FORMAT: [ 16 | 'id', 17 | 'type', 18 | 'name', 19 | 'education', 20 | 'cell', 21 | 'cell2', 22 | 'email', 23 | ], 24 | }, 25 | 26 | }, 27 | }; 28 | -------------------------------------------------------------------------------- /packages/client/src/utils/validationMsgs.js: -------------------------------------------------------------------------------- 1 | export const validationMsg = { 2 | required: (alias) => `${alias} is required.`, 3 | select: (alias) => `Please select ${alias}.`, 4 | minLength: (alias) => `Minimum limit is ${alias} characters`, 5 | maxLength: (alias) => `Maximum limit is ${alias} characters`, 6 | min: (alias) => `Minimum limit is ${alias}`, 7 | max: (alias) => `Maximum limit is ${alias}`, 8 | pattern: (alias) => `${alias}`, 9 | validate: (alias) => `${alias}`, 10 | }; 11 | 12 | export const getError = (errors = {}, keyName, alias) => (errors[keyName] ? validationMsg[errors[keyName].type](alias) : ''); 13 | -------------------------------------------------------------------------------- /packages/server/routes/web/project/project.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | create, paginate, destroy, update, get, upsert, applicationRestriction, 7 | } = require('../../../controllers/web/project'); 8 | 9 | router.post('/create', create); 10 | router.post('/applicationRestriction', applicationRestriction); 11 | router.post('/create', create); 12 | router.post('/paginate', paginate); 13 | router.put('/:id', update); 14 | router.put('/archive/:id', upsert); 15 | router.get('/:id', get); 16 | router.post('/destroy', destroy); 17 | 18 | module.exports = router; 19 | -------------------------------------------------------------------------------- /packages/client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/config/db.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * db.js 3 | * @description :: exports database connection using mongoose 4 | */ 5 | 6 | const mongoose = require("mongoose") 7 | const uri = process.env.NODE_ENV === 'test' ? process.env.DB_TEST_URL : process.env.DB_URL; 8 | mongoose.connect(uri, { useNewUrlParser: true, useUnifiedTopology: true }); 9 | var db = mongoose.connection 10 | 11 | db.once("open", () => { 12 | console.log("Connection Successful") 13 | }) 14 | 15 | db.on("error", () => { 16 | console.log("Error in mongodb connection") 17 | }) 18 | 19 | module.exports = mongoose -------------------------------------------------------------------------------- /packages/server/util-service/crypto/crypto.js: -------------------------------------------------------------------------------- 1 | const CryptoJS = require('crypto-js'); 2 | 3 | const saltKey = 'nodejs-code-generator'; 4 | 5 | /** 6 | * Function used to encrypt the string. 7 | * @param {} str 8 | */ 9 | async function encrypt (str) { 10 | return CryptoJS.AES.encrypt(str, saltKey).toString(); 11 | } 12 | 13 | /** 14 | * Function used to deCrypt the encrypted string. 15 | * @param {} str 16 | */ 17 | async function decrypt (str) { 18 | const bytes = CryptoJS.AES.decrypt(str, saltKey); 19 | return bytes.toString(CryptoJS.enc.Utf8); 20 | } 21 | 22 | module.exports = { 23 | encrypt, 24 | decrypt, 25 | }; 26 | -------------------------------------------------------------------------------- /packages/server/models/responses/setResponse.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable guard-for-in */ 2 | /* global _ */ 3 | const { OK } = require('../constants/message').MESSAGE; 4 | 5 | module.exports = async (res, body) => { 6 | // Memory Usage 7 | body = { 8 | code: _.get(body, 'code', OK.code), 9 | message: _.get(body, 'message', OK.message), 10 | data: _.get(body, 'data', null), 11 | otherData: _.get(body, 'otherData', {}), 12 | status: _.get(body, 'status', OK.status), 13 | }; 14 | 15 | let { status } = OK; 16 | if (body.status) { 17 | status = body.status; 18 | } 19 | return res.status(status).send(body); 20 | }; 21 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/use-case/count.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | count.js 3 | */ 4 | 5 | const response = require('../../utils/response'); 6 | 7 | /** 8 | * @description : returns total number of documents of <%-MODEL_NAME%> 9 | * @param {object} <%-MODEL_NAME-%>Db : db service instance 10 | * @param {object} where : where conditions 11 | * @return {object} : no of documents. 12 | */ 13 | const count = ({ <%-MODEL_NAME-%>Db }) => async (where) => { 14 | let totalRecords = await <%-MODEL_NAME-%>Db.count(where); 15 | return response.success({data: { totalRecords }}); 16 | } 17 | module.exports = count; -------------------------------------------------------------------------------- /packages/server/usecase/schema/dataTypeSuggestions.js: -------------------------------------------------------------------------------- 1 | const { 2 | DATA_TYPES_SUGGESTIONS, SERVER_ERROR, 3 | } = require('../../constants/message').message; 4 | 5 | /** 6 | * 7 | * Function used for update user. 8 | * @return json 9 | */ 10 | const dataTypeSuggestions = (dataTypeSuggestionsRepo) => async () => { 11 | try { 12 | const dataTypes = await dataTypeSuggestionsRepo.get({}); 13 | return { 14 | ...DATA_TYPES_SUGGESTIONS, 15 | data: dataTypes, 16 | }; 17 | } catch (err) { 18 | // console.log('error', err); 19 | return SERVER_ERROR; 20 | } 21 | }; 22 | 23 | module.exports = dataTypeSuggestions; 24 | -------------------------------------------------------------------------------- /packages/server/usecase/util/validation/group.js: -------------------------------------------------------------------------------- 1 | const Joi = require('joi'); 2 | const { 3 | validateSchema, validationCustomMessage, 4 | } = require('../validation'); 5 | const { validation } = require('../../../constants/validation'); 6 | 7 | const groupValidation = (params) => { 8 | const schema = Joi.object({ 9 | name: Joi.string() 10 | .trim() 11 | .required() 12 | .min(validation.name.min) 13 | .max(validation.name.max) 14 | .messages(validationCustomMessage('name')), 15 | }).unknown(true); 16 | 17 | return validateSchema(schema, params); 18 | }; 19 | 20 | module.exports = { groupValidation }; 21 | -------------------------------------------------------------------------------- /packages/client/src/api/project.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable implicit-arrow-linebreak */ 2 | import { apiClient } from './config'; 3 | import { API_URLS } from './constants'; 4 | 5 | export const createNewApplication = (appData) => apiClient(API_URLS.application.create, appData, 'POST', {}, {}, { isErrorResponse: true }); 6 | 7 | export const editApplication = (id, payload) => apiClient(`${API_URLS.application.edit}/${id}`, payload, 'PUT'); 8 | 9 | export const redirectApplication = () => apiClient(`${API_URLS.application.lastAppRedirect}`, {}, 'GET'); 10 | 11 | export const destroyApplication = (payload) => apiClient(`${API_URLS.application.destroy}`, payload); 12 | -------------------------------------------------------------------------------- /packages/client/src/components/DatePicker/datepickerCss.js: -------------------------------------------------------------------------------- 1 | export const datepickerCss = { 2 | datepickerWrap: '', 3 | datepickerLabel: 'mb-1.5 text-primary-text text-sm block w-full font-semibold leading-5', 4 | desc: 'mt-1', 5 | errorClass: 'text-error text-sm mt-1 block', 6 | datepickerWrapClass: 'relative', 7 | datePickerInput: 'font-body text-primary-text bg-gray-input border-1 border-gray-70 placeholder-primary font-normal w-full focus:border-primary-dark focus:outline-none leading-normal rounded-3', 8 | datepickernormal: 'py-2 px-2.5 text-sm', 9 | datepickersmall: 'py-1 px-2 text-xs', 10 | datepickermedium: 'py-1.5 px-2 text-xs', 11 | }; 12 | -------------------------------------------------------------------------------- /packages/client/src/container/hooks/useQueryParams.js: -------------------------------------------------------------------------------- 1 | const getQuery = () => { 2 | if (typeof window !== 'undefined') { 3 | return new URLSearchParams(window.location.search); 4 | } 5 | return new URLSearchParams(); 6 | }; 7 | 8 | const useQueryParams = (keys = []) => { 9 | const query = getQuery(); 10 | let params; 11 | if (typeof keys === 'string') { 12 | params = query.get(keys); 13 | } 14 | if (Array.isArray(keys)) { 15 | const tempKeys = {}; 16 | keys.forEach((key) => { 17 | tempKeys[key] = query.get(key); 18 | }); 19 | params = tempKeys; 20 | } 21 | return params; 22 | }; 23 | export default useQueryParams; 24 | -------------------------------------------------------------------------------- /packages/client/src/components/Loader/index.js: -------------------------------------------------------------------------------- 1 | // import Loadable from 'react-loadable'; 2 | import React from 'react'; 3 | // import Lottie from 'react-lottie'; 4 | // import animationData from '../../config/loaderdata.json'; 5 | import logoLoader from '../../assets/images/gif/logo-loader.gif'; 6 | 7 | export const Loader = ({ style, className }) => ( 8 |
9 | {/* */} 14 | loader 15 |
16 | ); 17 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/data-access/sequenceDb.js.ejs: -------------------------------------------------------------------------------- 1 | let Sequence = require('../db/mongoDB/models/sequence'); 2 | let { 3 | create, 4 | createMany, 5 | updateOne, 6 | updateMany, 7 | deleteOne, 8 | deleteMany, 9 | softDelete, 10 | softDeleteMany, 11 | findOne, 12 | findMany, 13 | paginate, 14 | count, 15 | } = require('../db/mongoDB/dbService')(Sequence); 16 | 17 | module.exports = { 18 | create, 19 | createMany, 20 | updateOne, 21 | updateMany, 22 | deleteOne, 23 | deleteMany, 24 | softDelete, 25 | softDeleteMany, 26 | findOne, 27 | findMany, 28 | paginate, 29 | count, 30 | }; -------------------------------------------------------------------------------- /packages/server/constants/dataTypes/props.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | PROPS: { 4 | DEFAULT: 'default', 5 | IS_AUTO_INCREMENT: 'isAutoIncrement', 6 | UNIQUE: 'unique', 7 | PRIMARY: 'primary', 8 | REQUIRED: 'required', 9 | TINY: 'tiny', 10 | REF: 'ref', 11 | REF_ATTR: 'refAttribute', 12 | MIN: 'min', 13 | MAX: 'max', 14 | MIN_LENGTH: 'minLength', 15 | MAX_LENGTH: 'maxLength', 16 | TRIM: 'trim', 17 | PATTERN: 'match', 18 | LOWER_CASE: 'lowercase', 19 | INNER_DATA_TYPE: 'innerDataType', 20 | LOCAL_FIELD: 'localField', 21 | FOREIGN_FIELD: 'foreignField', 22 | RELATION_TYPE: 'relType', 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /packages/server/controllers/web/projectRoleAccessPermissions/roleAccessPermissions.js: -------------------------------------------------------------------------------- 1 | const upsert = ({ upsertUseCase }) => async (req, res) => { 2 | const response = await upsertUseCase(req.body); 3 | return res.setResponse(response); 4 | }; 5 | 6 | const destroy = ({ destroyUseCase }) => async (req, res) => { 7 | const response = await destroyUseCase(req.body); 8 | return res.setResponse(response); 9 | }; 10 | 11 | const paginate = ({ paginateUseCase }) => async (req, res) => { 12 | const response = await paginateUseCase(req.body); 13 | return res.setResponse(response); 14 | }; 15 | 16 | module.exports = { 17 | upsert, 18 | destroy, 19 | paginate, 20 | }; 21 | -------------------------------------------------------------------------------- /packages/client/src/container/hooks/index.js: -------------------------------------------------------------------------------- 1 | import useClickOutside from 'use-onclickoutside'; 2 | import useBoolean from './useBoolean'; 3 | import useComponentDidMount from './useComponentDidMount'; 4 | import useComponentWillUnmount from './useComponentWillUnmount'; 5 | import useDrop from './useDrop'; 6 | import useToastNotifications from './useToastNotifications'; 7 | import useWindowSize from './useWindowSize'; 8 | import useQueryParams from './useQueryParams'; 9 | 10 | export { 11 | useBoolean, 12 | useComponentDidMount, 13 | useComponentWillUnmount, 14 | useDrop, 15 | useClickOutside, 16 | useToastNotifications, 17 | useWindowSize, 18 | useQueryParams, 19 | }; 20 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/partialUpdate.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | partialUpdate.js 3 | */ 4 | 5 | const <%-MODEL_NAME-%>Entity = require('../../entities/<%-MODEL_NAME-%>'); 6 | const response = require('../../utils/response'); 7 | 8 | const partialUpdate = ({ <%-MODEL_NAME-%>Db }) => async (params) => { 9 | const <%-MODEL_NAME.toLowerCase()-%> = await <%-MODEL_NAME-%>Db.updateOne(params.query,params.dataToUpdate); 10 | if(!<%-MODEL_NAME.toLowerCase()-%>){ 11 | return response.recordNotFound(); 12 | } 13 | return response.success({data:<%-MODEL_NAME.toLowerCase()-%>}); 14 | } 15 | module.exports = partialUpdate; -------------------------------------------------------------------------------- /packages/server/usecase/project/archivedProjects.js: -------------------------------------------------------------------------------- 1 | const { 2 | OK, SERVER_ERROR, 3 | } = require('../../constants/message').message; 4 | 5 | const paginate = (projectRepo) => async (param) => { 6 | try { 7 | let params = param; 8 | if (!params) { 9 | params = {}; 10 | } 11 | const filter = params; 12 | const response = { 13 | list: await projectRepo.getDetails(filter), 14 | count: await projectRepo.getCount(filter), 15 | }; 16 | return { 17 | ...OK, 18 | data: response, 19 | }; 20 | } catch (err) { 21 | // console.log('error', err); 22 | return SERVER_ERROR; 23 | } 24 | }; 25 | module.exports = paginate; 26 | -------------------------------------------------------------------------------- /packages/server/usecase/application/getLastApplication.js: -------------------------------------------------------------------------------- 1 | const { 2 | APPLICATION_NOT_FOUND, OK, SERVER_ERROR, 3 | } = require('../../constants/message').message; 4 | 5 | /** 6 | * 7 | * Function used for get user. 8 | * @return json 9 | */ 10 | const get = (applicationRepo) => async () => { 11 | try { 12 | const filter = { _id: -1 }; 13 | const application = await applicationRepo.getAll(filter); 14 | 15 | if (!application.length) { 16 | return APPLICATION_NOT_FOUND; 17 | } 18 | 19 | return { 20 | ...OK, 21 | data: application[0], 22 | }; 23 | } catch (err) { 24 | return SERVER_ERROR; 25 | } 26 | }; 27 | 28 | module.exports = get; 29 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/use-case/findById.js.ejs: -------------------------------------------------------------------------------- 1 | const response = require('../../utils/response'); 2 | 3 | /** 4 | * @description : find record of <%-MODEL_NAME_FC%> from database by id; 5 | * @param {Object} params : request body including option and query. 6 | * @return {Object} : found <%-MODEL_NAME_FC%>. {status, message, data} 7 | */ 8 | const findById = ({ <%-MODEL_NAME-%>Db }) => async (params) => { 9 | let result = await <%-MODEL_NAME-%>Db.findOne(params.query, params.options); 10 | if(!result){ 11 | return response.recordNotFound(); 12 | } 13 | return response.success({data:result}); 14 | } 15 | module.exports = findById; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/individualRoutes/controller.js.ejs: -------------------------------------------------------------------------------- 1 | const response = require('../../../utils/response'); 2 | const responseHandler = require('../../../utils/response/responseHandler'); 3 | 4 | <%_ROUTES.forEach((v,i)=>{_%> 5 | const <%-v.functionName%> = (<%-v.functionName%>Usecase) => async(req,res) =>{ 6 | try{ 7 | return await <%-v.functionName%>Usecase(req,res); 8 | }catch(error){ 9 | return responseHandler(res,response.internalServerError({message:error.message})); 10 | } 11 | } 12 | <%_})_%> 13 | 14 | module.exports = { 15 | <%_ROUTES.forEach((v,i)=>{_%> 16 | <%-v.functionName%>, 17 | <%_})_%> 18 | } -------------------------------------------------------------------------------- /packages/server/usecase/schema/util/index.js: -------------------------------------------------------------------------------- 1 | const validateProperties = require('./validateProps'); 2 | const updateSchemaRefAttribute = require('./updateSchemaRefAttribute'); 3 | const validateRegEx = require('./validateRegEx'); 4 | const isRegExp = require('./isRegExp'); 5 | const updateSchemaReferences = require('./updateSchemaReferences'); 6 | const deleteSchemaReferences = require('./deleteSchemaReferences'); 7 | const deleteSchemaRefInfo = require('./deleteSchemaRefInfo'); 8 | 9 | module.exports = { 10 | validateProperties, 11 | updateSchemaRefAttribute, 12 | validateRegEx, 13 | isRegExp, 14 | updateSchemaReferences, 15 | deleteSchemaReferences, 16 | deleteSchemaRefInfo, 17 | }; 18 | -------------------------------------------------------------------------------- /packages/client/src/components/BoxLayout/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { boxLayoutCss } from './boxLayoutCss'; 4 | 5 | export const BoxLayout = ({ 6 | children, variant, className, style, 7 | }) => { 8 | const variantClass = `${boxLayoutCss[[`box${variant}`]]}`; 9 | return ( 10 |
11 | {children} 12 |
13 | ); 14 | }; 15 | 16 | BoxLayout.propTypes = { 17 | variant: PropTypes.oneOf([ 18 | 'mainRight', 19 | 'subSidebar', 20 | 'subRight', 21 | 'fullscreen', 22 | ]), 23 | }; 24 | BoxLayout.defaultProps = { 25 | variant: 'mainRight', 26 | }; 27 | -------------------------------------------------------------------------------- /packages/client/src/components/Heading/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { HeadingCss } from './headingCss'; 4 | 5 | export const Heading = ({ className, children, variant }) => { 6 | const variantClass = `${HeadingCss[[`title${variant}`]]}`; 7 | return

{children}

; 8 | }; 9 | Heading.propTypes = { 10 | className: PropTypes.string, 11 | variant: PropTypes.oneOf(['small', 'normal', 'h3', 'h4', 'h1', 'h2', 'h5', 'h6', 'h2Light', 'h3Light', 'h4Light', 'h5ight', 'h6Light']), 12 | }; 13 | 14 | Heading.defaultProps = { 15 | className: '', 16 | variant: 'normal', 17 | }; 18 | -------------------------------------------------------------------------------- /packages/client/src/constant/applicationConstant.js: -------------------------------------------------------------------------------- 1 | export const CONSTANT_GENERATE_TYPE = { 2 | AUTO: 1, 3 | MANUAL: 2, 4 | }; 5 | export const NODE_DATA_TYPE = { 6 | NUMBER: 'number', 7 | STRING: 'string', 8 | JSON: 'json', 9 | ARRAY: 'array', 10 | }; 11 | export const NODE_DATA_TYPE_OPTION = [ 12 | { 13 | name: 'String', 14 | value: NODE_DATA_TYPE.STRING, 15 | }, 16 | { 17 | name: 'Number', 18 | value: NODE_DATA_TYPE.NUMBER, 19 | }, 20 | { 21 | name: 'Json', 22 | value: NODE_DATA_TYPE.JSON, 23 | }, 24 | { 25 | name: 'Array of value', 26 | value: NODE_DATA_TYPE.ARRAY, 27 | }, 28 | ]; 29 | export const nodeConstantName = /^[a-zA-Z_]+[\w0-9_]*$/; 30 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/helpers/date.js: -------------------------------------------------------------------------------- 1 | const getDifferenceOfTwoDatesInTime = (currentDate, toDate) => { 2 | const hours = toDate.diff(currentDate, 'hour'); 3 | currentDate = currentDate.add(hours, 'hour'); 4 | const minutes = toDate.diff(currentDate, 'minute'); 5 | currentDate = currentDate.add(minutes, 'minute'); 6 | const seconds = toDate.diff(currentDate, 'second'); 7 | currentDate = currentDate.add(seconds, 'second'); 8 | if (hours) { 9 | return `${hours} hour, ${minutes} minute and ${seconds} second`; 10 | } 11 | return `${minutes} minute and ${seconds} second`; 12 | }; 13 | 14 | module.exports = { getDifferenceOfTwoDatesInTime }; 15 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/helpers/date.js: -------------------------------------------------------------------------------- 1 | const getDifferenceOfTwoDatesInTime = (currentDate, toDate) => { 2 | const hours = toDate.diff(currentDate, 'hour'); 3 | currentDate = currentDate.add(hours, 'hour'); 4 | const minutes = toDate.diff(currentDate, 'minute'); 5 | currentDate = currentDate.add(minutes, 'minute'); 6 | const seconds = toDate.diff(currentDate, 'second'); 7 | currentDate = currentDate.add(seconds, 'second'); 8 | if (hours) { 9 | return `${hours} hour, ${minutes} minute and ${seconds} second`; 10 | } 11 | return `${minutes} minute and ${seconds} second`; 12 | }; 13 | 14 | module.exports = { getDifferenceOfTwoDatesInTime }; 15 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/individualRoutes/controller.js.ejs: -------------------------------------------------------------------------------- 1 | const response = require('../../../utils/response'); 2 | const responseHandler = require('../../../response/responseHandler'); 3 | 4 | <%_ROUTES.forEach((v,i)=>{_%> 5 | const <%-v.functionName%> = (<%-v.functionName%>Usecase) => async(req,res) =>{ 6 | try{ 7 | return await <%-v.functionName%>Usecase(req,res); 8 | }catch(error){ 9 | return responseHandler(res,response.internalServerError({message:error.message})); 10 | } 11 | } 12 | <%_})_%> 13 | 14 | module.exports = { 15 | <%_ROUTES.forEach((v,i)=>{_%> 16 | <%-v.functionName%>, 17 | <%_})_%> 18 | } 19 | 20 | -------------------------------------------------------------------------------- /packages/client/src/components/Description/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import { DescriptionCss } from './descriptionCss'; 4 | 5 | export const Description = ({ 6 | children, className, variant, style, 7 | }) => { 8 | const variantClass = `${DescriptionCss[[`desc${variant}`]]}`; 9 | return ( 10 |

{children}

11 | ); 12 | }; 13 | Description.propTypes = { 14 | className: PropTypes.string, 15 | variant: PropTypes.oneOf(['normal', 'subTitle', 'light']), 16 | }; 17 | 18 | Description.defaultProps = { 19 | className: '', 20 | variant: 'normal', 21 | }; 22 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/count.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | count.js 3 | */ 4 | 5 | const response = require('../../utils/response'); 6 | 7 | /** 8 | * @description : returns total number of documents of <%-MODEL_NAME%> 9 | * @param {object} <%-MODEL_NAME-%>Db : db service instance 10 | * @param {object} params : {where: query to find data} 11 | * @return {object} : response of count. {status, message, data} 12 | */ 13 | const count = ({ <%-MODEL_NAME-%>Db }) => async (params) => { 14 | let result = await <%-MODEL_NAME-%>Db.count(params); 15 | result = {totalRecords:result} 16 | return response.success({data:result}); 17 | } 18 | module.exports = count; -------------------------------------------------------------------------------- /packages/server/models/responses/error.js: -------------------------------------------------------------------------------- 1 | /* global MESSAGE, _ */ 2 | // eslint-disable-next-line no-multi-assign ,no-undef 3 | module.exports = ok = (res, body) => { 4 | const used = process.memoryUsage(); 5 | const memUsage = []; 6 | // eslint-disable-next-line no-restricted-syntax,guard-for-in 7 | for (const key in used) { 8 | memUsage.push(`${key} - ${(Math.round(used[key] / 1024 / 1024) * 100) / 100} MB`); 9 | } 10 | const data = body; 11 | body = { 12 | code: _.get(data, 'code', MESSAGE.ERROR.code), 13 | message: _.get(data, 'message', MESSAGE.ERROR.message), 14 | data: _.get(data, 'data', {}), 15 | memUsage, 16 | }; 17 | return res.status(MESSAGE.ERROR.status).send(body); 18 | }; 19 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/createApplication/createDataAccessFiles/index.js: -------------------------------------------------------------------------------- 1 | const { forEach } = require('lodash'); 2 | const writeOperations = require('../../writeOperations'); 3 | 4 | const createDataAccessFiles = (templatePath, models) => { 5 | const allDataAccessFiles = {}; 6 | forEach(models, (value, key) => { 7 | const dbFileTemplate = writeOperations.loadTemplate(`${templatePath}/dbFile.js`); 8 | dbFileTemplate.locals.MODEL_NAME_FC = key.charAt(0).toUpperCase() + key.slice(1); 9 | dbFileTemplate.locals.MODEL_NAME = key; 10 | allDataAccessFiles[key] = dbFileTemplate; 11 | }); 12 | return allDataAccessFiles; 13 | }; 14 | 15 | module.exports = { createDataAccessFiles }; 16 | -------------------------------------------------------------------------------- /packages/server/usecase/application/openCode.js: -------------------------------------------------------------------------------- 1 | /* global __appRootDir,MESSAGE */ 2 | const { spawn } = require('child_process'); 3 | const path = require('path'); 4 | 5 | const openCode = () => async (params) => { 6 | try { 7 | const command = `cd "${path.join(__appRootDir, 'output', params.generatedId, params.name)}" && code .`; 8 | const response = await new Promise((resolve) => { 9 | const child = spawn(command, { shell: true }); 10 | child.on('close', async () => { 11 | resolve(MESSAGE.OK); 12 | child.kill(0); 13 | }); 14 | }); 15 | return response; 16 | } catch (error) { 17 | return MESSAGE.SERVER_ERROR; 18 | } 19 | }; 20 | 21 | module.exports = openCode; 22 | -------------------------------------------------------------------------------- /packages/server/usecase/schema/get.js: -------------------------------------------------------------------------------- 1 | const { 2 | INVALID_REQUEST_PARAMS, OK, SERVER_ERROR, SCHEMA_DETAIL_NOT_FOUND, 3 | } = require('../../constants/message').message; 4 | 5 | const get = (schemaRepo) => async (id) => { 6 | try { 7 | if (!id) { 8 | return INVALID_REQUEST_PARAMS; 9 | } 10 | 11 | const filter = { find: { _id: id } }; 12 | const schemaDetails = await schemaRepo.get(filter); 13 | if (!schemaDetails) { 14 | return SCHEMA_DETAIL_NOT_FOUND; 15 | } 16 | 17 | return { 18 | ...OK, 19 | data: schemaDetails, 20 | }; 21 | } catch (err) { 22 | // console.log('error', err); 23 | return SERVER_ERROR; 24 | } 25 | }; 26 | 27 | module.exports = get; 28 | -------------------------------------------------------------------------------- /packages/client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import reportWebVitals from './reportWebVitals'; 5 | import './assets/css/main.css'; 6 | import './assets/css/components/style.css'; 7 | import './assets/css/drawer.css'; 8 | import './assets/css/sidebar.css'; 9 | 10 | ReactDOM.render( 11 | 12 | 13 | , 14 | document.getElementById('root'), 15 | ); 16 | 17 | // If you want to start measuring performance in your app, pass a function 18 | // to log results (for example: reportWebVitals(console.log)) 19 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals 20 | reportWebVitals(); 21 | -------------------------------------------------------------------------------- /packages/server/models/responses/ok.js: -------------------------------------------------------------------------------- 1 | /* global MESSAGE, _ */ 2 | 3 | // eslint-disable-next-line no-multi-assign ,no-undef 4 | module.exports = ok = async (res, body) => { 5 | const used = process.memoryUsage(); 6 | const memUsage = []; 7 | // eslint-disable-next-line no-restricted-syntax,guard-for-in 8 | for (const key in used) { 9 | memUsage.push(`${key} - ${(Math.round(used[key] / 1024 / 1024) * 100) / 100} MB`); 10 | } 11 | const data = body; 12 | body = { 13 | code: _.get(data, 'code', MESSAGE.ERROR.code), 14 | message: _.get(data, 'message', MESSAGE.ERROR.message), 15 | data: _.get(data, 'data', {}), 16 | memUsage, 17 | }; 18 | return res.status(MESSAGE.OK.status).send(body); 19 | }; 20 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/use-case/bulkUpdate.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | updateBulk.js 3 | */ 4 | 5 | const response = require('../../utils/response'); 6 | 7 | /** 8 | * @description : update multiple records of <%-MODEL_NAME%> with data by filter. 9 | * @param {object} <%-MODEL_NAME-%>Db : db service instance 10 | * @param {object} params : request body including query and data to update. 11 | * @return {object} : updated documents 12 | */ 13 | const bulkUpdate = ({ <%-MODEL_NAME-%>Db }) => async (params) => { 14 | const results = await <%-MODEL_NAME-%>Db.updateMany(params.query,params.dataToUpdate); 15 | return response.success({ data:results }); 16 | } 17 | module.exports = bulkUpdate; -------------------------------------------------------------------------------- /packages/server/controllers/web/envVariables/index.js: -------------------------------------------------------------------------------- 1 | const EnvVariablesRepository = require('../../../repo/envVariables'); 2 | const ApplicationRepo = require('../../../repo/application'); 3 | 4 | const envVariablesRepo = new EnvVariablesRepository(); 5 | const applicationRepo = new ApplicationRepo(); 6 | 7 | const upsertUseCase = require('../../../usecase/envVariables/upsert')(envVariablesRepo, applicationRepo); 8 | const getUseCase = require('../../../usecase/envVariables/get')(envVariablesRepo); 9 | 10 | const envVariables = require('./envVariables'); 11 | 12 | const upsert = envVariables.upsert({ upsertUseCase }); 13 | const get = envVariables.get({ getUseCase }); 14 | 15 | module.exports = { 16 | upsert, 17 | get, 18 | }; 19 | -------------------------------------------------------------------------------- /packages/server/models/responses/forbidden.js: -------------------------------------------------------------------------------- 1 | /* global MESSAGE, _ */ 2 | // eslint-disable-next-line no-multi-assign ,no-undef 3 | module.exports = ok = (res, body) => { 4 | const used = process.memoryUsage(); 5 | const memUsage = []; 6 | // eslint-disable-next-line no-restricted-syntax,guard-for-in 7 | for (const key in used) { 8 | memUsage.push(`${key} - ${(Math.round(used[key] / 1024 / 1024) * 100) / 100} MB`); 9 | } 10 | const data = body; 11 | body = { 12 | code: _.get(data, 'code', MESSAGE.FORBIDDEN.code), 13 | message: _.get(data, 'message', MESSAGE.FORBIDDEN.message), 14 | data: _.get(data, 'data', {}), 15 | memUsage, 16 | }; 17 | return res.status(MESSAGE.FORBIDDEN.status).send(body); 18 | }; 19 | -------------------------------------------------------------------------------- /packages/server/models/responses/notFound.js: -------------------------------------------------------------------------------- 1 | /* global MESSAGE, _ */ 2 | // eslint-disable-next-line no-multi-assign ,no-undef 3 | module.exports = ok = async (res, body) => { 4 | const used = process.memoryUsage(); 5 | const memUsage = []; 6 | // eslint-disable-next-line no-restricted-syntax,guard-for-in 7 | for (const key in used) { 8 | memUsage.push(`${key} - ${(Math.round(used[key] / 1024 / 1024) * 100) / 100} MB`); 9 | } 10 | const data = body; 11 | body = { 12 | code: _.get(data, 'code', MESSAGE.ERROR.code), 13 | message: _.get(data, 'message', MESSAGE.ERROR.message), 14 | data: _.get(data, 'data', {}), 15 | memUsage, 16 | }; 17 | return res.status(MESSAGE.NOT_FOUND.status).send(body); 18 | }; 19 | -------------------------------------------------------------------------------- /packages/server/constants/dataTypes/sequelize/mySqlDataTypes.js: -------------------------------------------------------------------------------- 1 | /* global _ */ 2 | 3 | let DATA_TYPES = require('../dataTypes'); 4 | 5 | /** 6 | * To omit some properties from defined dataTypes. 7 | * Ex: 8 | */ 9 | 10 | /* 11 | * const STRING = { ...DATA_TYPES.STRING, ...{ NA_PROPS: [PROPS.DEFAULT] } }; 12 | * const ARRAY = { ...DATA_TYPES.ARRAY, ...{ NA_PROPS: [PROPS.REQUIRED] } }; 13 | * 14 | * DATA_TYPES = { ...DATA_TYPES, ...{ STRING, ARRAY } }; 15 | */ 16 | 17 | DATA_TYPES = _.omit(DATA_TYPES, [ 18 | DATA_TYPES.UUID.VALUE, 19 | DATA_TYPES.UUIDV4.VALUE, 20 | DATA_TYPES.BLOB.VALUE, 21 | DATA_TYPES.JSONB.VALUE, 22 | DATA_TYPES.ARRAY.VALUE, 23 | DATA_TYPES.RANGE.VALUE, 24 | ]); 25 | module.exports = { DATA_TYPES }; 26 | -------------------------------------------------------------------------------- /packages/server/models/responses/badRequest.js: -------------------------------------------------------------------------------- 1 | /* global MESSAGE, _ */ 2 | // eslint-disable-next-line no-multi-assign ,no-undef 3 | module.exports = ok = async (res, body) => { 4 | const used = process.memoryUsage(); 5 | const memUsage = []; 6 | // eslint-disable-next-line no-restricted-syntax,guard-for-in 7 | for (const key in used) { 8 | memUsage.push(`${key} - ${(Math.round(used[key] / 1024 / 1024) * 100) / 100} MB`); 9 | } 10 | const data = body; 11 | body = { 12 | code: _.get(data, 'code', MESSAGE.ERROR.code), 13 | message: _.get(data, 'message', MESSAGE.ERROR.message), 14 | data: _.get(data, 'data', {}), 15 | memUsage, 16 | }; 17 | return res.status(MESSAGE.BAD_REQUEST.status).send(body); 18 | }; 19 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/utils/validateRequest.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @description : validate request body parameter with joi. 3 | * @param {object} payload : body from request. 4 | * @param {object} schemaKeys : model wise schema keys. ex. user validation object. 5 | * @returns : returns validation with message {isValid, message} 6 | */ 7 | 8 | exports.validateParamsWithJoi = (payload, schemaKeys) => { 9 | const { error } = schemaKeys.validate(payload, { abortEarly: false }); 10 | if (error) { 11 | const message = error.details.map((el) => el.message).join('\n'); 12 | return { 13 | isValid: false, 14 | message, 15 | }; 16 | } 17 | return { isValid: true }; 18 | }; 19 | -------------------------------------------------------------------------------- /packages/server/util-service/common/common.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | /** 4 | * Function used get `directories, sub-directories, files` count. 5 | * @param {} dirPath 6 | * @param {} arrayOfFiles 7 | */ 8 | async function getAllDirFilesCount (dirPath, arrayOfFiles) { 9 | const files = fs.readdirSync(dirPath); 10 | 11 | arrayOfFiles = arrayOfFiles || []; 12 | 13 | files.forEach(async (file) => { 14 | if (fs.statSync(`${dirPath}/${file}`).isDirectory()) { 15 | arrayOfFiles = await getAllDirFilesCount(`${dirPath}/${file}`, arrayOfFiles); 16 | } else { 17 | arrayOfFiles.push(file); 18 | } 19 | }); 20 | 21 | return arrayOfFiles.length; 22 | } 23 | 24 | module.exports = { getAllDirFilesCount }; 25 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/createApplication/applyEslint.js: -------------------------------------------------------------------------------- 1 | const { execSync } = require('child_process'); 2 | const fs = require('fs'); 3 | const writeOperations = require('../writeOperations'); 4 | 5 | function copyEslintrcFile (templateFolderName, dir) { 6 | if (!fs.existsSync(`${dir}/.eslintrc.js`)) { 7 | writeOperations.copyTemplate(`${templateFolderName}/.eslintrc.js`, `${dir}/.eslintrc.js`); 8 | } 9 | } 10 | 11 | function executeEslintFix (dir) { 12 | try { 13 | const command = `cd "${dir}" && eslint . --ext .js --fix`; 14 | execSync(command); 15 | } catch (error) { 16 | // console.log(error); 17 | } 18 | } 19 | module.exports = { 20 | copyEslintrcFile, 21 | executeEslintFix, 22 | }; 23 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/data-access/dbFile.js.ejs: -------------------------------------------------------------------------------- 1 | let <%-MODEL_NAME_FC-%> = require('../db/sequelize/models').<%-MODEL_NAME-%>; 2 | let { create, 3 | createMany, 4 | updateOne, 5 | updateMany, 6 | deleteOne, 7 | deleteMany, 8 | softDelete, 9 | softDeleteMany, 10 | findOne, 11 | findMany, 12 | paginate, 13 | count, 14 | } = require('../db/sequelize/dbService')(<%-MODEL_NAME_FC-%>); 15 | 16 | module.exports = { 17 | create, 18 | createMany, 19 | updateOne, 20 | updateMany, 21 | deleteOne, 22 | deleteMany, 23 | softDelete, 24 | softDeleteMany, 25 | findOne, 26 | findMany, 27 | paginate, 28 | count, 29 | }; -------------------------------------------------------------------------------- /packages/client/src/components/ToggleBox/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Icons } from '@dhiwise/icons'; 3 | 4 | export const ToggleBox = ({ 5 | onClick, isPin, isSidebar, ClassName, 6 | }) => ( 7 |
13 | {isSidebar && ( 14 |
15 | 16 |
17 | )} 18 | {!isSidebar && ( 19 |
20 | 21 |
22 | )} 23 |
24 | ); 25 | -------------------------------------------------------------------------------- /packages/client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | pointer-events: none; 8 | } 9 | 10 | @media (prefers-reduced-motion: no-preference) { 11 | .App-logo { 12 | animation: App-logo-spin infinite 20s linear; 13 | } 14 | } 15 | 16 | .App-header { 17 | background-color: #282c34; 18 | min-height: 100vh; 19 | display: flex; 20 | flex-direction: column; 21 | align-items: center; 22 | justify-content: center; 23 | font-size: calc(10px + 2vmin); 24 | color: white; 25 | } 26 | 27 | .App-link { 28 | color: #61dafb; 29 | } 30 | 31 | @keyframes App-logo-spin { 32 | from { 33 | transform: rotate(0deg); 34 | } 35 | to { 36 | transform: rotate(360deg); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/client/src/container/CRUD/Modal/LibraryPreview/PreviewTable/EditableCell.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable react/jsx-props-no-spreading */ 2 | import React from 'react'; 3 | import { Input } from '../../../../../components'; 4 | 5 | function EditableCell({ row: { original }, column: { id } }) { 6 | return ( 7 |
8 | 16 |
17 | ); 18 | } 19 | 20 | export default EditableCell; 21 | -------------------------------------------------------------------------------- /packages/server/models/responses/serverError.js: -------------------------------------------------------------------------------- 1 | /* global MESSAGE, _ */ 2 | // eslint-disable-next-line no-multi-assign ,no-undef 3 | module.exports = ok = (res, body) => { 4 | const used = process.memoryUsage(); 5 | const memUsage = []; 6 | 7 | // eslint-disable-next-line no-restricted-syntax,guard-for-in 8 | for (const key in used) { 9 | memUsage.push(`${key} - ${(Math.round(used[key] / 1024 / 1024) * 100) / 100} MB`); 10 | } 11 | const data = body; 12 | body = { 13 | code: _.get(data, 'code', MESSAGE.SERVER_ERROR.code), 14 | message: _.get(data, 'message', MESSAGE.SERVER_ERROR.message), 15 | data: _.get(data, 'data', {}), 16 | memUsage, 17 | }; 18 | return res.status(MESSAGE.SERVER_ERROR.status).send(body); 19 | }; 20 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/data-access/dbFile.js.ejs: -------------------------------------------------------------------------------- 1 | let <%-MODEL_NAME_FC-%> = require('../db/mongoDB/models/<%-MODEL_NAME-%>'); 2 | let { create, 3 | createMany, 4 | updateOne, 5 | updateMany, 6 | deleteOne, 7 | deleteMany, 8 | softDelete, 9 | softDeleteMany, 10 | findOne, 11 | findMany, 12 | paginate, 13 | count, 14 | upsert } = require('../db/mongoDB/dbService')(<%-MODEL_NAME_FC-%>); 15 | 16 | module.exports = { 17 | create, 18 | createMany, 19 | updateOne, 20 | updateMany, 21 | deleteOne, 22 | deleteMany, 23 | softDelete, 24 | softDeleteMany, 25 | findOne, 26 | findMany, 27 | paginate, 28 | count, 29 | upsert 30 | }; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/config/db.js.ejs: -------------------------------------------------------------------------------- 1 | if(process.env.NODE_ENV !== 'test'){ 2 | module.exports = { 3 | HOST: process.env.HOST, 4 | USER: process.env.DATABASE_USERNAME, 5 | PASSWORD: process.env.DATABASE_PASSWORD, 6 | DB: process.env.DATABASE_NAME, 7 | dialect: <%=ADAPTER%>, 8 | port: process.env.DB_PORT, 9 | } 10 | }else{ 11 | module.exports = { 12 | HOST: process.env.TEST_HOST, 13 | USER: process.env.TEST_DATABASE_USERNAME, 14 | PASSWORD: process.env.TEST_DATABASE_PASSWORD, 15 | DB: process.env.TEST_DATABASE_NAME, 16 | dialect: <%=ADAPTER%>, 17 | port: process.env.TEST_DB_PORT, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/client/src/container/Configuration/CodeGenerateConfiguration/DataFormatConfig/Head/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Description, Heading, Button } from '../../../../../components'; 3 | 4 | export const Head = ({ handleShow }) => ( 5 |
6 |
7 | Data format 8 | 9 | Configure a global data format for your model attributes. 10 | 11 |
12 |
13 | 14 |
15 |
16 | ); 17 | -------------------------------------------------------------------------------- /packages/server/models/responses/unauthorized.js: -------------------------------------------------------------------------------- 1 | /* global MESSAGE, _ */ 2 | // eslint-disable-next-line no-multi-assign ,no-undef 3 | module.exports = unauthorized = (res, body) => { 4 | const used = process.memoryUsage(); 5 | const memUsage = []; 6 | // eslint-disable-next-line no-restricted-syntax,guard-for-in 7 | for (const key in used) { 8 | memUsage.push(`${key} - ${(Math.round(used[key] / 1024 / 1024) * 100) / 100} MB`); 9 | } 10 | const data = body; 11 | body = { 12 | code: _.get(data, 'code', MESSAGE.UNAUTHORIZED.code), 13 | message: _.get(data, 'message', MESSAGE.UNAUTHORIZED.message), 14 | data: _.get(data, 'data', {}), 15 | memUsage, 16 | }; 17 | return res.status(MESSAGE.UNAUTHORIZED.status).send(body); 18 | }; 19 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/routes/platformIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * index route file of <%-PLATFORM_NAME.toLowerCase()%> platform. 3 | * @description: exports all routes of <%-PLATFORM_NAME.toLowerCase()%> platform. 4 | */ 5 | 6 | const express = require("express") 7 | const router = express.Router() 8 | <%_ if(IS_AUTH){ _%> 9 | router.use("/<%-PLATFORM_NAME.toLowerCase()%>/auth",require("./auth")); 10 | <%_ } _%> 11 | <%_ for(let i in PLATFORM){ _%> 12 | router.use(require("./<%-i%>Routes")); 13 | <%_}_%> 14 | <%_if(typeof ROUTES!=="undefined"){_%> 15 | <%_ ROUTES.forEach((v,i)=>{ _%> 16 | router.use("/",require("./<%-v.controller%>Routes")); 17 | <%_})_%> 18 | <%_}_%> 19 | 20 | module.exports = router; 21 | -------------------------------------------------------------------------------- /packages/client/src/config/LazyLoader.js: -------------------------------------------------------------------------------- 1 | import Loadable from 'react-loadable'; 2 | import React from 'react'; 3 | // import Lottie from 'react-lottie'; 4 | // import animationData from './loaderdata.json'; 5 | import logoLoader from '../assets/images/gif/logo-loader.gif'; 6 | 7 | export default function LazyLoader(opts) { 8 | return Loadable({ 9 | loading: () => ( 10 |
11 | {/* */} 16 | loader 17 |
18 | ), 19 | delay: 200, 20 | timeout: 10000, 21 | ...opts, 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /packages/client/src/container/CRUD/Routes/AddRoutes/QueryBuilder/ResponseProvider.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export const ResponseContext = React.createContext(); 4 | 5 | const ResponseProvider = ({ children }) => { 6 | const [currentResponseId, setResponseId] = React.useState(0); 7 | const value = { 8 | currentResponseId, 9 | setResponseId, 10 | }; 11 | return {children}; 12 | }; 13 | function useQueryResponse() { 14 | const context = React.useContext(ResponseContext); 15 | if (context === undefined) { 16 | throw new Error('useSmsData must be used within a SMSProvider'); 17 | } 18 | return context; 19 | } 20 | 21 | export { ResponseProvider, useQueryResponse }; 22 | -------------------------------------------------------------------------------- /packages/client/src/assets/css/tooltip.css: -------------------------------------------------------------------------------- 1 | .__react_component_tooltip { 2 | background-color: var(--color-bg-black) !important; 3 | color: var(--color-bg-light) !important; 4 | font-weight: 600; 5 | z-index: 10000 !important; 6 | font-size: 14px !important; 7 | } 8 | 9 | .__react_component_tooltip.place-right:after { 10 | border-right-color: var(--color-bg-black) !important; 11 | } 12 | 13 | .__react_component_tooltip.place-left:after { 14 | border-left-color: var(--color-bg-black) !important; 15 | } 16 | 17 | .__react_component_tooltip.place-bottom:after { 18 | border-bottom-color: var(--color-bg-black) !important; 19 | } 20 | 21 | .__react_component_tooltip.place-top:after { 22 | border-top-color: var(--color-bg-black) !important; 23 | } -------------------------------------------------------------------------------- /packages/client/src/components/MessageNotify/informessageCss.js: -------------------------------------------------------------------------------- 1 | export const InformessageCss = { 2 | messagebox: 'relative flex items-start rounded-3 border-l-4', 3 | messagenormal: 'p-3', 4 | messagesmall: 'p-2', 5 | messageimg: 'flex-shrink-0', 6 | messageImgnormal: 'w-4 mr-3 ', 7 | messageImgsmall: 'w-3.5 mr-2', 8 | messagedec: 'text-primary-message font-bold flex-grow', 9 | messageTextnormal: 'text-sm', 10 | messageTextsmall: 'text-xs', 11 | messageclose: 'w-4 h-4 object-contain m-auto absolute right-5 top-0 bottom-0 cursor-pointer', 12 | messageinfo: 'bg-secondary-bluelight border-secondary-blue', 13 | messagewarring: 'bg-secondary-yellowlight border-secondary-yellow', 14 | messagealert: 'bg-secondary-redlight border-gray-deactivebg', 15 | }; 16 | -------------------------------------------------------------------------------- /packages/client/src/components/Tag/tagCss.js: -------------------------------------------------------------------------------- 1 | export const TagCss = { 2 | tagWrap: 'cursor-pointer inline-flex justify-between items-center inline-block rounded-3', 3 | tagprimary: 'bg-primary-dark border-1 border-primary-dark text-defaultWhite', 4 | tagsecondary: 'border-1 border-gray-70 text-primary-text', 5 | tagghost: 'text-lg text-primary-dark cursor-text', 6 | tagcoolGray: 'border-1 border-gray-100 text-primary-text', 7 | tagactive: 'bg-activebg text-activetext', 8 | tagdeactive: 'bg-deactivebg text-deactivetext', 9 | tagnormal: 'py-0.5 px-3 text-xxs font-semibold leading-5', 10 | tagsmall: 'px-1 py-0.5 text-xxs leading-4 font-semibold', 11 | tagxxs: 'text-xxs leading-3 p-0.5 -right-12', 12 | disabledTag: 'opacity-60 cursor-not-allowed', 13 | }; 14 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/bulkUpdate.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | updateBulk.js 3 | */ 4 | 5 | const response = require('../../utils/response'); 6 | 7 | /** 8 | * @description : update multiple records of <%-MODEL_NAME%> with data by filter. 9 | * @param {object} <%-MODEL_NAME-%>Db : db service instance 10 | * @param {object} params : {query: query to find data, data: data to update } 11 | * @return {object} : response of bulkUpdate. {status, message, data} 12 | */ 13 | const bulkUpdate = ({ <%-MODEL_NAME-%>Db }) => async (params) => { 14 | const results = await <%-MODEL_NAME-%>Db.updateMany(params.query,params.dataToUpdate); 15 | return response.success({ data:results }); 16 | } 17 | module.exports = bulkUpdate; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/createApplication/createEntities.js: -------------------------------------------------------------------------------- 1 | const { 2 | keys, forEach, 3 | } = require('lodash'); 4 | const writeOperations = require('../writeOperations'); 5 | 6 | async function createEntities (entityFolderPath, entities) { 7 | const allEJSEntities = {}; 8 | forEach(entities, (value, key) => { 9 | const entityTemplate = writeOperations.loadTemplate(`${entityFolderPath}/entity.js`); 10 | entityTemplate.locals.ENTITY_NAME_FC = key.charAt(0).toUpperCase() + key.slice(1); 11 | entityTemplate.locals.ENTITY_NAME = key; 12 | entityTemplate.locals.ENTITY_KEYS = keys(entities[key]); 13 | allEJSEntities[key] = entityTemplate; 14 | }); 15 | return allEJSEntities; 16 | } 17 | 18 | module.exports = { createEntities }; 19 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/findAll.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | *findAll.js 3 | */ 4 | 5 | const response = require('../../utils/response'); 6 | 7 | const findAll = ({ <%-MODEL_NAME-%>Db }) => async (params) => { 8 | let { query, options,isCountOnly } = params; 9 | if(isCountOnly){ 10 | let count = await <%-MODEL_NAME-%>Db.count(query); 11 | let result = { totalRecords: count }; 12 | return response.success({ data:result }); 13 | } else { 14 | let result = await <%-MODEL_NAME-%>Db.paginate(query,options); 15 | if(result){ 16 | return response.success({ data:result }); 17 | } 18 | return response.recordNotFound(); 19 | } 20 | } 21 | module.exports = findAll; -------------------------------------------------------------------------------- /packages/server/routes/web/application/application.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | create, paginate, generate, structure, destroy, update, view, 7 | get, openCode, getLastApplication, 8 | } = require('../../../controllers/web/application'); 9 | 10 | router.post('/create', create); 11 | router.post('/paginate', paginate); 12 | router.get('/last-application', getLastApplication); 13 | router.get('/:id', get); 14 | router.post('/generate', generate); 15 | router.post('/structure', structure); 16 | router.put('/invite/:id', update); 17 | router.put('/:id', update); 18 | router.post('/destroy', destroy); 19 | router.post('/view', view); 20 | router.post('/open-generated-code', openCode); 21 | 22 | module.exports = router; 23 | -------------------------------------------------------------------------------- /packages/client/src/redux/store.js: -------------------------------------------------------------------------------- 1 | import storage from 'redux-persist/lib/storage'; 2 | import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit'; 3 | import { 4 | persistReducer, 5 | FLUSH, 6 | REHYDRATE, 7 | PAUSE, 8 | PERSIST, 9 | PURGE, 10 | REGISTER, 11 | } from 'redux-persist'; 12 | import rootReducer from './reducers'; 13 | 14 | const persistConfig = { 15 | key: 'dhiWise', 16 | version: 1, 17 | storage, 18 | }; 19 | 20 | const persistedReducer = persistReducer({ ...persistConfig }, rootReducer); 21 | 22 | export default configureStore({ 23 | reducer: persistedReducer, 24 | middleware: getDefaultMiddleware({ 25 | serializableCheck: { 26 | ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], 27 | }, 28 | }), 29 | 30 | }); 31 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/authentication/authentication.js.ejs: -------------------------------------------------------------------------------- 1 | 2 | const response = require('../../utils/response'); 3 | const makeLoginUser = require('../common/loginUser'); 4 | 5 | const authentication = ({ <%-USER_MODEL-%>Db,userTokensDb<%_if(ROLE_PERMISSION){_%>,userRoleDb,routeRoleDb<%_}_%> }) => async (params, platform) => { 6 | let username = params.username; 7 | let password = params.password; 8 | 9 | if(!username || !password){ 10 | return response.badRequest() 11 | } 12 | 13 | const loginUser = makeLoginUser({<%-USER_MODEL-%>Db,userTokensDb<%_if(ROLE_PERMISSION){_%>,userRoleDb,routeRoleDb<%_}_%>}); 14 | return await loginUser(username, platform, password); 15 | } 16 | module.exports = authentication; -------------------------------------------------------------------------------- /packages/server/usecase/util/validation/actionValidation.js: -------------------------------------------------------------------------------- 1 | const Joi = require('joi'); 2 | const { 3 | validateSchema, validationCustomMessage, 4 | } = require('../validation'); 5 | 6 | const actionValidationValidation = (params) => { 7 | const schema = Joi.object({ 8 | applicationId: Joi.string() 9 | .trim() 10 | .required() 11 | .messages(validationCustomMessage('Application Id')), 12 | screenId: Joi.string() 13 | .trim() 14 | .required() 15 | .messages(validationCustomMessage('screen Id')), 16 | customJson: Joi.object() 17 | .required() 18 | .messages(validationCustomMessage('custom Json')), 19 | }).unknown(true); 20 | 21 | return validateSchema(schema, params); 22 | }; 23 | 24 | module.exports = { actionValidationValidation }; 25 | -------------------------------------------------------------------------------- /packages/server/usecase/queryBuilder/insertMany.js: -------------------------------------------------------------------------------- 1 | /* global _ */ 2 | const { 3 | INVALID_REQUEST_PARAMS, OK, SERVER_ERROR, 4 | } = require('../../constants/message').message; 5 | 6 | /** 7 | * Function used for create new user. 8 | * @return json 9 | */ 10 | const useCase = (queryBuilderRepo) => async (params) => { 11 | try { 12 | params = _.cloneDeep(_.map(params, (val) => val)); 13 | const created = await queryBuilderRepo.insertMany(params); 14 | 15 | if (!created) { 16 | return INVALID_REQUEST_PARAMS; 17 | } 18 | return { 19 | ...OK, 20 | data: created, 21 | }; 22 | } catch (err) { 23 | // eslint-disable-next-line no-console 24 | // console.log('error', err); 25 | return SERVER_ERROR; 26 | } 27 | }; 28 | 29 | module.exports = useCase; 30 | -------------------------------------------------------------------------------- /packages/client/src/components/Heading/headingCss.js: -------------------------------------------------------------------------------- 1 | export const HeadingCss = { 2 | pageTitle: 'block text-primary-text font-title', 3 | titleh1: 'xl:text-5xl md:text-4xl sm:text-2xl leading-tight font-semibold', 4 | titleh2: 'md:text-3xl sm:text-xl font-semibold', 5 | titleh2Light: 'md:text-3xl sm:text-xl font-normal', 6 | titleh3: 'text-2xl leading-10 font-medium', 7 | titleh3Light: 'text-2xl leading-10 font-normal', 8 | titleh4: 'text-xl font-semibold leading-8', 9 | titleh4Light: 'text-xl font-normal leading-8', 10 | titleh5: 'text-base font-semibold', 11 | titleh5Light: 'text-base font-normal', 12 | titleh6: 'text-sm font-semibold', 13 | titleh6Light: 'text-sm font-normal', 14 | titlesmall: 'text-base font-semibold', 15 | titlenormal: 'text-3xl leading-10 font-semibold', 16 | }; 17 | -------------------------------------------------------------------------------- /packages/server/models/constants/applicationConfig.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | ORM_TYPE: { 3 | MONGOOSE: 1, 4 | SEQUELIZE: 2, 5 | ELOQUENT: 3, 6 | }, 7 | DATABASE_TYPE: { 8 | MONGODB: 1, 9 | SQL: 2, 10 | MYSQL: 3, 11 | POSTGRE_SQL: 4, 12 | }, 13 | FILE_TYPES: { 14 | FILE: 1, 15 | DIRECTORY: 2, 16 | }, 17 | APPLICATION_ID_URL: ['/web/v1/application/download-zip'], 18 | GENERATOR_ORM_TYPE: { 19 | 1: 'mongoose', 20 | 2: 'sequelize', 21 | }, 22 | GENERATOR_DATABASE_TYPE: { 23 | 1: 'mongodb', 24 | 2: 'mssql', 25 | 3: 'mysql', 26 | 4: 'postgres', 27 | }, 28 | FIRE_STORE_SCHEMA_TYPE: { 29 | COLLECTION: 1, 30 | RULES: 2, 31 | }, 32 | SCREEN_WISE_DATA_TYPE: { 33 | SCREEN_NAME_CHANGE: 1, 34 | SPLASH_SCREEN: 2, 35 | }, 36 | }; 37 | -------------------------------------------------------------------------------- /packages/server/usecase/application/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deleteUseCase = require('./deleteDependency'); 3 | const { 4 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 5 | } = require('../../constants/message').message; 6 | 7 | const deleteById = (applicationRepo) => async (params) => { 8 | try { 9 | if (!params.id) return INVALID_REQUEST_PARAMS; 10 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 11 | if (!isValidId) { 12 | return INVALID_REQUEST_PARAMS; 13 | } 14 | const response = await (deleteUseCase(applicationRepo))({ find: { _id: params.id } }, params.isHardDelete); 15 | return response; 16 | } catch (err) { 17 | // console.log('error', err); 18 | return SERVER_ERROR; 19 | } 20 | }; 21 | 22 | module.exports = deleteById; 23 | -------------------------------------------------------------------------------- /packages/server/usecase/project/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deleteProjectUseCase = require('./deleteDependency'); 3 | const { 4 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 5 | } = require('../../constants/message').message; 6 | 7 | const deleteById = (projectRepo) => async (params) => { 8 | try { 9 | if (!params.id) return INVALID_REQUEST_PARAMS; 10 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 11 | if (!isValidId) { 12 | return INVALID_REQUEST_PARAMS; 13 | } 14 | const response = await (deleteProjectUseCase(projectRepo))({ find: { _id: params.id } }, params.isHardDelete); 15 | return response; 16 | } catch (err) { 17 | // console.log('error', err); 18 | return SERVER_ERROR; 19 | } 20 | }; 21 | 22 | module.exports = deleteById; 23 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/createBulk.js.ejs: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | *createBulk.js 4 | */ 5 | 6 | const <%-MODEL_NAME-%>Entity = require('../../entities/<%-MODEL_NAME-%>'); 7 | const response = require('../../utils/response'); 8 | <%_if(typeof DEFAULT_USER_ROLE !== "undefined" && DEFAULT_USER_ROLE){ _%> 9 | const authConstant = require('../../constants/authConstant'); 10 | <%_}_%> 11 | 12 | const createBulk = ({ <%-MODEL_NAME-%>Db,createValidation }) => async (dataToCreate) => { 13 | let <%-MODEL_NAME.toLowerCase()-%>Entities = dataToCreate.map(item => <%-MODEL_NAME-%>Entity(item)) 14 | let results = await <%-MODEL_NAME-%>Db.createMany(<%-MODEL_NAME.toLowerCase()-%>Entities); 15 | return response.success({data:results}); 16 | } 17 | module.exports = createBulk; -------------------------------------------------------------------------------- /packages/server/config/db.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const { MongoMemoryServer } = require('mongodb-memory-server'); 3 | const path = require('path'); 4 | 5 | (async () => { 6 | const mongoServer = await MongoMemoryServer.create({ 7 | instance: { 8 | dbName: 'nodejs-code-generator', 9 | dbPath: path.join(__dirname, 'database'), 10 | storageEngine: 'wiredTiger', 11 | }, 12 | }); 13 | mongoose.connect(mongoServer.getUri(), { 14 | useNewUrlParser: true, 15 | useUnifiedTopology: true, 16 | }); 17 | const db = mongoose.connection; 18 | 19 | db.once('open', () => { 20 | // console.log('Connection Successful'); 21 | }); 22 | 23 | db.on('error', () => { 24 | // console.log('Error in mongodb connection'); 25 | }); 26 | })(); 27 | module.exports = mongoose; 28 | -------------------------------------------------------------------------------- /packages/server/usecase/nestedQueryBuilder/insertMany.js: -------------------------------------------------------------------------------- 1 | /* global _ */ 2 | const { 3 | INVALID_REQUEST_PARAMS, OK, SERVER_ERROR, 4 | } = require('../../constants/message').message; 5 | 6 | /** 7 | * Function used for create new user. 8 | * @return json 9 | */ 10 | const useCase = (nestedQueryBuilderRepo) => async (params) => { 11 | try { 12 | params = _.cloneDeep(_.map(params, (val) => val)); 13 | const created = await nestedQueryBuilderRepo.insertMany(params); 14 | 15 | if (!created) { 16 | return INVALID_REQUEST_PARAMS; 17 | } 18 | return { 19 | ...OK, 20 | data: created, 21 | }; 22 | } catch (err) { 23 | // eslint-disable-next-line no-console 24 | // console.log('error', err); 25 | return SERVER_ERROR; 26 | } 27 | }; 28 | 29 | module.exports = useCase; 30 | -------------------------------------------------------------------------------- /packages/client/src/container/hooks/useToastNotifications.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import { useToasts } from 'react-toast-notifications'; 3 | 4 | export default function useToastNotifications() { 5 | const { addToast, removeAllToasts } = useToasts(); 6 | 7 | const addSuccessToast = React.useCallback((message) => { 8 | if (typeof message === 'string') { 9 | removeAllToasts(); 10 | addToast(message, { appearance: 'success', autoDismiss: true }); 11 | } 12 | }, []); 13 | 14 | const addErrorToast = React.useCallback((message) => { 15 | if (typeof message === 'string' && message !== 'Invalid token.') { 16 | removeAllToasts(); 17 | addToast(message, { appearance: 'error', autoDismiss: true }); 18 | } 19 | }, []); 20 | 21 | return { addSuccessToast, addErrorToast }; 22 | } 23 | -------------------------------------------------------------------------------- /packages/server/controllers/web/schemaDetail/schemaDetail.js: -------------------------------------------------------------------------------- 1 | const create = ({ createUseCase }) => async (req, res) => { 2 | const response = await createUseCase(req.body); 3 | return res.setResponse(response); 4 | }; 5 | const paginate = ({ paginateUseCase }) => async (req, res) => { 6 | const response = await paginateUseCase(req.body); 7 | return res.setResponse(response); 8 | }; 9 | const update = ({ updateUseCase }) => async (req, res) => { 10 | const response = await updateUseCase(req.params.id, req.body); 11 | return res.setResponse(response); 12 | }; 13 | 14 | const upsert = ({ upsertUseCase }) => async (req, res) => { 15 | const response = await upsertUseCase(req.body); 16 | return res.setResponse(response); 17 | }; 18 | 19 | module.exports = { 20 | create, 21 | paginate, 22 | update, 23 | upsert, 24 | }; 25 | -------------------------------------------------------------------------------- /packages/server/routes/web/schema/schema.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | 3 | const router = express.Router(); 4 | 5 | const { 6 | create, paginate, update, destroy, insertMany, schemaExists, sqlSchemaExists, getSchema, 7 | insertDefaultModels, searchSchema, 8 | } = require('../../../controllers/web/schema'); 9 | 10 | router.post('/create', create); 11 | router.post('/upload-models', insertMany); 12 | router.post('/paginate', paginate); 13 | router.post('/destroy', destroy); 14 | router.put('/:id', update); 15 | router.post('/update-exists-schema', schemaExists); 16 | router.post('/sql-schema-exists', sqlSchemaExists); 17 | router.get('/get/:id', getSchema); 18 | router.post('/insert-default-models', insertDefaultModels); 19 | router.post('/search', searchSchema); 20 | router.post('/import-sql'); 21 | module.exports = router; 22 | -------------------------------------------------------------------------------- /packages/server/usecase/queryBuilder/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deleteDependencyUseCase = require('./deleteDependency'); 3 | 4 | const { 5 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 6 | } = require('../../constants/message').message; 7 | 8 | const deleteById = (queryBuilderRepo, applicationRepo) => async (params) => { 9 | try { 10 | if (!params.id) return INVALID_REQUEST_PARAMS; 11 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 12 | if (!isValidId) { 13 | return INVALID_REQUEST_PARAMS; 14 | } 15 | const response = await (deleteDependencyUseCase(queryBuilderRepo, applicationRepo))({ find: { _id: params.id } }, params.isHardDelete); 16 | return response; 17 | } catch (err) { 18 | return SERVER_ERROR; 19 | } 20 | }; 21 | 22 | module.exports = deleteById; 23 | -------------------------------------------------------------------------------- /packages/server/usecase/schema/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deleteSchemaUseCase = require('./deleteDependency'); 3 | 4 | const { 5 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 6 | } = require('../../constants/message').message; 7 | 8 | const deleteById = (schemaRepo, applicationRepo) => async (params) => { 9 | try { 10 | if (!params.id) return INVALID_REQUEST_PARAMS; 11 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 12 | if (!isValidId) { 13 | return INVALID_REQUEST_PARAMS; 14 | } 15 | const response = await (deleteSchemaUseCase(schemaRepo, applicationRepo))(params); 16 | return response; 17 | } catch (err) { 18 | return { ...SERVER_ERROR }; 19 | // return { ...SERVER_ERROR, data: err.toString() }; 20 | } 21 | }; 22 | 23 | module.exports = deleteById; 24 | -------------------------------------------------------------------------------- /packages/client/src/container/Configuration/CodeGenerateConfiguration/CodeGenerateConfiguration.loader.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ContentLoader from 'react-content-loader'; 3 | 4 | const MyLoader = ({ rows }) => ( 5 | <> 6 | {Array(rows || 1) 7 | .fill('') 8 | .map((d) => ( 9 | 18 | 19 | 20 | 21 | ))} 22 | 23 | ); 24 | 25 | export default MyLoader; 26 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/use-case/partialUpdate.js.ejs: -------------------------------------------------------------------------------- 1 | const <%-MODEL_NAME-%>Entity = require('../../entities/<%-MODEL_NAME-%>'); 2 | const response = require('../../utils/response'); 3 | 4 | /** 5 | * @description : partially update record of <%-MODEL_NAME_FC%> with data by id; 6 | * @param {Object} params : request body. 7 | * @return {obj} : updated <%-MODEL_NAME_FC%>. {status, message, data} 8 | */ 9 | const partialUpdate = ({ <%-MODEL_NAME-%>Db }) => async (params) => { 10 | const <%-MODEL_NAME.toLowerCase()-%> = await <%-MODEL_NAME-%>Db.updateOne(params.query,params.partialUpdate); 11 | if(!<%-MODEL_NAME.toLowerCase()-%>){ 12 | return response.recordNotFound(); 13 | } 14 | return response.success({data:<%-MODEL_NAME.toLowerCase()-%>}); 15 | } 16 | module.exports = partialUpdate; -------------------------------------------------------------------------------- /packages/server/usecase/projectRoute/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deleteRouteUseCase = require('./deleteDependency'); 3 | 4 | const { 5 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 6 | } = require('../../constants/message').message; 7 | 8 | const deleteById = (projectRouteRepo, applicationRepo) => async (params) => { 9 | try { 10 | if (!params.id) return INVALID_REQUEST_PARAMS; 11 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 12 | if (!isValidId) { 13 | return INVALID_REQUEST_PARAMS; 14 | } 15 | const response = await (deleteRouteUseCase(projectRouteRepo, applicationRepo))({ find: { _id: params.id } }, params.isHardDelete, params.definitionType); 16 | return response; 17 | } catch (err) { 18 | return SERVER_ERROR; 19 | } 20 | }; 21 | 22 | module.exports = deleteById; 23 | -------------------------------------------------------------------------------- /packages/server/controllers/web/projectPolicy/projectPolicy.js: -------------------------------------------------------------------------------- 1 | const create = ({ createUseCase }) => async (req, res) => { 2 | const response = await createUseCase(req.body); 3 | return res.setResponse(response); 4 | }; 5 | 6 | const update = ({ updateUseCase }) => async (req, res) => { 7 | const response = await updateUseCase(req.params.id, req.body); 8 | return res.setResponse(response); 9 | }; 10 | 11 | const destroy = ({ deleteUseCase }) => async (req, res) => { 12 | const response = await deleteUseCase(req.body); 13 | return res.setResponse(response); 14 | }; 15 | 16 | const paginate = ({ paginateUseCase }) => async (req, res) => { 17 | const response = await paginateUseCase(req.body); 18 | return res.setResponse(response); 19 | }; 20 | 21 | module.exports = { 22 | create, 23 | update, 24 | destroy, 25 | paginate, 26 | }; 27 | -------------------------------------------------------------------------------- /packages/server/usecase/nestedQueryBuilder/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deleteDependencyUseCase = require('./deleteDependency'); 3 | 4 | const { 5 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 6 | } = require('../../constants/message').message; 7 | 8 | const deleteById = (nestedQueryBuilderRepo, applicationRepo) => async (params) => { 9 | try { 10 | if (!params.id) return INVALID_REQUEST_PARAMS; 11 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 12 | if (!isValidId) { 13 | return INVALID_REQUEST_PARAMS; 14 | } 15 | const response = await (deleteDependencyUseCase(nestedQueryBuilderRepo, applicationRepo))({ find: { _id: params.id } }, params.isHardDelete); 16 | return response; 17 | } catch (err) { 18 | return SERVER_ERROR; 19 | } 20 | }; 21 | 22 | module.exports = deleteById; 23 | -------------------------------------------------------------------------------- /packages/server/controllers/web/projectConstant/projectConstant.js: -------------------------------------------------------------------------------- 1 | const create = ({ createUseCase }) => async (req, res) => { 2 | const response = await createUseCase(req.body); 3 | return res.setResponse(response); 4 | }; 5 | 6 | const update = ({ updateUseCase }) => async (req, res) => { 7 | const response = await updateUseCase(req.params.id, req.body); 8 | return res.setResponse(response); 9 | }; 10 | 11 | const destroy = ({ deleteUseCase }) => async (req, res) => { 12 | const response = await deleteUseCase(req.body); 13 | return res.setResponse(response); 14 | }; 15 | 16 | const paginate = ({ paginateUseCase }) => async (req, res) => { 17 | const response = await paginateUseCase(req.body); 18 | return res.setResponse(response); 19 | }; 20 | 21 | module.exports = { 22 | create, 23 | update, 24 | destroy, 25 | paginate, 26 | }; 27 | -------------------------------------------------------------------------------- /packages/client/src/api/models.js: -------------------------------------------------------------------------------- 1 | import { apiClient } from '.'; 2 | import { API_URLS } from './constants'; 3 | 4 | export const getModelPermissions = (payload) => apiClient(API_URLS.schemaDetail.paginate, payload); 5 | export const upsertModelPermissions = (payload) => apiClient(API_URLS.schemaDetail.upsert, payload); 6 | export const deleteModel = (payload) => apiClient(API_URLS.schema.delete, payload); 7 | export const createModel = (payload) => apiClient(API_URLS.schema.create, payload); 8 | export const updateModelApi = (payload, id) => apiClient(`${API_URLS.schema.update}/${id}`, payload, 'PUT'); 9 | 10 | // Library Model 11 | export const createMultipleModels = (payload) => apiClient(`${API_URLS.schema.multipleCreate}`, payload); 12 | 13 | // get specific Model Detail 14 | export const getModel = (id) => apiClient(`${API_URLS.schema.get}/${id}`, null, 'GET'); 15 | -------------------------------------------------------------------------------- /packages/client/src/components/LinkTag/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Link } from 'react-router-dom'; 3 | import PropTypes from 'prop-types'; 4 | 5 | export const LinkTag = ({ 6 | onClick, link, className, children, whiteText, 7 | }) => ( 8 | link 9 | ? {children} 10 | : {children} 11 | ); 12 | LinkTag.propTypes = { 13 | /** 14 | * Additional class name 15 | */ 16 | className: PropTypes.string, 17 | link: PropTypes.string, 18 | onClick: PropTypes.func, 19 | }; 20 | 21 | LinkTag.defaultProps = { 22 | className: '', 23 | }; 24 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/routes/index.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | <%_ if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 4 | const rateLimit=require('express-rate-limit'); 5 | <%_ } _%> 6 | <%_if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 7 | const rateLimiter=rateLimit({ 8 | windowMs:<%-REACTIVE_TIME%> *60 *1000, 9 | max:<%-LOGIN_RATE%>, 10 | message: "Rate limit exceeded, please try again after <%=REACTIVE_TIME%> minutes" 11 | }); 12 | <%_}_%> 13 | 14 | <%_for(let module in PLATFORM){_%> 15 | <%_if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 16 | router.use(rateLimiter,require("./<%-module%>/index")); 17 | <%_} else {_%> 18 | router.use(require("./<%-module%>/index")); 19 | <%_}_%> 20 | <%_}_%> 21 | 22 | module.exports =router 23 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/validation/validateSchema.js.ejs: -------------------------------------------------------------------------------- 1 | const joi = require("joi") 2 | <%_if(ENUM_VALIDATION){_%> 3 | <%_for(let enumIndex of ENUM_VALIDATION){_%> 4 | const <%-enumIndex%>Default=require('../constants/<%-enumIndex%>'); 5 | <%_}_%> 6 | <%_}_%> 7 | 8 | <%_ if(typeof VARIABLES !== "undefined") { 9 | for(let i=0;i< VARIABLES.length; i++) {_%> 10 | <%-VARIABLES[i]%> 11 | <%_ } } _%> 12 | <%_if(typeof IS_AUTH!=="undefined" && IS_AUTH){_%> 13 | const {USER_ROLE} = require("../../constants/authConstant"); 14 | const {convertObjectToEnum} = require("../../utils/common") 15 | <%_}_%> 16 | const createSchema = joi.object(<%-VALIDATION_KEY%>).unknown(true); 17 | 18 | const updateSchema = joi.object(<%-UPDATE_VALIDATION_KEY%>).unknown(true); 19 | 20 | module.exports = {createSchema, updateSchema}; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/utils/validateRequest.js: -------------------------------------------------------------------------------- 1 | /** 2 | * validateRequest.js 3 | * @description :: exports methods for validating parameters of request body using joi validation. 4 | */ 5 | 6 | /** 7 | * @description : validate request body parameter with joi. 8 | * @param {object} payload : body from request. 9 | * @param {object} schemaKeys : model wise schema keys. ex. user validation. 10 | * @returns : returns validation with message {isValid, message} 11 | */ 12 | exports.validateParamsWithJoi = (payload, schemaKeys) => { 13 | const { error } = schemaKeys.validate(payload, { abortEarly: false }); 14 | if (error) { 15 | const message = error.details.map((el) => el.message).join('\n'); 16 | return { 17 | isValid: false, 18 | message, 19 | }; 20 | } 21 | return { isValid: true }; 22 | }; 23 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/config/db.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * db.js 3 | * @description :: exports values used to make connection with SQL database 4 | */ 5 | 6 | if(process.env.NODE_ENV !== 'test'){ 7 | module.exports = { 8 | HOST: process.env.HOST, 9 | USER: process.env.DATABASE_USERNAME, 10 | PASSWORD: process.env.DATABASE_PASSWORD, 11 | DB: process.env.DATABASE_NAME, 12 | dialect: <%=ADAPTER%>, 13 | port: process.env.DB_PORT, 14 | } 15 | }else{ 16 | module.exports = { 17 | HOST: process.env.TEST_HOST, 18 | USER: process.env.TEST_DATABASE_USERNAME, 19 | PASSWORD: process.env.TEST_DATABASE_PASSWORD, 20 | DB: process.env.TEST_DATABASE_NAME, 21 | dialect: <%=ADAPTER%>, 22 | port: process.env.TEST_DB_PORT, 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/routes/platformIndexRoutes.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * index.js 3 | * @description :: index route file of <%-PLATFORM_NAME.toLowerCase()%> platform. 4 | */ 5 | 6 | const express = require("express") 7 | const router = express.Router() 8 | <%_ if(IS_AUTH){ _%> 9 | router.use("/<%-PLATFORM_NAME.toLowerCase()%>/auth",require("./auth")); 10 | <%_}_%> 11 | <%_ for(let i in PLATFORM){ _%> 12 | router.use(require("./<%-i%>Routes")); 13 | <%_}_%> 14 | <%_if(typeof ROUTES!=="undefined"){_%> 15 | <%_ ROUTES.forEach((v,i)=>{ _%> 16 | router.use("/",require("./<%-v.controller%>Routes")); 17 | <%_})_%> 18 | <%_}_%> 19 | <%_if(typeof(CUSTOM_ROUTES) !== 'undefined'){_%> 20 | <%_ CUSTOM_ROUTES.forEach((v,i)=>{ _%> 21 | router.use("/",require("./<%-v.controller%>Routes")); 22 | <%_})_%> 23 | <%_}_%> 24 | 25 | module.exports = router; 26 | -------------------------------------------------------------------------------- /packages/client/src/assets/css/logo.css: -------------------------------------------------------------------------------- 1 | .themeLogo .c, 2 | .themeLogo .st2 { 3 | fill: var(--color--black-svg); 4 | } 5 | 6 | .themeLogo .a, 7 | .themeLogo .st0 { 8 | fill: var(--color--secondry-svg); 9 | } 10 | 11 | .themeLogo .b, 12 | .themeLogo .st1 { 13 | fill: var(--color--theme-svg); 14 | } 15 | 16 | .themeSmallLogo .cls-1, 17 | .themeSmallLogo .cls-4 { 18 | fill: none; 19 | } 20 | 21 | .themeSmallLogo .cls-2 { 22 | clip-path: url(#clip-path); 23 | } 24 | 25 | .themeSmallLogo .cls-3 { 26 | opacity: 0.5; 27 | } 28 | 29 | .themeSmallLogo .cls-4 { 30 | stroke: #e0e0e0; 31 | stroke-miterlimit: 10; 32 | } 33 | 34 | .themeSmallLogo .cls-5 { 35 | fill: var(--color--secondry-svg); 36 | } 37 | 38 | .themeSmallLogo .cls-6 { 39 | fill: var(--color--theme-svg); 40 | } 41 | 42 | .themeWhiteLogo .cls-1 { 43 | fill: var(--color--black-svg); 44 | } -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/routes/index.js.ejs: -------------------------------------------------------------------------------- 1 | const express = require("express") 2 | const router = express.Router() 3 | <%_ if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 4 | const rateLimit=require('express-rate-limit'); 5 | <%_ } _%> 6 | <%_if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 7 | const rateLimiter=rateLimit({ 8 | windowMs:<%-REACTIVE_TIME%>*60*1000, 9 | max:<%-LOGIN_RATE%>, 10 | message: "Too many API calls from this IP, please try again after a <%-REACTIVE_TIME%> minutes" 11 | }); 12 | <%_}_%> 13 | 14 | <%_for(let module in PLATFORM){_%> 15 | <%_if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 16 | router.use(rateLimiter,require("./<%-module%>/index")); 17 | <%_} else {_%> 18 | router.use(require("./<%-module%>/index")); 19 | <%_}_%> 20 | <%_}_%> 21 | 22 | 23 | module.exports =router 24 | -------------------------------------------------------------------------------- /packages/client/src/container/CRUD/Permission/Header.js: -------------------------------------------------------------------------------- 1 | import { isEmpty } from 'lodash'; 2 | import React from 'react'; 3 | import { 4 | Button, 5 | Heading, 6 | } from '../../../components'; 7 | 8 | const Header = (props) => { 9 | const { onCancel, permissions } = props; 10 | return ( 11 |
12 |
13 | Model permission 14 |
15 | { !isEmpty(permissions) && ( 16 |
17 | 25 | 26 |
27 | )} 28 |
29 | ); 30 | }; 31 | export default React.memo(Header); 32 | -------------------------------------------------------------------------------- /packages/client/src/assets/css/tableViewCss.js: -------------------------------------------------------------------------------- 1 | export const TableViewCss = { 2 | // grid grid-cols-10 3 | // grid grid-cols-10 gap-4 4 | tableHead: 'pl-10 text-sm items-center py-1.5 px-0 sticky top-0 z-10 bg-gray-200 px-3', 5 | tableRow: 'pl-10', 6 | tableSequence: 'absolute w-3 h-3 left-3 opacity-70 cursor-move top-2.5 m-auto', 7 | tableCollapse: 'absolute w-3 h-3 z-1 left-14 cursor-pointer top-2.5 m-auto', 8 | tableClose: 'w-3.5 h-3.5 flex items-center cursor-pointer absolute left-8 top-2.5 m-auto z-1', 9 | addValue: 'text-xs ml-1 text-gray-white flex underline items-center cursor-pointer labelGroup focus:outline-none focus:text-primary-dark', 10 | tableCheckBox: 'flex', 11 | subTable: 'subAtt mx-5 px-2 mt-4 bg-gray-200 p-2', 12 | subTableRow: 'pl-5 group relative', 13 | subTableClose: 'w-4 h-4 cursor-pointer absolute left-5 top-3.5 m-auto z-10', 14 | subTableCheckBox: 'flex', 15 | }; 16 | -------------------------------------------------------------------------------- /packages/client/src/components/SearchBox/RecentSearch.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Icons } from '@dhiwise/icons'; 3 | import { DropdownMenu, MenuItem } from '../DropdownMenu'; 4 | 5 | const SearchBoxCss = { 6 | recentcss: 'w-4 h-4 cursor-pointer', 7 | recentimg: 'w-full h-full', 8 | }; 9 | export const RecentSearch = () => ( 10 | ( 14 |
15 | 16 |
17 | )} 18 | className={SearchBoxCss.recentcss} 19 | triggerType="component" 20 | trigger="recenet" 21 | title="Recent Search" 22 | > 23 | 24 | 25 | 26 |
27 | ); 28 | -------------------------------------------------------------------------------- /packages/server/usecase/schemaDetail/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const { 3 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 4 | } = require('../../constants/message').message; 5 | 6 | const deleteSchemaDetailUseCase = require('./deleteDependency'); 7 | 8 | const deleteById = (schemaDetailRepo) => async (params) => { 9 | try { 10 | if (!params.id) return INVALID_REQUEST_PARAMS; 11 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 12 | if (!isValidId) { 13 | return INVALID_REQUEST_PARAMS; 14 | } 15 | const response = await (deleteSchemaDetailUseCase(schemaDetailRepo))({ find: { _id: params.id } }, params.isHardDelete); 16 | return response; 17 | } catch (err) { 18 | // console.log('error', err); 19 | return { ...SERVER_ERROR }; 20 | // return { ...SERVER_ERROR, data: err.toString() }; 21 | } 22 | }; 23 | 24 | module.exports = deleteById; 25 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/use-case/authentication/authentication.js.ejs: -------------------------------------------------------------------------------- 1 | 2 | const response = require('../../utils/response'); 3 | const makeLoginUser = require('../common/loginUser'); 4 | 5 | /** 6 | * @description : login with username and password 7 | * @param {Object} params : request body. 8 | * @param {Number} platform : platform identification. 9 | * @return {Object} : response of authentication {status, message, data} 10 | */ 11 | const authentication = ({ <%-USER_MODEL-%>Db,userTokensDb}) => async (params, platform) => { 12 | let username = params.username; 13 | let password = params.password; 14 | if(!username || !password){ 15 | return response.badRequest() 16 | } 17 | const loginUser = makeLoginUser({<%-USER_MODEL-%>Db,userTokensDb}); 18 | return await loginUser(username, platform, password); 19 | } 20 | module.exports = authentication; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvc/views/resetPassword.ejs: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 12 | 13 | 14 |
6 |
7 |
8 | <%-message%> 9 |
10 |
11 |
15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/views/resetPassword.ejs: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 12 | 13 | 14 |
6 |
7 |
8 | <%-message%> 9 |
10 |
11 |
15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/use-case/authentication/validateResetPasswordOtp.js.ejs: -------------------------------------------------------------------------------- 1 | const dayjs = require("dayjs"); 2 | const response = require('../../utils/response'); 3 | 4 | const validateResetPasswordOtp = ({ <%-USER_MODEL-%>Db,userAuthSettingsDb }) => async (params) => { 5 | if (!params || !params.otp) { 6 | return response.badRequest() 7 | } 8 | let user = await userAuthSettingsDb.findOne({ resetPasswordCode: params.otp }); 9 | if (!user || !user.resetPasswordLink.expireTime) { 10 | return response.badRequest({message : "Invalid OTP"}); 11 | } 12 | if (dayjs(new Date()).isAfter(dayjs(user.resetPasswordLink.expireTime))) { 13 | return response.badRequest({message:"Your reset password link is expired."}); 14 | } 15 | return response.success({message :'OTP Validated'}); 16 | } 17 | module.exports = validateResetPasswordOtp; -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/views/resetPassword.ejs: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 12 | 13 | 14 |
6 |
7 |
8 | <%-message%> 9 |
10 |
11 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /packages/server/usecase/applicationConfig/deleteDependency.js: -------------------------------------------------------------------------------- 1 | const { 2 | INVALID_REQUEST_PARAMS, SERVER_ERROR, OK, 3 | } = require('../../constants/message').message; 4 | 5 | const deleteMany = (applicationConfigRepo) => async (filter, isHardDelete = false) => { 6 | try { 7 | if (!filter) return INVALID_REQUEST_PARAMS; 8 | const response = await applicationConfigRepo.getDetails(filter); 9 | if (response && response.length) { 10 | if (isHardDelete) { 11 | await applicationConfigRepo.deleteMany(filter); 12 | } else { 13 | const updateData = { 14 | filter, 15 | data: { isDeleted: true }, 16 | }; 17 | await applicationConfigRepo.updateMany(updateData); 18 | } 19 | } 20 | return { 21 | ...OK, 22 | data: response, 23 | }; 24 | } catch (err) { 25 | return SERVER_ERROR; 26 | } 27 | }; 28 | 29 | module.exports = deleteMany; 30 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCodeSequelize/views/resetPassword.ejs: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 12 | 13 | 14 |
6 |
7 |
8 | <%-message%> 9 |
10 |
11 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐞 Bug 3 | about: File a bug/issue 4 | title: '[BUG] ' 5 | labels: Bug, Needs Triage 6 | assignees: '' 7 | 8 | --- 9 | 10 | <!-- 11 | Note: Please search to see if an issue already exists for the bug you encountered. 12 | --> 13 | 14 | ### Current Behavior: 15 | <!-- A concise description of what you're experiencing. --> 16 | 17 | ### Expected Behavior: 18 | <!-- A concise description of what you expected to happen. --> 19 | 20 | ### Steps To Reproduce: 21 | <!-- 22 | Example: steps to reproduce the behavior: 23 | 1. In this environment... 24 | 2. With this config... 25 | 3. Run '...' 26 | 4. See error... 27 | --> 28 | 29 | ### Environment: 30 | <!-- 31 | Example: 32 | - OS: Ubuntu 20.04 33 | - Node: 13.14.0 34 | - npm: 7.6.3 35 | --> 36 | 37 | ### Anything else: 38 | <!-- 39 | Links? References? Anything that will give us more context about the issue that you are encountering! 40 | --> 41 | -------------------------------------------------------------------------------- /packages/client/src/components/CardView/cardCss.js: -------------------------------------------------------------------------------- 1 | export const CardCss = { 2 | cardBox: 'groupbox card-box border-2 border-gray-200 col-span-1 p-5 rounded-3 cursor-pointer', 3 | cardhover: 'hover:bg-gray-200', 4 | cardImgBlock: 'mb-6 relative', 5 | cardCodeView: 'mb-4 h-48 overflow-hidden relative text-left bg-gray-100 p-4 border-gray-200', 6 | cardImg: 'object-contain m-auto flex items-center justify-center', 7 | cardImgBig: 'w-20 h-20', 8 | cardImgSmall: 'w-12 h-12', 9 | cardTitle: 'text-primary-text leading-1xl text-xl font-semibold', 10 | cardDesc: 'text-body-text text-sm leading-snug mt-1 break-words descriptionDoted', 11 | CardPerview: 'perviewHover opacity-0 absolute bg-gray-black top-0 left-0 w-full h-full flex items-center justify-center', 12 | 13 | thumbxs: 'h-20', 14 | thumbsm: 'h-28', 15 | thumbxl: 'h-72', 16 | thumbmd: 'h-32 xxl:h-40 ', 17 | thumbTextsm: 'text-sm', 18 | thumbTextmd: 'text-base', 19 | }; 20 | -------------------------------------------------------------------------------- /packages/client/src/container/Shared/Layout/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { Helmet } from 'react-helmet'; 3 | import Sidebar from './Sidebar'; 4 | import { LanguageHeader } from './LanguageHeader'; 5 | 6 | const Layout = ({ 7 | isSidebar, children, hideHeader, bodyClass, wrapClass, ...props 8 | }) => ( 9 | <div className={`flex flex-col h-screen ${wrapClass}`}> 10 | <Helmet> 11 | <title>DhiWise 12 | 13 | 14 | <> 15 | 16 | {!hideHeader && } 17 | 18 | 19 |
20 | {isSidebar 21 | // eslint-disable-next-line react/jsx-props-no-spreading 22 | && } 23 | {children} 24 |
25 | 26 | ); 27 | export default Layout; 28 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/mvcSequelize/routes/index.js.ejs: -------------------------------------------------------------------------------- 1 | /** 2 | * index.js 3 | * @description :: index route of platforms 4 | */ 5 | const express = require("express") 6 | const router = express.Router() 7 | <%_ if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 8 | const rateLimit=require('express-rate-limit'); 9 | <%_ } _%> 10 | <%_if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 11 | const rateLimiter=rateLimit({ 12 | windowMs:<%-REACTIVE_TIME%> * 60 * 1000, 13 | max:<%-LOGIN_RATE%>, 14 | message: "Too many API calls from this IP, please try again after a <%-REACTIVE_TIME%> minutes" 15 | }); 16 | <%_}_%> 17 | <%_for(let module in PLATFORM){_%> 18 | <%_if(typeof LOGIN_RATE !== "undefined" && LOGIN_RATE){_%> 19 | router.use(rateLimiter,require("./<%-module%>/index")); 20 | <%_} else {_%> 21 | router.use(require("./<%-module%>/index")); 22 | <%_}_%> 23 | <%_}_%> 24 | 25 | module.exports =router -------------------------------------------------------------------------------- /packages/server/usecase/projectPolicy/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deletePolicyUseCase = require('./deleteDependency'); 3 | const { 4 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 5 | } = require('../../constants/message').message; 6 | 7 | const deleteById = (projectPolicyRepo, applicationRepo) => async (params) => { 8 | try { 9 | if (!params.id) return INVALID_REQUEST_PARAMS; 10 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 11 | if (!isValidId) { 12 | return INVALID_REQUEST_PARAMS; 13 | } 14 | const response = await (deletePolicyUseCase(projectPolicyRepo, applicationRepo))({ 15 | find: { 16 | _id: params.id, 17 | isActive: { $in: [true, false] }, 18 | }, 19 | }, params.isHardDelete); 20 | return response; 21 | } catch (err) { 22 | // console.log('error', err); 23 | return SERVER_ERROR; 24 | } 25 | }; 26 | 27 | module.exports = deleteById; 28 | -------------------------------------------------------------------------------- /packages/client/src/assets/css/dropdown.css: -------------------------------------------------------------------------------- 1 | 2 | .dropdown-menu:hover { 3 | background-color: #0061ff; 4 | color: #fff; 5 | } 6 | 7 | .dropdown-menu:hover svg { 8 | fill: #fff; 9 | } 10 | .dropdown-min{ 11 | min-width: min-content !important; 12 | } 13 | .border-primary-light { 14 | border-color: #e9f1ff; 15 | } 16 | 17 | .primary-gray-text-color { 18 | color: var(--color-text-primary); 19 | } 20 | 21 | .show { 22 | display: block !important; 23 | } 24 | 25 | .position-div.right { 26 | right: 0 !important; 27 | left: auto !important; 28 | } 29 | 30 | .position-div.left { 31 | left: 0 !important; 32 | right: auto !important; 33 | } 34 | 35 | .position-div { 36 | background: var(--color-bg-white) !important; 37 | border: 1px solid var(--color-gray-90); 38 | border-radius: 0 0 5px 5px; 39 | /* box-shadow: none !important; */ 40 | box-shadow: rgba(0, 0, 0, 0.06) 0px 8px 16px 0px !important; 41 | } 42 | -------------------------------------------------------------------------------- /packages/server/usecase/application/actionWiseCount.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const { 3 | OK, SERVER_ERROR, INVALID_REQUEST_PARAMS, 4 | } = require('../../constants/message').message; 5 | 6 | const actionWiseCount = ({ deviceActionRepo }) => async (id) => { 7 | try { 8 | if (!id) return INVALID_REQUEST_PARAMS; 9 | 10 | const data = await deviceActionRepo.aggregate({ 11 | queryStages: [ 12 | { $match: { applicationId: mongoose.Types.ObjectId(id) } }, { 13 | $group: { 14 | _id: { 15 | type: '$customJson.action.type', 16 | screenId: '$screenId', 17 | }, 18 | count: { $sum: 1 }, 19 | }, 20 | }, 21 | ], 22 | }); 23 | return { 24 | ...OK, 25 | data, 26 | }; 27 | } catch (err) { 28 | // console.log('error', err); 29 | return SERVER_ERROR; 30 | } 31 | }; 32 | 33 | module.exports = actionWiseCount; 34 | -------------------------------------------------------------------------------- /packages/server/usecase/application/node-generator/templates/cleanCode/middleware/index.js.ejs: -------------------------------------------------------------------------------- 1 | let <%-USER_MODEL%>Db = require('../data-access/<%-USER_MODEL%>Db'); 2 | let userTokensDb = require('../data-access/userTokensDb'); 3 | let userRoleDb = require('../data-access/userRoleDb'); 4 | let routeRoleDb = require('../data-access/routeRoleDb'); 5 | let projectRouteDb = require('../data-access/projectRouteDb'); 6 | const passport = require('passport'); 7 | 8 | const auth = require('./auth')({ passport, userTokensDb }); 9 | const checkRolePermission = require('./checkRolePermission')({ userRoleDb, routeRoleDb,projectRouteDb}); 10 | 11 | <%_for(let platform of PLATFORMS){_%> 12 | const <%-platform%>PassportStrategy = require('./<%-platform%>PassportStrategy')({ <%-USER_MODEL%>Db }); 13 | <%_}_%> 14 | 15 | module.exports = { 16 | auth, 17 | checkRolePermission, 18 | <%_for(let platform of PLATFORMS){_%> 19 | <%-platform%>PassportStrategy, 20 | <%_}_%> 21 | }; -------------------------------------------------------------------------------- /packages/server/usecase/generator/deleteDependency.js: -------------------------------------------------------------------------------- 1 | const { 2 | INVALID_REQUEST_PARAMS, OK, SERVER_ERROR, 3 | } = require('../../constants/message').message; 4 | // { find: { schemaId: params.id } } 5 | const deleteMany = (generatorRepo) => async (filter, isHardDelete = false) => { 6 | try { 7 | if (!filter) return INVALID_REQUEST_PARAMS; 8 | const response = await generatorRepo.getDetails(filter); 9 | if (response && response.length) { 10 | if (isHardDelete) { 11 | await generatorRepo.deleteMany(filter); 12 | } else { 13 | const updateData = { 14 | filter, 15 | data: { isDeleted: true }, 16 | }; 17 | await generatorRepo.updateMany(updateData); 18 | } 19 | } 20 | return { 21 | ...OK, 22 | data: response, 23 | }; 24 | } catch (err) { 25 | // console.log('error', err); 26 | return SERVER_ERROR; 27 | } 28 | }; 29 | 30 | module.exports = deleteMany; 31 | -------------------------------------------------------------------------------- /packages/server/usecase/projectConstant/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deleteConstantUseCase = require('./deleteDependency'); 3 | const { 4 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 5 | } = require('../../constants/message').message; 6 | 7 | const deleteById = (projectConstantRepo, applicationRepo) => async (params) => { 8 | try { 9 | if (!params.id) return INVALID_REQUEST_PARAMS; 10 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 11 | if (!isValidId) { 12 | return INVALID_REQUEST_PARAMS; 13 | } 14 | const response = await (deleteConstantUseCase(projectConstantRepo, applicationRepo))({ 15 | find: { 16 | _id: params.id, 17 | isActive: { $in: [true, false] }, 18 | }, 19 | }, params.isHardDelete); 20 | return response; 21 | } catch (err) { 22 | // console.log('error', err); 23 | return SERVER_ERROR; 24 | } 25 | }; 26 | 27 | module.exports = deleteById; 28 | -------------------------------------------------------------------------------- /packages/server/usecase/projectRoleAccessPermissions/delete.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | const deletePolicyUseCase = require('./deleteDependency'); 3 | const { 4 | INVALID_REQUEST_PARAMS, SERVER_ERROR, 5 | } = require('../../constants/message').message; 6 | 7 | const deleteById = (projectRoleAccessPermissionsRepo) => async (params) => { 8 | try { 9 | if (!params.id) return INVALID_REQUEST_PARAMS; 10 | const isValidId = mongoose.Types.ObjectId.isValid(params.id); 11 | if (!isValidId) { 12 | return INVALID_REQUEST_PARAMS; 13 | } 14 | const response = await (deletePolicyUseCase(projectRoleAccessPermissionsRepo))({ 15 | find: { 16 | _id: params.id, 17 | isActive: { $in: [true, false] }, 18 | }, 19 | }, params.isHardDelete); 20 | return response; 21 | } catch (err) { 22 | // console.log('error', err); 23 | return SERVER_ERROR; 24 | } 25 | }; 26 | 27 | module.exports = deleteById; 28 | --------------------------------------------------------------------------------