├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── user-story.md ├── PULL_REQUEST_TEMPLATE │ ├── develop.md │ └── master.md ├── checkstyle-configuration.xml ├── home-code-style.xml ├── pull_request_template.md └── workflows │ ├── Build_and_deploy_workflow.yml │ └── Review_workflow.yml ├── .gitignore ├── .run ├── All in home-api-tests.run.xml └── HomeApplicationTest.run.xml ├── LICENSE ├── README.md ├── home-api-tests ├── pom.xml └── src │ ├── main │ └── java │ │ └── .keep │ └── test │ └── java │ └── com │ └── softserveinc │ └── ita │ └── homeproject │ └── api │ └── tests │ ├── apartments │ ├── ApartmentApiIT.java │ └── QueryApartmentIT.java │ ├── contacts │ ├── ContactApiIT.java │ └── QueryContactIT.java │ ├── cooperations │ ├── CooperationApiIT.java │ ├── QueryCooperationIT.java │ └── contacts │ │ ├── CooperationContactApiIT.java │ │ └── QueryCoopContactIT.java │ ├── current_user │ └── CurrentUserApiIT.java │ ├── houses │ ├── HouseApiIT.java │ └── QueryHouseIT.java │ ├── invitations │ ├── InvitationApiIT.java │ └── QueryInvitationIT.java │ ├── news │ ├── NewsApiIT.java │ └── QueryNewsIT.java │ ├── ownerships │ ├── OwnershipApiIT.java │ └── QueryOwnershipIT.java │ ├── poll_questions │ ├── QueryQuestionIT.java │ └── QuestionApiIT.java │ ├── polls │ ├── CooperationPollApiIT.java │ ├── PollVoteApiIT.java │ ├── QueryCooperationPollIT.java │ ├── QueryHousePollIT.java │ ├── QueryPoll.java │ └── QueryPollIT.java │ ├── query │ ├── ApartmentQuery.java │ ├── BaseQuery.java │ ├── ContactQuery.java │ ├── CooperationContactQuery.java │ ├── CooperationPollQuery.java │ ├── CooperationQuery.java │ ├── HousePollQuery.java │ ├── HouseQuery.java │ ├── InvitationQuery.java │ ├── NewsQuery.java │ ├── OwnershipQuery.java │ ├── PollQuery.java │ ├── PollQuestionQuery.java │ └── UserQuery.java │ ├── security │ ├── LoginIT.java │ ├── LogoutIT.java │ └── PermissionsIT.java │ ├── users │ ├── QueryUserIT.java │ ├── ResetPasswordApiIT.java │ └── UserApiIT.java │ └── utils │ ├── ApiClientForLogoutUtil.java │ ├── ApiClientUtil.java │ ├── FilterPredicate.java │ ├── FilterPredicateEnum.java │ ├── QueryFilterUtils.java │ └── mail │ └── mock │ ├── LetterParser.java │ ├── LetterPredicate.java │ ├── MailApi.java │ ├── MailUtil.java │ └── dto │ ├── EmailContent.java │ ├── EmailHeader.java │ ├── EmailMime.java │ ├── EmailMimeInner.java │ ├── EmailParams.java │ ├── EmailPart.java │ ├── EmailPartInner.java │ ├── LogoutContent.java │ ├── MailHogApiResponse.java │ └── ResponseEmailItem.java ├── home-application-heroku-deploy-unix.sh ├── home-application-heroku-deploy-windows.bat ├── home-application ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── softserveinc │ │ │ └── ita │ │ │ └── homeproject │ │ │ ├── HomeApplication.java │ │ │ └── application │ │ │ ├── api │ │ │ ├── ApartmentApiImpl.java │ │ │ ├── CommonApi.java │ │ │ ├── CooperationApiImpl.java │ │ │ ├── FileApiImpl.java │ │ │ ├── HouseApiImpl.java │ │ │ ├── InvitationApiImpl.java │ │ │ ├── LogoutApiImpl.java │ │ │ ├── NewsApiImpl.java │ │ │ ├── PollApiImpl.java │ │ │ ├── ResetPasswordApiImpl.java │ │ │ └── UserApiImpl.java │ │ │ ├── config │ │ │ ├── HomeUserWrapperDetails.java │ │ │ ├── JerseyConfig.java │ │ │ ├── SecurityConfig.java │ │ │ ├── query │ │ │ │ ├── QueryConfig.java │ │ │ │ ├── QueryParamEnum.java │ │ │ │ ├── RSQLConfig.java │ │ │ │ ├── RSQLEndpointConfig.java │ │ │ │ ├── cooperation │ │ │ │ │ ├── CooperationQueryConfig.java │ │ │ │ │ ├── CooperationRSQLEndpointConfig.java │ │ │ │ │ ├── apartment │ │ │ │ │ │ ├── ApartmentQueryConfig.java │ │ │ │ │ │ └── ApartmentRSQLEndpointConfig.java │ │ │ │ │ ├── house │ │ │ │ │ │ ├── HouseQueryConfig.java │ │ │ │ │ │ └── HouseRSQLEndpointConfig.java │ │ │ │ │ └── invitation │ │ │ │ │ │ └── apartment │ │ │ │ │ │ ├── ApartmentInvitationQueryConfig.java │ │ │ │ │ │ ├── ApartmentInvitationRSQLEndpointConfig.java │ │ │ │ │ │ ├── InvitationQueryConfig.java │ │ │ │ │ │ └── InvitationRSQLEndpointConfig.java │ │ │ │ ├── general │ │ │ │ │ ├── contact │ │ │ │ │ │ ├── ContactQueryConfig.java │ │ │ │ │ │ ├── ContactRSQLEndpointConfig.java │ │ │ │ │ │ ├── CoopContactQueryConfig.java │ │ │ │ │ │ └── CoopContactRSQLEndpointConfig.java │ │ │ │ │ └── news │ │ │ │ │ │ ├── NewsQueryConfig.java │ │ │ │ │ │ └── NewsRSQLEndpointConfig.java │ │ │ │ ├── poll │ │ │ │ │ ├── PollQueryConfig.java │ │ │ │ │ ├── PollRSQLEndpointConfig.java │ │ │ │ │ ├── house │ │ │ │ │ │ ├── PollHouseQueryConfig.java │ │ │ │ │ │ └── PollHouseRSQLEndpointConfig.java │ │ │ │ │ └── question │ │ │ │ │ │ ├── PollQuestionQueryConfig.java │ │ │ │ │ │ └── PollQuestionRSQLEndpointConfig.java │ │ │ │ └── user │ │ │ │ │ ├── UserQueryConfig.java │ │ │ │ │ ├── UserRSQLEndpointConfig.java │ │ │ │ │ └── ownership │ │ │ │ │ ├── OwnershipQueryConfig.java │ │ │ │ │ └── OwnershipRSQLEndpointConfig.java │ │ │ └── resolver │ │ │ │ └── ValidationConfigurationContextResolver.java │ │ │ ├── converter │ │ │ ├── StringToContactTypeConverter.java │ │ │ ├── StringToInvitationStatusConverter.java │ │ │ ├── StringToInvitationTypeConverter.java │ │ │ ├── StringToPasswordRecoveryTokenStatusConverter.java │ │ │ ├── StringToPollStatusConverter.java │ │ │ ├── StringToPollTypeConverter.java │ │ │ └── StringToQuestionTypeConverter.java │ │ │ ├── exception │ │ │ └── mapper │ │ │ │ ├── AccessDeniedExceptionMapper.java │ │ │ │ ├── BadRequestHomeExceptionMapper.java │ │ │ │ ├── BaseExceptionMapper.java │ │ │ │ ├── BaseHomeExceptionMapper.java │ │ │ │ ├── BaseInvitationExceptionMapper.java │ │ │ │ ├── BaseOauthExceptionMapper.java │ │ │ │ ├── ConstraintViolationExceptionMapper.java │ │ │ │ ├── DataIntegrityViolationExceptionMapper.java │ │ │ │ ├── ExceptionMapperUtils.java │ │ │ │ ├── GeneralExceptionMapper.java │ │ │ │ ├── InvalidDataAccessApiExceptionMapper.java │ │ │ │ ├── JsonMappingExceptionMapper.java │ │ │ │ ├── JsonParseExceptionMapper.java │ │ │ │ ├── NotAcceptableInvitationExceptionMapper.java │ │ │ │ ├── NotAcceptableOauthExceptionMapper.java │ │ │ │ ├── NotFoundHomeExceptionMapper.java │ │ │ │ ├── PasswordExceptionMapper.java │ │ │ │ ├── PasswordRestorationExceptionMapper.java │ │ │ │ └── jax │ │ │ │ ├── BadRequestExceptionMapper.java │ │ │ │ └── NotFoundExceptionMapper.java │ │ │ ├── mapper │ │ │ ├── HomeMapper.java │ │ │ └── config │ │ │ │ ├── HomeMappingConfig.java │ │ │ │ └── impl │ │ │ │ ├── ApartmentInvitationDTOMappingConfig.java │ │ │ │ ├── CooperationInvitationDTOMappingConfig.java │ │ │ │ ├── ReadOwnerMappingConfig.java │ │ │ │ └── UpdatePollMappingConfig.java │ │ │ ├── provider │ │ │ ├── EnumConverterProvider.java │ │ │ ├── JacksonJsonProvider.java │ │ │ ├── JerseyParameterNameProvider.java │ │ │ └── LocalDateTimeProvider.java │ │ │ └── security │ │ │ ├── constants │ │ │ └── Permissions.java │ │ │ ├── exception │ │ │ ├── BaseOauthException.java │ │ │ └── NotAcceptableOauthException.java │ │ │ ├── filter │ │ │ ├── JWTProvider.java │ │ │ └── JWTTokenValidatorFilter.java │ │ │ └── service │ │ │ ├── EntitySpecificationService.java │ │ │ ├── QueryApiService.java │ │ │ └── impl │ │ │ ├── EntitySpecificationServiceImpl.java │ │ │ ├── HomeUserDetailsService.java │ │ │ └── QueryApiServiceImpl.java │ └── resources │ │ ├── ValidationMessages.properties │ │ ├── config │ │ └── application.properties │ │ ├── files │ │ └── template.xlsx │ │ └── static │ │ ├── api │ │ └── 0 │ │ │ ├── apidocs │ │ │ ├── index.html │ │ │ ├── rapidoc │ │ │ │ └── index.html │ │ │ ├── redoc │ │ │ │ └── index.html │ │ │ └── swagger-ui │ │ │ │ └── index.html │ │ │ └── version.json │ │ └── favicon.ico │ └── test │ ├── java │ ├── .keep │ └── com │ │ └── softserveinc │ │ └── ita │ │ └── homeproject │ │ └── application │ │ ├── HomeServiceTestContextConfig.java │ │ ├── config │ │ └── classes │ │ │ ├── destination │ │ │ ├── BaseModelDto.java │ │ │ ├── Container1Dto.java │ │ │ ├── Container2Dto.java │ │ │ ├── ContainerDto.java │ │ │ ├── Inner1Dto.java │ │ │ ├── Inner2Dto.java │ │ │ ├── InnerDto.java │ │ │ ├── InnerItem1Dto.java │ │ │ └── InnerItemDto.java │ │ │ └── source │ │ │ ├── BaseModel.java │ │ │ ├── ChildContainer1.java │ │ │ ├── ChildContainer2.java │ │ │ ├── Container.java │ │ │ ├── Inner.java │ │ │ ├── Inner1.java │ │ │ ├── Inner2.java │ │ │ ├── InnerItem.java │ │ │ └── InnerItem1.java │ │ ├── jobs │ │ └── TestSpringQuartzConfig.java │ │ └── security │ │ ├── filter │ │ └── JWTProviderTest.java │ │ └── service │ │ └── impl │ │ └── QueryApiServiceImplTest.java │ └── resources │ └── application-home-application-test.properties ├── home-clients ├── pom.xml └── src │ ├── main │ ├── java │ │ └── .keep │ └── resources │ │ └── mustaches │ │ └── client │ │ ├── api.mustache │ │ └── pom.mustache │ └── test │ └── java │ └── .keep ├── home-data-migration ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── softserveinc │ │ │ └── ita │ │ │ └── homeproject │ │ │ └── homedatamigration │ │ │ └── migrations │ │ │ ├── LiquibaseRunner.java │ │ │ └── LiquibaseUpdate.java │ └── resources │ │ ├── checkstyle-configuration.xml │ │ └── db │ │ └── changelog │ │ ├── 0.0.1 │ │ ├── Issue104.xml │ │ ├── Issue121.xml │ │ ├── Issue127.xml │ │ ├── Issue134.xml │ │ ├── Issue156.xml │ │ ├── Issue163.xml │ │ ├── Issue180.xml │ │ ├── Issue183.xml │ │ ├── Issue225.xml │ │ ├── Issue227.xml │ │ ├── Issue228.xml │ │ ├── Issue229.xml │ │ ├── Issue230.xml │ │ ├── Issue256.xml │ │ ├── Issue272.xml │ │ ├── Issue299.xml │ │ ├── Issue304.xml │ │ ├── Issue313.xml │ │ ├── Issue324.xml │ │ ├── Issue334.xml │ │ ├── Issue364.xml │ │ ├── Issue390.xml │ │ ├── Issue404.xml │ │ ├── Issue412.xml │ │ ├── Issue426.xml │ │ ├── Issue451.xml │ │ ├── Issue471.xml │ │ ├── Issue91.xml │ │ ├── Issue96.xml │ │ └── _cumulative.xml │ │ └── master.xml │ └── test │ └── java │ └── .keep ├── home-data ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── softserveinc │ │ │ └── ita │ │ │ └── homeproject │ │ │ └── homedata │ │ │ ├── BaseEntity.java │ │ │ ├── cooperation │ │ │ ├── Cooperation.java │ │ │ ├── CooperationRepository.java │ │ │ ├── apatment │ │ │ │ ├── Apartment.java │ │ │ │ └── ApartmentRepository.java │ │ │ ├── house │ │ │ │ ├── House.java │ │ │ │ └── HouseRepository.java │ │ │ └── invitation │ │ │ │ ├── Invitation.java │ │ │ │ ├── InvitationRepository.java │ │ │ │ ├── apartment │ │ │ │ ├── ApartmentInvitation.java │ │ │ │ └── ApartmentInvitationRepository.java │ │ │ │ ├── converters │ │ │ │ ├── InvitationRoleConverter.java │ │ │ │ ├── InvitationStatusAttributeConverter.java │ │ │ │ ├── InvitationTypeAttributeConverter.java │ │ │ │ └── PasswordRecoveryTokenStatusAttributeConverter.java │ │ │ │ ├── cooperation │ │ │ │ ├── CooperationInvitation.java │ │ │ │ └── CooperationInvitationRepository.java │ │ │ │ └── enums │ │ │ │ ├── InvitationStatus.java │ │ │ │ └── InvitationType.java │ │ │ ├── general │ │ │ ├── address │ │ │ │ └── Address.java │ │ │ ├── contact │ │ │ │ ├── Contact.java │ │ │ │ ├── ContactRepository.java │ │ │ │ ├── ContactType.java │ │ │ │ ├── converters │ │ │ │ │ └── ContactTypeAttributeConverter.java │ │ │ │ ├── email │ │ │ │ │ └── EmailContact.java │ │ │ │ └── phone │ │ │ │ │ └── PhoneContact.java │ │ │ └── news │ │ │ │ ├── News.java │ │ │ │ └── NewsRepository.java │ │ │ ├── poll │ │ │ ├── Poll.java │ │ │ ├── PollRepository.java │ │ │ ├── converters │ │ │ │ ├── PollQuestionTypeAttributeConverter.java │ │ │ │ ├── PollStatusAttributeConverter.java │ │ │ │ └── PollTypeAttributeConverter.java │ │ │ ├── enums │ │ │ │ ├── PollQuestionType.java │ │ │ │ ├── PollStatus.java │ │ │ │ └── PollType.java │ │ │ ├── question │ │ │ │ ├── AdviceChoiceQuestion.java │ │ │ │ ├── AnswerVariant.java │ │ │ │ ├── AnswerVariantRepository.java │ │ │ │ ├── DoubleChoiceQuestion.java │ │ │ │ ├── MultipleChoiceQuestion.java │ │ │ │ ├── PollQuestion.java │ │ │ │ └── PollQuestionRepository.java │ │ │ ├── results │ │ │ │ ├── ResultQuestion.java │ │ │ │ └── ResultQuestionRepository.java │ │ │ └── votes │ │ │ │ ├── Vote.java │ │ │ │ ├── VoteAnswerVariant.java │ │ │ │ ├── VoteAnswerVariantRepository.java │ │ │ │ └── VoteRepository.java │ │ │ └── user │ │ │ ├── User.java │ │ │ ├── UserCooperation.java │ │ │ ├── UserCooperationRepository.java │ │ │ ├── UserCredentials.java │ │ │ ├── UserCredentialsRepository.java │ │ │ ├── UserRepository.java │ │ │ ├── UserSession.java │ │ │ ├── UserSessionRepository.java │ │ │ ├── ownership │ │ │ ├── Ownership.java │ │ │ └── OwnershipRepository.java │ │ │ ├── password │ │ │ ├── PasswordRecovery.java │ │ │ ├── PasswordRecoveryRepository.java │ │ │ └── enums │ │ │ │ └── PasswordRecoveryTokenStatus.java │ │ │ ├── permission │ │ │ ├── Permission.java │ │ │ └── PermissionRepository.java │ │ │ └── role │ │ │ ├── Role.java │ │ │ ├── RoleEnum.java │ │ │ └── RoleRepository.java │ └── resources │ │ └── application-home-data.properties │ └── test │ └── java │ └── .keep ├── home-dev ├── README.md └── launch │ └── docker-compose.yml ├── home-docs ├── README.md ├── RSQL-query.md ├── code-style.md ├── developer-checks.md ├── docker-readme.md ├── home-api-tests.md ├── home-application-heroku-deploy.md ├── modules-description.md ├── project-description.md ├── role-matrix.md └── stages-of-development-and-versioning.md ├── home-oauth-server ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── softserveinc │ │ │ └── ita │ │ │ └── homeproject │ │ │ └── homeoauthserver │ │ │ ├── HomeOauthServerApplication.java │ │ │ ├── config │ │ │ └── JwtProvider.java │ │ │ ├── controller │ │ │ └── OauthController.java │ │ │ ├── dto │ │ │ ├── AccessTokenDto.java │ │ │ ├── CreateTokenDto.java │ │ │ ├── RefreshTokenDto.java │ │ │ └── UserCredentialsDto.java │ │ │ ├── exception │ │ │ ├── BaseOauthException.java │ │ │ ├── NotAcceptableOauthException.java │ │ │ ├── NotFoundOauthException.java │ │ │ └── handler │ │ │ │ └── ControllerExceptionHandler.java │ │ │ └── service │ │ │ ├── OauthService.java │ │ │ └── OauthServiceImpl.java │ └── resources │ │ ├── application-home-oauth-server.properties │ │ └── static │ │ ├── api │ │ └── 0 │ │ │ └── oauth2 │ │ │ ├── index.html │ │ │ ├── rapidoc │ │ │ └── index.html │ │ │ ├── redoc │ │ │ └── index.html │ │ │ ├── swagger-ui │ │ │ └── index.html │ │ │ └── version.json │ │ └── favicon.ico │ └── test │ ├── java │ └── com │ │ └── softserveinc │ │ └── ita │ │ └── homeproject │ │ └── homeoauthserver │ │ ├── HomeServiceTestContextConfig.java │ │ ├── config │ │ └── JwtProviderTest.java │ │ └── service │ │ └── OauthServiceImplTest.java │ └── resources │ └── application-home-oauth-server-test.properties ├── home-open-api ├── pom.xml └── src │ ├── main │ ├── java │ │ └── .keep │ └── resources │ │ └── yaml │ │ ├── models │ │ ├── address.yaml │ │ ├── answer.yaml │ │ ├── apartment.yaml │ │ ├── common.yaml │ │ ├── contact.yaml │ │ ├── cooperation.yaml │ │ ├── house.yaml │ │ ├── invitation.yaml │ │ ├── news.yaml │ │ ├── owner.yaml │ │ ├── ownership.yaml │ │ ├── passwordRestoration.yaml │ │ ├── poll.yaml │ │ ├── question.yaml │ │ ├── user.yaml │ │ └── vote.yaml │ │ ├── oauth-openapi.yaml │ │ ├── openapi.yaml │ │ ├── parameters │ │ └── parameters.yaml │ │ ├── paths │ │ ├── apartmentOwnerships.yaml │ │ ├── apartments.yaml │ │ ├── contacts.yaml │ │ ├── cooperationContacts.yaml │ │ ├── cooperationPolls.yaml │ │ ├── cooperations.yaml │ │ ├── currentUser.yaml │ │ ├── houses.yaml │ │ ├── invitations.yaml │ │ ├── logout.yaml │ │ ├── news.yaml │ │ ├── passwordRestoration.yaml │ │ ├── polls.yaml │ │ ├── pollsHouses.yaml │ │ ├── pollsQuestions.yaml │ │ ├── pollsVotes.yaml │ │ ├── templateFile.yaml │ │ └── users.yaml │ │ ├── requests │ │ └── requestBodies.yaml │ │ └── responses │ │ └── responses.yaml │ └── test │ └── java │ └── .keep ├── home-service ├── pom.xml └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── softserveinc │ │ │ └── ita │ │ │ └── homeproject │ │ │ └── homeservice │ │ │ ├── dto │ │ │ ├── BaseDto.java │ │ │ ├── cooperation │ │ │ │ ├── CooperationDto.java │ │ │ │ ├── apartment │ │ │ │ │ └── ApartmentDto.java │ │ │ │ ├── house │ │ │ │ │ └── HouseDto.java │ │ │ │ └── invitation │ │ │ │ │ ├── InvitationDto.java │ │ │ │ │ ├── apartment │ │ │ │ │ └── ApartmentInvitationDto.java │ │ │ │ │ ├── cooperation │ │ │ │ │ └── CooperationInvitationDto.java │ │ │ │ │ └── enums │ │ │ │ │ ├── InvitationStatusDto.java │ │ │ │ │ └── InvitationTypeDto.java │ │ │ ├── general │ │ │ │ ├── contact │ │ │ │ │ ├── ContactDto.java │ │ │ │ │ ├── EmailContactDto.java │ │ │ │ │ ├── PhoneContactDto.java │ │ │ │ │ └── enums │ │ │ │ │ │ └── ContactTypeDto.java │ │ │ │ ├── mail │ │ │ │ │ └── MailDto.java │ │ │ │ └── news │ │ │ │ │ └── NewsDto.java │ │ │ ├── poll │ │ │ │ ├── PollDto.java │ │ │ │ ├── enums │ │ │ │ │ ├── PollQuestionTypeDto.java │ │ │ │ │ ├── PollStatusDto.java │ │ │ │ │ └── PollTypeDto.java │ │ │ │ ├── question │ │ │ │ │ ├── AdviceChoiceQuestionDto.java │ │ │ │ │ ├── DoubleChoiceQuestionDto.java │ │ │ │ │ ├── MultipleChoiceQuestionDto.java │ │ │ │ │ └── PollQuestionDto.java │ │ │ │ ├── results │ │ │ │ │ ├── AnswerVariantDto.java │ │ │ │ │ └── ResultQuestionDto.java │ │ │ │ └── votes │ │ │ │ │ ├── AdviceQuestionVoteDto.java │ │ │ │ │ ├── MultipleChoiceQuestionVoteDto.java │ │ │ │ │ ├── QuestionVoteDto.java │ │ │ │ │ ├── VoteDto.java │ │ │ │ │ ├── VoteQuestionVariantDto.java │ │ │ │ │ └── VoteWithAnswerVariantDto.java │ │ │ └── user │ │ │ │ ├── UserDto.java │ │ │ │ ├── ownership │ │ │ │ └── OwnershipDto.java │ │ │ │ ├── password │ │ │ │ ├── PasswordRecoveryTokenDto.java │ │ │ │ ├── PasswordRestorationApprovalDto.java │ │ │ │ └── PasswordRestorationRequestDto.java │ │ │ │ └── role │ │ │ │ └── RoleDto.java │ │ │ ├── exception │ │ │ ├── BadRequestHomeException.java │ │ │ ├── BaseHomeException.java │ │ │ ├── ExceptionMessages.java │ │ │ ├── InvitationException.java │ │ │ ├── NotAcceptableInvitationException.java │ │ │ ├── NotFoundHomeException.java │ │ │ ├── PasswordException.java │ │ │ └── PasswordRestorationException.java │ │ │ ├── mapper │ │ │ ├── ServiceMapper.java │ │ │ ├── VoteMapper.java │ │ │ └── config │ │ │ │ ├── AbstractTypeConverter.java │ │ │ │ ├── ServiceMappingConfig.java │ │ │ │ └── TypeMatcher.java │ │ │ ├── quartz │ │ │ ├── config │ │ │ │ ├── QuartzBeanPostProcessor.java │ │ │ │ ├── QuartzJobBeanAutoConfiguration.java │ │ │ │ └── QuartzUtil.java │ │ │ └── jobs │ │ │ │ ├── DeleteAllExpiredAndDisabledPasswordRestorationTokensJob.java │ │ │ │ ├── SendApartmentEmailJob.java │ │ │ │ ├── SendCooperationEmailJob.java │ │ │ │ ├── SendPasswordRestorationApprovalEmailJob.java │ │ │ │ └── SetOverdueStatusForInvitationsJob.java │ │ │ ├── service │ │ │ ├── QueryableService.java │ │ │ ├── cooperation │ │ │ │ ├── CooperationService.java │ │ │ │ ├── CooperationServiceImpl.java │ │ │ │ ├── apartment │ │ │ │ │ ├── ApartmentService.java │ │ │ │ │ └── ApartmentServiceImpl.java │ │ │ │ ├── data │ │ │ │ │ └── transfer │ │ │ │ │ │ ├── ImportExportTemplateFileService.java │ │ │ │ │ │ └── ImportExportTemplateFileServiceImpl.java │ │ │ │ ├── house │ │ │ │ │ ├── HouseService.java │ │ │ │ │ └── HouseServiceImpl.java │ │ │ │ └── invitation │ │ │ │ │ ├── InvitationService.java │ │ │ │ │ ├── InvitationServiceImpl.java │ │ │ │ │ ├── apartment │ │ │ │ │ └── ApartmentInvitationServiceImpl.java │ │ │ │ │ └── cooperation │ │ │ │ │ └── CooperationInvitationServiceImpl.java │ │ │ ├── general │ │ │ │ ├── contact │ │ │ │ │ ├── BaseContactService.java │ │ │ │ │ ├── ContactService.java │ │ │ │ │ ├── cooperation │ │ │ │ │ │ ├── CooperationContactService.java │ │ │ │ │ │ └── CooperationContactServiceImpl.java │ │ │ │ │ └── user │ │ │ │ │ │ ├── UserContactService.java │ │ │ │ │ │ └── UserContactServiceImpl.java │ │ │ │ ├── email │ │ │ │ │ ├── BaseEmailService.java │ │ │ │ │ ├── Mailable.java │ │ │ │ │ ├── MailableService.java │ │ │ │ │ ├── SendApartmentEmailService.java │ │ │ │ │ ├── SendCooperationEmailService.java │ │ │ │ │ └── SendPasswordRestorationApprovalEmailServiceImpl.java │ │ │ │ ├── mail │ │ │ │ │ ├── InvitationMailServiceImpl.java │ │ │ │ │ ├── MailService.java │ │ │ │ │ └── PasswordRestorationMailServiceImpl.java │ │ │ │ └── news │ │ │ │ │ ├── NewsService.java │ │ │ │ │ └── NewsServiceImpl.java │ │ │ ├── poll │ │ │ │ ├── PollService.java │ │ │ │ ├── PollServiceImpl.java │ │ │ │ ├── house │ │ │ │ │ ├── PollHouseService.java │ │ │ │ │ └── PollHouseServiceImpl.java │ │ │ │ ├── question │ │ │ │ │ ├── PollQuestionService.java │ │ │ │ │ └── PollQuestionServiceImpl.java │ │ │ │ ├── template │ │ │ │ │ ├── TemplateService.java │ │ │ │ │ └── TemplateServiceImpl.java │ │ │ │ └── vote │ │ │ │ │ ├── VoteService.java │ │ │ │ │ └── VoteServiceImpl.java │ │ │ └── user │ │ │ │ ├── UserCooperationImpl.java │ │ │ │ ├── UserCooperationService.java │ │ │ │ ├── UserService.java │ │ │ │ ├── UserServiceImpl.java │ │ │ │ ├── UserSessionService.java │ │ │ │ ├── UserSessionServiceImpl.java │ │ │ │ ├── ownership │ │ │ │ ├── OwnershipService.java │ │ │ │ └── OwnershipServiceImpl.java │ │ │ │ └── password │ │ │ │ └── PasswordRestorationServiceImpl.java │ │ │ └── util │ │ │ └── ValidationHelper.java │ └── resources │ │ ├── application-home-service.properties │ │ ├── home-service.properties │ │ └── template │ │ ├── invitation-to-apartment.mustache │ │ ├── invitation-to-cooperation.mustache │ │ ├── invitation-to-registration.mustache │ │ └── password-recovery-approval.mustache │ └── test │ ├── java │ └── com │ │ └── softserveinc │ │ └── ita │ │ └── homeproject │ │ └── homeservice │ │ ├── HomeServiceTestContextConfig.java │ │ ├── mapper │ │ └── config │ │ │ ├── AbstractTypeConverterTest.java │ │ │ └── classes │ │ │ ├── destination │ │ │ ├── BaseModelDto.java │ │ │ ├── Container1Dto.java │ │ │ ├── Container2Dto.java │ │ │ ├── ContainerDto.java │ │ │ ├── Inner1Dto.java │ │ │ ├── Inner2Dto.java │ │ │ ├── InnerDto.java │ │ │ ├── InnerItem1Dto.java │ │ │ └── InnerItemDto.java │ │ │ └── source │ │ │ ├── BaseModel.java │ │ │ ├── ChildContainer1.java │ │ │ ├── ChildContainer2.java │ │ │ ├── Container.java │ │ │ ├── Inner.java │ │ │ ├── Inner1.java │ │ │ ├── Inner2.java │ │ │ ├── InnerItem.java │ │ │ └── InnerItem1.java │ │ ├── quartz │ │ └── jobs │ │ │ ├── SetOverdueStatusForInvitationsJobIntegrationTest.java │ │ │ └── TestSpringQuartzConfig.java │ │ ├── service │ │ └── impl │ │ │ ├── ApartmentInvitationServiceIntegrationTest.java │ │ │ ├── CooperationInvitationServiceIntegrationTest.java │ │ │ ├── InvitationMailServiceImplTest.java │ │ │ ├── NewsServiceImplTest.java │ │ │ ├── PollServiceImplTest.java │ │ │ └── UserServiceImplTest.java │ │ └── util │ │ └── ValidationHelperTest.java │ └── resources │ └── application-home-service-test.properties └── pom.xml /.github/ISSUE_TEMPLATE/user-story.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: User story 3 | about: Describe story goal 4 | title: '' 5 | labels: User story 6 | assignees: '' 7 | 8 | --- 9 | 10 | **As a** **I want to** <....> **so that** <...> 11 | 12 | **Description** 13 | Describe feature functionality 14 | Add mockup if needed 15 | 16 | ### Acceptance Criteria 17 | A clear and concise description of what you want to happen. 18 | 19 | **Epic link** 20 | E.g.: Epic #100 [Epic](https://app.zenhub.com/workspaces/home-project-5f7b77ff8db73a001cb17009) 21 | 22 | **Labels to be added** 23 | "User story", Correspondind Functionality (e.g. User), Priority ("pri: "), "Corresponding Epic" 24 | 25 | ### Tasks 26 | 1. - [ ] sample task. 27 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/develop.md: -------------------------------------------------------------------------------- 1 | dev 2 | ## ZenHub 3 | 4 | * [Main ZenHub ticket](https://app.zenhub.com/workspaces/home-project-5f7b77ff8db73a001cb17009) 5 | 6 | 7 | ## Code reviewers 8 | 9 | - [ ] @github_username 10 | 11 | ### Second Level Review 12 | 13 | - [ ] @github_username 14 | 15 | ## Summary of issue 16 | 17 | ToDo 18 | 19 | ## Summary of change 20 | 21 | ToDo 22 | 23 | ## Testing approach 24 | 25 | ToDo 26 | 27 | ## CHECK LIST 28 | - [ ] СI passed 29 | - [ ] Сode coverage >=95% 30 | - [ ] PR is reviewed manually again (to make sure you have 100% ready code) 31 | - [ ] All reviewers agreed to merge the PR 32 | - [ ] I've checked new feature as logged in and logged out user if needed 33 | - [ ] PR meets all conventions 34 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE/master.md: -------------------------------------------------------------------------------- 1 | master 2 | ## ZenHub 3 | 4 | * [Main ZenHub ticket](https://app.zenhub.com/workspaces/home-project-5f7b77ff8db73a001cb17009/) 5 | 6 | 7 | ## Code reviewers 8 | 9 | - [ ] @github_username 10 | 11 | ### Second Level Review 12 | 13 | - [ ] @github_username 14 | 15 | ## Summary of issue 16 | 17 | ToDo 18 | 19 | ## Summary of change 20 | 21 | ToDo 22 | 23 | ## Testing approach 24 | 25 | ToDo 26 | 27 | ## CHECK LIST 28 | - [ ] СI passed 29 | - [ ] Сode coverage >=95% 30 | - [ ] PR is reviewed manually again (to make sure you have 100% ready code) 31 | - [ ] All reviewers agreed to merge the PR 32 | - [ ] I've checked new feature as logged in and logged out user if needed 33 | - [ ] PR meets all conventions 34 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | dev 2 | ## ZenHub 3 | 4 | * [Main ZenHub ticket](https://app.zenhub.com/workspaces/home-project-5f7b77ff8db73a001cb17009) 5 | 6 | 7 | ## Code reviewers 8 | 9 | - [ ] @github_username 10 | 11 | ### Second Level Review 12 | 13 | - [ ] @github_username 14 | 15 | ## Summary of issue 16 | 17 | ToDo 18 | 19 | ## Summary of change 20 | 21 | ToDo 22 | 23 | ## Testing approach 24 | 25 | ToDo 26 | 27 | ## CHECK LIST 28 | - [ ] СI passed 29 | - [ ] Сode coverage >=95% 30 | - [ ] PR is reviewed manually again (to make sure you have 100% ready code) 31 | - [ ] All reviewers agreed to merge the PR 32 | - [ ] I've checked new feature as logged in and logged out user if needed 33 | - [ ] PR meets all conventions 34 | -------------------------------------------------------------------------------- /.github/workflows/Review_workflow.yml: -------------------------------------------------------------------------------- 1 | name: Review workflow 2 | 3 | on: 4 | pull_request: 5 | branches: [ dev, master ] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | with: 13 | fetch-depth: 0 14 | 15 | - name: Set up JDK 1.11 16 | uses: actions/setup-java@v1 17 | with: 18 | java-version: 1.11 19 | 20 | - name: Build with Maven 21 | env: 22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 23 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} 24 | API_TESTS_VERBOSE_LOGGING: false 25 | run: >- 26 | mvn -V -e -B -ntp 27 | clean install sonar:sonar 28 | -Papi-tests-infrastructure 29 | -Papi-tests 30 | -Pjacoco -Dsonar.coverage.jacoco.xmlReportPaths=${{ github.workspace }}/home-api-tests/target/site/jacoco-aggregate/jacoco.xml 31 | -Dpostgres.user=${{secrets.POSTGRES_USER}} 32 | -Dpostgres.password=${{secrets.POSTGRES_PASSWORD}} 33 | -Dapi.tests.verbose.logging=${{env.API_TESTS_VERBOSE_LOGGING}} 34 | -Dgithub.packages.read.username=${{secrets.PACKAGES_READ_USERNAME}} 35 | -Dgithub.packages.read.token=${{secrets.PACKAGES_READ_TOKEN}} 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | /.idea 5 | target/ 6 | *.iml 7 | /.m2 8 | -------------------------------------------------------------------------------- /.run/All in home-api-tests.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | -------------------------------------------------------------------------------- /.run/HomeApplicationTest.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 15 | 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Softserve, IT Academy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /home-api-tests/src/main/java/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-api-tests/src/main/java/.keep -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/current_user/CurrentUserApiIT.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.current_user; 2 | 3 | import static org.junit.jupiter.api.Assertions.assertNotNull; 4 | import com.softserveinc.ita.homeproject.api.tests.utils.ApiClientUtil; 5 | import com.softserveinc.ita.homeproject.client.ApiException; 6 | import com.softserveinc.ita.homeproject.client.api.CurrentUserApi; 7 | import com.softserveinc.ita.homeproject.client.model.ReadUser; 8 | import org.junit.jupiter.api.Test; 9 | 10 | class CurrentUserApiIT { 11 | 12 | private final CurrentUserApi currentUserApi = new CurrentUserApi(ApiClientUtil.getCooperationAdminClient()); 13 | 14 | @Test 15 | void getCurrentUser() throws ApiException { 16 | ReadUser user = currentUserApi.getCurrentUser(); 17 | assertNotNull(user.getFirstName()); 18 | assertNotNull(user.getLastName()); 19 | assertNotNull(user.getMiddleName()); 20 | assertNotNull(user.getEmail()); 21 | assertNotNull(user.getContacts()); 22 | assertNotNull(user.getId()); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/FilterPredicate.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils; 2 | 3 | public interface FilterPredicate { 4 | String getPredicate(); 5 | } 6 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/FilterPredicateEnum.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils; 2 | 3 | public enum FilterPredicateEnum implements FilterPredicate { 4 | 5 | BETWEEN("=bt="), 6 | IGNORE_CASE_LIKE("=ilike="); 7 | 8 | private final String parametr; 9 | 10 | FilterPredicateEnum(String parametr) { 11 | this.parametr = parametr; 12 | } 13 | 14 | @Override 15 | public String getPredicate() { 16 | return this.parametr; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/QueryFilterUtils.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils; 2 | 3 | import java.util.StringJoiner; 4 | 5 | public final class QueryFilterUtils { 6 | 7 | public static String getBetweenPredicate(String selector, String arg1, String arg2) { 8 | StringJoiner joiner = new StringJoiner(", ", "(", ")"); 9 | joiner.add(arg1); 10 | joiner.add(arg2); 11 | return selector 12 | .concat(FilterPredicateEnum.BETWEEN.getPredicate()) 13 | .concat(joiner.toString()); 14 | } 15 | 16 | public static String getIgnoreCaseLikePredicate(String selector, String arg) { 17 | return selector 18 | .concat(FilterPredicateEnum.IGNORE_CASE_LIKE.getPredicate()) 19 | .concat(arg); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/LetterParser.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock; 2 | 3 | import com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto.ResponseEmailItem; 4 | 5 | import java.nio.charset.StandardCharsets; 6 | import java.util.Base64; 7 | import java.util.regex.Matcher; 8 | import java.util.regex.Pattern; 9 | 10 | /** 11 | * Letter parser. Can parse invitation tokens. 12 | */ 13 | class LetterParser { 14 | 15 | public String getToken(ResponseEmailItem letter) { 16 | return getToken(getDecodedMessage(letter)); 17 | } 18 | 19 | private String getDecodedMessage(ResponseEmailItem letter) { 20 | String message = letter.getMime().getParts().get(0).getMime().getParts().get(0).getBody(); 21 | return new String(Base64.getMimeDecoder().decode(message), StandardCharsets.UTF_8); 22 | } 23 | 24 | private String getToken(String message) { 25 | Pattern pattern = Pattern.compile("(?<=:) .* (?=<)"); 26 | Matcher matcher = pattern.matcher(message); 27 | 28 | String result = ""; 29 | if (matcher.find()) { 30 | result = matcher.group(); 31 | } 32 | 33 | return result.trim(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/EmailContent.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 5 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Setter 10 | @Getter 11 | @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) 12 | public class EmailContent { 13 | 14 | EmailHeader headers; 15 | 16 | String body; 17 | 18 | String size; 19 | 20 | @JsonProperty("MIME") 21 | String mime; 22 | } 23 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/EmailHeader.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 5 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | import java.util.List; 10 | 11 | @Getter 12 | @Setter 13 | @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) 14 | public class EmailHeader { 15 | 16 | @JsonProperty("Content-Type") 17 | List contentType; 18 | 19 | List date; 20 | 21 | List from; 22 | 23 | @JsonProperty("MIME-Version") 24 | List mimeVersion; 25 | 26 | @JsonProperty("Message-ID") 27 | List messageId; 28 | 29 | List received; 30 | 31 | @JsonProperty("Return-Path") 32 | List returnPath; 33 | 34 | List subject; 35 | 36 | List to; 37 | } 38 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/EmailMime.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 4 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | import java.util.List; 9 | 10 | @Getter 11 | @Setter 12 | @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) 13 | public class EmailMime { 14 | 15 | List parts; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/EmailMimeInner.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 4 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | import java.util.List; 9 | 10 | @Getter 11 | @Setter 12 | @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) 13 | public class EmailMimeInner { 14 | 15 | List parts; 16 | } 17 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/EmailParams.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 4 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) 11 | public class EmailParams { 12 | 13 | String relays; 14 | 15 | String mailbox; 16 | 17 | String domain; 18 | 19 | String params; 20 | } 21 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/EmailPart.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 6 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 7 | import lombok.Getter; 8 | import lombok.Setter; 9 | 10 | @Getter 11 | @Setter 12 | @JsonIgnoreProperties(value = {"Headers","Body","Size"}) 13 | @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) 14 | public class EmailPart { 15 | 16 | @JsonProperty("MIME") 17 | EmailMimeInner mime; 18 | } 19 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/EmailPartInner.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 4 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 5 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter 10 | @Setter 11 | @JsonIgnoreProperties(value = {"Headers","Size","MIME"}) 12 | @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) 13 | public class EmailPartInner { 14 | String body; 15 | } 16 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/LogoutContent.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.client.ApiClient; 6 | import lombok.Builder; 7 | import lombok.Getter; 8 | 9 | @Builder 10 | @Getter 11 | public class LogoutContent { 12 | 13 | private ApiClient apiClient; 14 | private List access_tokens; 15 | } 16 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/MailHogApiResponse.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | import java.util.List; 7 | 8 | @Getter 9 | @Setter 10 | public class MailHogApiResponse { 11 | 12 | Integer total; 13 | 14 | Integer count; 15 | 16 | Integer start; 17 | 18 | List items; 19 | } 20 | -------------------------------------------------------------------------------- /home-api-tests/src/test/java/com/softserveinc/ita/homeproject/api/tests/utils/mail/mock/dto/ResponseEmailItem.java: -------------------------------------------------------------------------------- 1 | 2 | package com.softserveinc.ita.homeproject.api.tests.utils.mail.mock.dto; 3 | 4 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.fasterxml.jackson.databind.PropertyNamingStrategy; 7 | import com.fasterxml.jackson.databind.annotation.JsonNaming; 8 | import lombok.Getter; 9 | import lombok.Setter; 10 | 11 | import java.util.List; 12 | 13 | @Getter 14 | @Setter 15 | @JsonIgnoreProperties(value = {"Body","Raw"}) 16 | @JsonNaming(PropertyNamingStrategy.UpperCamelCaseStrategy.class) 17 | public class ResponseEmailItem { 18 | 19 | @JsonProperty("ID") 20 | String id; 21 | 22 | EmailParams from; 23 | 24 | List to; 25 | 26 | EmailContent content; 27 | 28 | String created; 29 | 30 | @JsonProperty("MIME") 31 | EmailMime mime; 32 | } 33 | -------------------------------------------------------------------------------- /home-application-heroku-deploy-unix.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | heroku login 4 | docker pull homeacademy/home-application 5 | docker pull homeacademy/home-oauth-server 6 | docker tag homeacademy/home-application registry.heroku.com/home-project-academy/web 7 | docker tag homeacademy/home-oauth-server registry.heroku.com/home-oauth-server/web 8 | heroku container:login 9 | docker push registry.heroku.com/home-project-academy/web 10 | heroku container:release -a home-project-academy web 11 | docker push registry.heroku.com/home-oauth-server/web 12 | heroku container:release -a home-oauth-server web 13 | echo SUCCESS 14 | sleep 5 15 | -------------------------------------------------------------------------------- /home-application-heroku-deploy-windows.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | start /W heroku login 3 | docker pull homeacademy/home-application &&^ 4 | start /W docker tag homeacademy/home-application registry.heroku.com/home-project-academy/web &&^ 5 | choice /c abcdefghijklmnopqrstuvwxyz0123456789 /n /m "Make sure that previous steps worked out properly and press any key to continue, or press q to exit." 6 | if "%errorlevel%" == "17" exit 7 | start /W heroku container:login 8 | start /W docker push registry.heroku.com/home-project-academy/web 9 | heroku container:release -a home-project-academy web &&^ 10 | TIMEOUT /T 5 11 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/HomeApplication.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.PropertySource; 6 | 7 | @SpringBootApplication 8 | @PropertySource({ 9 | "application-home-service.properties", 10 | "application-home-data.properties" 11 | }) 12 | public class HomeApplication { 13 | public static void main(String[] args) { 14 | SpringApplication.run(HomeApplication.class, args); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/api/FileApiImpl.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.api; 2 | 3 | import javax.annotation.security.PermitAll; 4 | import javax.ws.rs.core.Response; 5 | import javax.ws.rs.ext.Provider; 6 | 7 | import com.softserveinc.ita.homeproject.homeservice.service.cooperation.data.transfer.ImportExportTemplateFileService; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.stereotype.Component; 10 | 11 | @Provider 12 | @Component 13 | public class FileApiImpl implements FileApi { 14 | 15 | @Autowired 16 | private ImportExportTemplateFileService templateService; 17 | 18 | @PermitAll 19 | @Override 20 | public Response getTemplateFile() { 21 | Response.ResponseBuilder responseBuilder = Response.ok(templateService.getTemplateFile()); 22 | responseBuilder.header("Content-Disposition", "attachment; filename=\"template.xlsx\""); 23 | 24 | return responseBuilder.build(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/config/query/QueryConfig.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.query; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 6 | 7 | public interface QueryConfig { 8 | 9 | Class getEntityClass(); 10 | 11 | List getWhiteListEnums(); 12 | } 13 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/config/query/QueryParamEnum.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.query; 2 | 3 | public interface QueryParamEnum { 4 | 5 | String getParameter(); 6 | } 7 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/config/query/RSQLEndpointConfig.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.query; 2 | 3 | import java.util.Map; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 6 | 7 | public interface RSQLEndpointConfig { 8 | 9 | Map getMappings(); 10 | 11 | QueryConfig getQueryConfig(); 12 | } 13 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/config/resolver/ValidationConfigurationContextResolver.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.resolver; 2 | 3 | import javax.ws.rs.ext.ContextResolver; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import com.softserveinc.ita.homeproject.application.provider.JerseyParameterNameProvider; 7 | import org.glassfish.jersey.server.validation.ValidationConfig; 8 | 9 | @Provider 10 | public class ValidationConfigurationContextResolver implements ContextResolver { 11 | 12 | @Override 13 | public ValidationConfig getContext(final Class type) { 14 | final ValidationConfig config = new ValidationConfig(); 15 | config.parameterNameProvider(new JerseyParameterNameProvider()); 16 | return config; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/converter/StringToContactTypeConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.converter; 2 | 3 | import javax.ws.rs.ext.Provider; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.general.contact.ContactType; 6 | import org.springframework.core.convert.converter.Converter; 7 | 8 | @Provider 9 | public class StringToContactTypeConverter implements Converter { 10 | @Override 11 | public ContactType convert(final String source) { 12 | 13 | ContactType result = null; 14 | 15 | if (source != null && !source.isEmpty()) { 16 | for (ContactType constant : ContactType.values()) { 17 | if (constant.toString().equals(source)) { 18 | result = constant; 19 | } 20 | } 21 | } 22 | 23 | return result; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/converter/StringToInvitationStatusConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.converter; 2 | 3 | import javax.ws.rs.ext.Provider; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums.InvitationStatus; 6 | import org.springframework.core.convert.converter.Converter; 7 | 8 | @Provider 9 | public class StringToInvitationStatusConverter implements Converter { 10 | 11 | @Override 12 | public InvitationStatus convert(final String source) { 13 | 14 | InvitationStatus result = null; 15 | 16 | if (source != null && !source.isEmpty()) { 17 | for (InvitationStatus constant : InvitationStatus.values()) { 18 | if (constant.toString().equals(source)) { 19 | result = constant; 20 | } 21 | } 22 | } 23 | 24 | return result; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/converter/StringToInvitationTypeConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.converter; 2 | 3 | import javax.ws.rs.ext.Provider; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums.InvitationType; 6 | import org.springframework.core.convert.converter.Converter; 7 | 8 | @Provider 9 | public class StringToInvitationTypeConverter implements Converter { 10 | @Override 11 | public InvitationType convert(final String source) { 12 | 13 | InvitationType result = null; 14 | 15 | if (source != null && !source.isEmpty()) { 16 | for (InvitationType constant : InvitationType.values()) { 17 | if (constant.toString().equals(source)) { 18 | result = constant; 19 | } 20 | } 21 | } 22 | 23 | return result; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/converter/StringToPasswordRecoveryTokenStatusConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.converter; 2 | 3 | import javax.ws.rs.ext.Provider; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.user.password.enums.PasswordRecoveryTokenStatus; 6 | import org.springframework.core.convert.converter.Converter; 7 | 8 | 9 | @Provider 10 | public class StringToPasswordRecoveryTokenStatusConverter implements Converter { 11 | 12 | @Override 13 | public PasswordRecoveryTokenStatus convert(final String source) { 14 | PasswordRecoveryTokenStatus result = null; 15 | 16 | if (source != null && !source.isEmpty()) { 17 | for (PasswordRecoveryTokenStatus constant : PasswordRecoveryTokenStatus.values()) { 18 | if (constant.toString().equals(source)) { 19 | result = constant; 20 | } 21 | } 22 | } 23 | 24 | return result; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/converter/StringToPollStatusConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.converter; 2 | 3 | import javax.ws.rs.ext.Provider; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.poll.enums.PollStatus; 6 | import org.springframework.core.convert.converter.Converter; 7 | 8 | @Provider 9 | public class StringToPollStatusConverter implements Converter { 10 | @Override 11 | public PollStatus convert(final String source) { 12 | 13 | PollStatus result = null; 14 | 15 | if (source != null && !source.isEmpty()) { 16 | for (PollStatus constant : PollStatus.values()) { 17 | if (constant.toString().equals(source)) { 18 | result = constant; 19 | } 20 | } 21 | } 22 | 23 | return result; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/converter/StringToPollTypeConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.converter; 2 | 3 | import javax.ws.rs.ext.Provider; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.poll.enums.PollType; 6 | import org.springframework.core.convert.converter.Converter; 7 | 8 | @Provider 9 | public class StringToPollTypeConverter implements Converter { 10 | @Override 11 | public PollType convert(final String source) { 12 | 13 | PollType result = null; 14 | 15 | if (source != null && !source.isEmpty()) { 16 | for (PollType constant : PollType.values()) { 17 | if (constant.toString().equals(source)) { 18 | result = constant; 19 | } 20 | } 21 | } 22 | 23 | return result; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/converter/StringToQuestionTypeConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.converter; 2 | 3 | import javax.ws.rs.ext.Provider; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.poll.enums.PollQuestionType; 6 | import org.springframework.core.convert.converter.Converter; 7 | 8 | @Provider 9 | public class StringToQuestionTypeConverter implements Converter { 10 | 11 | @Override 12 | public PollQuestionType convert(final String source) { 13 | 14 | PollQuestionType result = null; 15 | 16 | if (source != null && !source.isEmpty()) { 17 | for (PollQuestionType constant : PollQuestionType.values()) { 18 | if (constant.toString().equals(source)) { 19 | result = constant; 20 | } 21 | } 22 | } 23 | 24 | return result; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/AccessDeniedExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import org.springframework.security.access.AccessDeniedException; 7 | 8 | /** 9 | * AccessDeniedExceptionMapper class is used to return exception 10 | * response with HTTP status code, when the authorization is failed. 11 | * 12 | * @author Oleksii Zinkevych 13 | * @see javax.ws.rs.ext.ExceptionMapper 14 | */ 15 | @Provider 16 | public class AccessDeniedExceptionMapper extends BaseExceptionMapper { 17 | @Override 18 | protected Response.Status getStatus() { 19 | return Response.Status.UNAUTHORIZED; 20 | } 21 | 22 | @Override 23 | protected String extractMessage(AccessDeniedException exception) { 24 | return "Unauthorized"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/BadRequestHomeExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import com.softserveinc.ita.homeproject.homeservice.exception.BadRequestHomeException; 7 | 8 | /** 9 | * BadRequestHomeExceptionMapper class is used to return exception 10 | * response with HTTP status code, when a request not match API requirements. 11 | * 12 | * @author Oleksii Zinkevych 13 | * @see javax.ws.rs.ext.ExceptionMapper 14 | */ 15 | 16 | @Provider 17 | public class BadRequestHomeExceptionMapper extends BaseHomeExceptionMapper { 18 | @Override 19 | protected Response.Status getStatus() { 20 | return Response.Status.BAD_REQUEST; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/BaseHomeExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.exception.BaseHomeException; 4 | 5 | public abstract class BaseHomeExceptionMapper extends BaseExceptionMapper { 6 | 7 | @Override 8 | protected String extractMessage(T exception) { 9 | return exception.getMessage(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/BaseInvitationExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.exception.InvitationException; 4 | 5 | public abstract class BaseInvitationExceptionMapper extends BaseExceptionMapper { 6 | 7 | @Override 8 | protected String extractMessage(T exception) { 9 | return exception.getMessage(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/BaseOauthExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import com.softserveinc.ita.homeproject.application.security.exception.BaseOauthException; 4 | 5 | public abstract class BaseOauthExceptionMapper extends BaseExceptionMapper { 6 | 7 | @Override 8 | protected String extractMessage(T exception) { 9 | return exception.getMessage(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/GeneralExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import static com.softserveinc.ita.homeproject.homeservice.exception.ExceptionMessages.UNKNOWN_ERROR_MESSAGE; 4 | import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; 5 | 6 | import javax.ws.rs.core.Response; 7 | import javax.ws.rs.ext.Provider; 8 | 9 | @Provider 10 | public class GeneralExceptionMapper extends BaseExceptionMapper { 11 | 12 | protected Response.Status getStatus() { 13 | return INTERNAL_SERVER_ERROR; 14 | } 15 | 16 | protected String extractMessage(Throwable exception) { 17 | return UNKNOWN_ERROR_MESSAGE; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/InvalidDataAccessApiExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import static com.softserveinc.ita.homeproject.application.exception.mapper.ExceptionMapperUtils.getInvalidDataApiExceptionParser; 4 | 5 | import javax.ws.rs.core.Response; 6 | import javax.ws.rs.ext.Provider; 7 | 8 | import org.springframework.dao.InvalidDataAccessApiUsageException; 9 | 10 | @Provider 11 | public class InvalidDataAccessApiExceptionMapper extends BaseExceptionMapper { 12 | @Override 13 | protected Response.Status getStatus() { 14 | return Response.Status.BAD_REQUEST; 15 | } 16 | 17 | @Override 18 | protected String extractMessage(InvalidDataAccessApiUsageException exception) { 19 | 20 | return getInvalidDataApiExceptionParser(exception); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/JsonParseExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import com.fasterxml.jackson.core.JsonParseException; 7 | 8 | /** 9 | * JsonParseExceptionMapper class is used to return exception 10 | * response with HTTP status code, when json parsing exception occurs. 11 | * 12 | * @author Oleksii Zinkevych 13 | * @see javax.ws.rs.ext.ExceptionMapper 14 | */ 15 | @Provider 16 | public class JsonParseExceptionMapper extends BaseExceptionMapper { 17 | 18 | @Override 19 | protected Response.Status getStatus() { 20 | return Response.Status.BAD_REQUEST; 21 | } 22 | 23 | @Override 24 | protected String extractMessage(JsonParseException exception) { 25 | return "Bad json"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/NotAcceptableInvitationExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import com.softserveinc.ita.homeproject.homeservice.exception.NotAcceptableInvitationException; 7 | 8 | 9 | 10 | @Provider 11 | public class NotAcceptableInvitationExceptionMapper 12 | extends BaseInvitationExceptionMapper { 13 | @Override 14 | protected Response.Status getStatus() { 15 | return Response.Status.NOT_ACCEPTABLE; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/NotAcceptableOauthExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import com.softserveinc.ita.homeproject.application.security.exception.NotAcceptableOauthException; 7 | 8 | @Provider 9 | public class NotAcceptableOauthExceptionMapper extends BaseOauthExceptionMapper { 10 | 11 | @Override 12 | protected Response.Status getStatus() { 13 | return Response.Status.NOT_ACCEPTABLE; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/NotFoundHomeExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import com.softserveinc.ita.homeproject.homeservice.exception.NotFoundHomeException; 7 | 8 | /** 9 | * NotFoundExceptionMapper class is used to return exception 10 | * response with HTTP status code, when the element is not found. 11 | * 12 | * @author Ihor Svyrydenko 13 | * @see javax.ws.rs.ext.ExceptionMapper 14 | */ 15 | @Provider 16 | public class NotFoundHomeExceptionMapper extends BaseHomeExceptionMapper { 17 | 18 | @Override 19 | protected Response.Status getStatus() { 20 | return Response.Status.NOT_FOUND; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/PasswordExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import com.softserveinc.ita.homeproject.homeservice.exception.PasswordException; 7 | 8 | 9 | @Provider 10 | public class PasswordExceptionMapper extends BaseHomeExceptionMapper { 11 | 12 | @Override 13 | protected Response.Status getStatus() { 14 | return Response.Status.NOT_ACCEPTABLE; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/PasswordRestorationExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper; 2 | 3 | import javax.ws.rs.core.Response; 4 | import javax.ws.rs.ext.Provider; 5 | 6 | import com.softserveinc.ita.homeproject.homeservice.exception.PasswordRestorationException; 7 | 8 | 9 | @Provider 10 | public class PasswordRestorationExceptionMapper extends BaseHomeExceptionMapper { 11 | 12 | @Override 13 | protected Response.Status getStatus() { 14 | return Response.Status.NOT_ACCEPTABLE; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/jax/BadRequestExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper.jax; 2 | 3 | import static com.softserveinc.ita.homeproject.application.exception.mapper.ExceptionMapperUtils.getBadRequestExceptionMessageParser; 4 | 5 | import javax.ws.rs.core.Response; 6 | import javax.ws.rs.ext.Provider; 7 | 8 | import com.softserveinc.ita.homeproject.application.exception.mapper.BaseExceptionMapper; 9 | import cz.jirutka.rsql.parser.RSQLParserException; 10 | 11 | @Provider 12 | public class BadRequestExceptionMapper extends BaseExceptionMapper { 13 | @Override 14 | protected Response.Status getStatus() { 15 | return Response.Status.BAD_REQUEST; 16 | } 17 | 18 | @Override 19 | protected String extractMessage(RSQLParserException exception) { 20 | return getBadRequestExceptionMessageParser(exception); 21 | } 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/exception/mapper/jax/NotFoundExceptionMapper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.exception.mapper.jax; 2 | 3 | import javax.ws.rs.NotFoundException; 4 | import javax.ws.rs.core.Response; 5 | import javax.ws.rs.ext.Provider; 6 | 7 | import com.softserveinc.ita.homeproject.application.exception.mapper.BaseExceptionMapper; 8 | 9 | @Provider 10 | public class NotFoundExceptionMapper extends BaseExceptionMapper { 11 | @Override 12 | protected Response.Status getStatus() { 13 | return Response.Status.NOT_FOUND; 14 | } 15 | 16 | @Override 17 | protected String extractMessage(NotFoundException exception) { 18 | return exception.getMessage(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/mapper/config/HomeMappingConfig.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.mapper.config; 2 | 3 | import static com.softserveinc.ita.homeproject.homeservice.exception.ExceptionMessages.ILLEGAL_STATE_RESOLVING_TYPE_MESSAGE; 4 | 5 | import org.modelmapper.TypeMap; 6 | import org.springframework.core.GenericTypeResolver; 7 | 8 | 9 | public interface HomeMappingConfig { 10 | void addMappings(TypeMap typeMap); 11 | 12 | @SuppressWarnings("unchecked cast") 13 | default Class getSourceType() { 14 | return (Class) getResolvedClasses()[0]; 15 | } 16 | 17 | @SuppressWarnings("unchecked cast") 18 | default Class getDestinationType() { 19 | return (Class) getResolvedClasses()[1]; 20 | } 21 | 22 | private Class[] getResolvedClasses() { 23 | Class[] typeArguments = GenericTypeResolver.resolveTypeArguments(this.getClass(), HomeMappingConfig.class); 24 | final int expectedTypeArgumentsSize = 2; 25 | if (typeArguments == null || typeArguments.length != expectedTypeArgumentsSize) { 26 | throw new IllegalStateException(ILLEGAL_STATE_RESOLVING_TYPE_MESSAGE); 27 | } 28 | return typeArguments; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/mapper/config/impl/ApartmentInvitationDTOMappingConfig.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.mapper.config.impl; 2 | 3 | import com.softserveinc.ita.homeproject.application.mapper.config.HomeMappingConfig; 4 | import com.softserveinc.ita.homeproject.application.model.CreateApartmentInvitation; 5 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.apartment.ApartmentInvitationDto; 6 | import org.modelmapper.TypeMap; 7 | import org.springframework.stereotype.Component; 8 | 9 | @Component 10 | public class ApartmentInvitationDTOMappingConfig 11 | implements HomeMappingConfig { 12 | 13 | @Override 14 | public void addMappings(TypeMap typeMap) { 15 | typeMap.addMappings(mp -> mp.skip(ApartmentInvitationDto::setId)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/mapper/config/impl/CooperationInvitationDTOMappingConfig.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.mapper.config.impl; 2 | 3 | import com.softserveinc.ita.homeproject.application.mapper.config.HomeMappingConfig; 4 | import com.softserveinc.ita.homeproject.application.model.CreateCooperationInvitation; 5 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.cooperation.CooperationInvitationDto; 6 | import org.modelmapper.TypeMap; 7 | import org.springframework.stereotype.Component; 8 | 9 | @Component 10 | public class CooperationInvitationDTOMappingConfig 11 | implements HomeMappingConfig { 12 | 13 | @Override 14 | public void addMappings(TypeMap typeMap) { 15 | typeMap.addMappings(mp -> mp.skip(CooperationInvitationDto::setId)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/mapper/config/impl/ReadOwnerMappingConfig.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.mapper.config.impl; 2 | 3 | import com.softserveinc.ita.homeproject.application.mapper.config.HomeMappingConfig; 4 | import com.softserveinc.ita.homeproject.application.model.ReadOwnership; 5 | import com.softserveinc.ita.homeproject.homeservice.dto.user.ownership.OwnershipDto; 6 | import lombok.RequiredArgsConstructor; 7 | import org.modelmapper.TypeMap; 8 | import org.springframework.stereotype.Component; 9 | 10 | @Component 11 | @RequiredArgsConstructor 12 | public class ReadOwnerMappingConfig implements HomeMappingConfig { 13 | 14 | @Override 15 | public void addMappings(TypeMap typeMap) { 16 | typeMap.addMapping(OwnershipDto::getUser, ReadOwnership::setOwner); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/mapper/config/impl/UpdatePollMappingConfig.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.mapper.config.impl; 2 | 3 | import com.softserveinc.ita.homeproject.application.mapper.config.HomeMappingConfig; 4 | import com.softserveinc.ita.homeproject.application.model.UpdatePoll; 5 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.PollDto; 6 | import lombok.RequiredArgsConstructor; 7 | import org.modelmapper.TypeMap; 8 | import org.springframework.stereotype.Component; 9 | 10 | @Component 11 | @RequiredArgsConstructor 12 | public class UpdatePollMappingConfig implements HomeMappingConfig { 13 | 14 | @Override 15 | public void addMappings(TypeMap typeMap) { 16 | typeMap.addMapping(UpdatePoll::getIncludedHouses, PollDto::setIncludedHouses); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/security/exception/BaseOauthException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.security.exception; 2 | 3 | public abstract class BaseOauthException extends RuntimeException { 4 | 5 | protected BaseOauthException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/security/exception/NotAcceptableOauthException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.security.exception; 2 | 3 | public class NotAcceptableOauthException extends BaseOauthException { 4 | 5 | public NotAcceptableOauthException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-application/src/main/java/com/softserveinc/ita/homeproject/application/security/service/EntitySpecificationService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.security.service; 2 | 3 | import javax.ws.rs.core.MultivaluedMap; 4 | 5 | import org.springframework.data.jpa.domain.Specification; 6 | 7 | /** 8 | * EntitySpecificationService - service that provides Spring Data Specification 9 | * by query parameters 10 | * 11 | * @author Oleksii Zinkevych 12 | * @param - entity type 13 | * @see org.springframework.data.jpa.domain.Specification 14 | */ 15 | public interface EntitySpecificationService { 16 | /** 17 | * 18 | * @param filter - Map of query and path parameters required to build Specification 19 | * @param search - String filter value in a format according to RSQL documentation 20 | * @param sort - String sort order value in a format according to RSQL documentation 21 | * @return Spring Data Specification 22 | */ 23 | Specification getSpecification(MultivaluedMap filter, String search, String sort); 24 | } 25 | -------------------------------------------------------------------------------- /home-application/src/main/resources/ValidationMessages.properties: -------------------------------------------------------------------------------- 1 | javax.validation.constraints.Null.message=must be null 2 | javax.validation.constraints.NotNull.message=must not be null 3 | javax.validation.constraints.AssertTrue.message=must be true 4 | javax.validation.constraints.AssertFalse.message=must be false 5 | javax.validation.constraints.Min.message=must be greater than or equal to {value} 6 | javax.validation.constraints.Max.message=must be less than or equal to {value} 7 | javax.validation.constraints.Size.message=size must be between {min} and {max} signs 8 | javax.validation.constraints.Digits.message= \ 9 | numeric value out of bounds (<{integer} digits>.<{fraction} digits> expected) 10 | javax.validation.constraints.Past.message=must be a past date 11 | javax.validation.constraints.Future.message=must be a future date 12 | javax.validation.constraints.Pattern.message=must meet the rule 13 | -------------------------------------------------------------------------------- /home-application/src/main/resources/config/application.properties: -------------------------------------------------------------------------------- 1 | management.server.port=${MANAGEMENT_SERVER_PORT:8090} 2 | management.endpoints.web.exposure.include=health,quartz-triggers,quartz-jobs 3 | management.endpoint.health.show-details=always 4 | server.port=${PORT:8080} 5 | spring.jersey.type=filter 6 | spring.liquibase.change-log=classpath:db/changelog/master.xml 7 | spring.liquibase.enabled=${LIQUIBASE_MIGRATION:false} 8 | jwt.token.secret=secret 9 | home.jobs.send-apartment-email.cron=0/5 * * * * ? 10 | home.jobs.send-cooperation-email.cron=0/5 * * * * ? 11 | home.jobs.send-password-restoration-email.cron=0/5 * * * * ? 12 | home.jobs.erase-password-restoration-tokens.cron=0 0 0/5 * * ? 13 | -------------------------------------------------------------------------------- /home-application/src/main/resources/files/template.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-application/src/main/resources/files/template.xlsx -------------------------------------------------------------------------------- /home-application/src/main/resources/static/api/0/apidocs/rapidoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Home Project | REST API Documentation | Rapidoc 8 | 9 | 10 | 11 | 12 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /home-application/src/main/resources/static/api/0/apidocs/redoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home Project | REST API Documentation | Redoc 5 | 6 | 7 | 8 | 9 | 10 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /home-application/src/main/resources/static/api/0/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "project": "${description}", 3 | "version": "${version}", 4 | "build_number": "${buildNumber}", 5 | "build_date": "${timestamp}" 6 | } 7 | -------------------------------------------------------------------------------- /home-application/src/main/resources/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-application/src/main/resources/static/favicon.ico -------------------------------------------------------------------------------- /home-application/src/test/java/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-application/src/test/java/.keep -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/BaseModelDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | public abstract class BaseModelDto { 4 | } 5 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/Container1Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | public class Container1Dto extends ContainerDto { 4 | } 5 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/Container2Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | public class Container2Dto extends ContainerDto { 4 | } 5 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/ContainerDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | public abstract class ContainerDto extends BaseModelDto { 4 | private InnerDto outerField; 5 | 6 | public InnerDto getOuterField() { 7 | return outerField; 8 | } 9 | 10 | public void setOuterField(InnerDto outerField) { 11 | this.outerField = outerField; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/Inner1Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | import java.util.List; 4 | 5 | public class Inner1Dto extends InnerDto { 6 | 7 | private List innerItemList; 8 | 9 | private String onChild1; 10 | 11 | public String getOnChild1() { 12 | return onChild1; 13 | } 14 | 15 | public void setOnChild1(String onChild1) { 16 | this.onChild1 = onChild1; 17 | } 18 | 19 | public List getInnerItemList() { 20 | return innerItemList; 21 | } 22 | 23 | public void setInnerItemList(List innerItemList) { 24 | this.innerItemList = innerItemList; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/Inner2Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | public class Inner2Dto extends InnerDto { 4 | private String onChild2; 5 | 6 | public String getOnChild2() { 7 | return onChild2; 8 | } 9 | 10 | public void setOnChild2(String onChild2) { 11 | this.onChild2 = onChild2; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/InnerDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | public abstract class InnerDto extends BaseModelDto { 4 | private String onParent; 5 | 6 | public void setOnParent(String onParent) { 7 | this.onParent = onParent; 8 | } 9 | 10 | public String getOnParent() { 11 | return onParent; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/InnerItem1Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | public class InnerItem1Dto extends InnerItemDto { 4 | 5 | public Integer amount; 6 | 7 | public Integer getAmount() { 8 | return amount; 9 | } 10 | 11 | public void setAmount(Integer amount) { 12 | this.amount = amount; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/destination/InnerItemDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.destination; 2 | 3 | public abstract class InnerItemDto { 4 | 5 | private String name; 6 | 7 | public String getName() { 8 | return name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/BaseModel.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | public abstract class BaseModel { 4 | } 5 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/ChildContainer1.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | public class ChildContainer1 extends Container { 4 | } 5 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/ChildContainer2.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | public class ChildContainer2 extends Container { 4 | } 5 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/Container.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | public abstract class Container extends BaseModel { 4 | 5 | private Inner outerField; 6 | 7 | public void setOuterField(Inner outerField) { 8 | this.outerField = outerField; 9 | } 10 | 11 | public Inner getOuterField() { 12 | return outerField; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/Inner.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | public abstract class Inner extends BaseModel { 4 | private String onParent; 5 | 6 | public void setOnParent(String onParent) { 7 | this.onParent = onParent; 8 | } 9 | 10 | public String getOnParent() { 11 | return onParent; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/Inner1.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | import java.util.List; 4 | 5 | public class Inner1 extends Inner { 6 | 7 | private List innerItemList; 8 | 9 | private String onChild1; 10 | 11 | public String getOnChild1() { 12 | return onChild1; 13 | } 14 | 15 | public void setOnChild1(String onChild1) { 16 | this.onChild1 = onChild1; 17 | } 18 | 19 | public List getInnerItemList() { 20 | return innerItemList; 21 | } 22 | 23 | public void setInnerItemList(List innerItemList) { 24 | this.innerItemList = innerItemList; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/Inner2.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | public class Inner2 extends Inner { 4 | private String onChild2; 5 | 6 | public String getOnChild2() { 7 | return onChild2; 8 | } 9 | 10 | public void setOnChild2(String onChild2) { 11 | this.onChild2 = onChild2; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/InnerItem.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | public abstract class InnerItem { 4 | 5 | private String name; 6 | 7 | public String getName() { 8 | return name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-application/src/test/java/com/softserveinc/ita/homeproject/application/config/classes/source/InnerItem1.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.application.config.classes.source; 2 | 3 | public class InnerItem1 extends InnerItem { 4 | 5 | public Integer amount; 6 | 7 | public Integer getAmount() { 8 | return amount; 9 | } 10 | 11 | public void setAmount(Integer amount) { 12 | this.amount = amount; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-application/src/test/resources/application-home-application-test.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.driver-class-name=org.h2.Driver 2 | spring.datasource.url=jdbc:h2:mem:db 3 | spring.datasource.username=sa 4 | spring.datasource.password= 5 | spring.jpa.hibernate.ddl-auto=create-drop 6 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect 7 | home.jobs.send-apartment-email.cron=0/5 * * * * ? 8 | home.jobs.send-cooperation-email.cron=0/5 * * * * ? 9 | home.jobs.send-password-restoration-email.cron=0/5 * * * * ? 10 | home.jobs.erase-password-restoration-tokens.cron= 0/5 * * * ? 11 | -------------------------------------------------------------------------------- /home-clients/src/main/java/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-clients/src/main/java/.keep -------------------------------------------------------------------------------- /home-clients/src/test/java/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-clients/src/test/java/.keep -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue121.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue127.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue299.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue313.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | CREATE UNIQUE INDEX apartment_number_key ON apartments (apartment_number, house_id); 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue324.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue334.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue390.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue404.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/0.0.1/Issue471.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /home-data-migration/src/main/resources/db/changelog/master.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /home-data-migration/src/test/java/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-data-migration/src/test/java/.keep -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata; 2 | 3 | import java.io.Serializable; 4 | import javax.persistence.GeneratedValue; 5 | import javax.persistence.GenerationType; 6 | import javax.persistence.Id; 7 | import javax.persistence.MappedSuperclass; 8 | 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | 12 | @Getter 13 | @Setter 14 | @MappedSuperclass 15 | public abstract class BaseEntity implements Serializable { 16 | 17 | @Id 18 | @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence") 19 | private Long id; 20 | } 21 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/CooperationRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation; 2 | 3 | import java.util.Optional; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.cooperation.Cooperation; 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 7 | import org.springframework.data.repository.PagingAndSortingRepository; 8 | import org.springframework.stereotype.Repository; 9 | 10 | @Repository 11 | public interface CooperationRepository 12 | extends PagingAndSortingRepository, JpaSpecificationExecutor { 13 | 14 | Optional findCooperationById(Long id); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/apatment/ApartmentRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.apatment; 2 | 3 | import java.util.Optional; 4 | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 6 | import org.springframework.data.repository.PagingAndSortingRepository; 7 | 8 | 9 | public interface ApartmentRepository extends PagingAndSortingRepository, 10 | JpaSpecificationExecutor { 11 | Apartment findApartmentByApartmentNumber(String apartmentNumber); 12 | 13 | Optional findByApartmentNumberAndHouseId(String apartmentNumber, Long houseId); 14 | } 15 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/house/HouseRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.house; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.cooperation.house.House; 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 7 | import org.springframework.data.repository.PagingAndSortingRepository; 8 | import org.springframework.stereotype.Repository; 9 | 10 | @Repository 11 | public interface HouseRepository extends PagingAndSortingRepository, JpaSpecificationExecutor { 12 | 13 | List findHousesByCooperationId(Long id); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/InvitationRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums.InvitationStatus; 7 | import org.springframework.data.jpa.repository.JpaRepository; 8 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 9 | import org.springframework.stereotype.Repository; 10 | 11 | @Repository 12 | public interface InvitationRepository extends JpaRepository, 13 | JpaSpecificationExecutor { 14 | 15 | Optional findInvitationByRegistrationToken(String token); 16 | 17 | List findAllBySentDatetimeIsNullAndStatusEqualsAndEnabledEquals( 18 | InvitationStatus status, Boolean enabled); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/apartment/ApartmentInvitation.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.apartment; 2 | 3 | import javax.persistence.DiscriminatorValue; 4 | import javax.persistence.Entity; 5 | import javax.persistence.JoinColumn; 6 | import javax.persistence.ManyToOne; 7 | 8 | import com.softserveinc.ita.homeproject.homedata.cooperation.apatment.Apartment; 9 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.Invitation; 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | 13 | @Getter 14 | @Setter 15 | @Entity 16 | @DiscriminatorValue("apartment") 17 | public class ApartmentInvitation extends Invitation { 18 | 19 | @ManyToOne 20 | @JoinColumn(name = "apartment_id") 21 | private Apartment apartment; 22 | } 23 | 24 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/apartment/ApartmentInvitationRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.apartment; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums.InvitationStatus; 6 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums.InvitationType; 7 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 8 | import org.springframework.data.repository.PagingAndSortingRepository; 9 | 10 | 11 | public interface ApartmentInvitationRepository extends PagingAndSortingRepository, 12 | JpaSpecificationExecutor { 13 | 14 | List findAllBySentDatetimeIsNullAndEnabledEqualsAndStatusEqualsAndTypeEquals( 15 | Boolean enabled, 16 | InvitationStatus status, 17 | InvitationType type); 18 | 19 | List findApartmentInvitationsByEmail(String email); 20 | 21 | } 22 | 23 | 24 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/converters/InvitationRoleConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.converters; 2 | 3 | import javax.persistence.AttributeConverter; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.user.role.RoleEnum; 6 | import lombok.RequiredArgsConstructor; 7 | 8 | @RequiredArgsConstructor 9 | public class InvitationRoleConverter implements AttributeConverter { 10 | 11 | @Override 12 | public String convertToDatabaseColumn(RoleEnum attribute) { 13 | return attribute == null ? null : attribute.getName(); 14 | } 15 | 16 | @Override 17 | public RoleEnum convertToEntityAttribute(String dbData) { 18 | if (dbData == null) { 19 | return null; 20 | } else { 21 | try { 22 | return RoleEnum.getEnum(dbData); 23 | } catch (IllegalArgumentException e) { 24 | throw new IllegalArgumentException(dbData + " not supported."); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/converters/InvitationStatusAttributeConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.converters; 2 | 3 | import javax.persistence.AttributeConverter; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums.InvitationStatus; 6 | 7 | public class InvitationStatusAttributeConverter implements AttributeConverter { 8 | @Override 9 | public String convertToDatabaseColumn(InvitationStatus attribute) { 10 | return attribute == null ? null : attribute.getValue(); 11 | } 12 | 13 | @Override 14 | public InvitationStatus convertToEntityAttribute(String dbData) { 15 | if (dbData == null) { 16 | return null; 17 | } else { 18 | try { 19 | return InvitationStatus.getEnum(dbData); 20 | } catch (IllegalArgumentException e) { 21 | throw new IllegalArgumentException(dbData + " not supported."); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/converters/PasswordRecoveryTokenStatusAttributeConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.converters; 2 | 3 | import javax.persistence.AttributeConverter; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.user.password.enums.PasswordRecoveryTokenStatus; 6 | 7 | 8 | public class PasswordRecoveryTokenStatusAttributeConverter 9 | implements AttributeConverter { 10 | 11 | @Override 12 | public String convertToDatabaseColumn(PasswordRecoveryTokenStatus attribute) { 13 | return attribute == null ? null : attribute.getValue(); 14 | } 15 | 16 | @Override 17 | public PasswordRecoveryTokenStatus convertToEntityAttribute(String dbData) { 18 | if (dbData == null) { 19 | return null; 20 | } else { 21 | try { 22 | return PasswordRecoveryTokenStatus.getEnum(dbData); 23 | } catch (IllegalArgumentException e) { 24 | throw new IllegalArgumentException(dbData + " not supported."); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/cooperation/CooperationInvitation.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.cooperation; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Convert; 5 | import javax.persistence.DiscriminatorValue; 6 | import javax.persistence.Entity; 7 | 8 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.Invitation; 9 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.converters.InvitationRoleConverter; 10 | import com.softserveinc.ita.homeproject.homedata.user.role.RoleEnum; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | 14 | 15 | @Getter 16 | @Setter 17 | @Entity 18 | @DiscriminatorValue("cooperation") 19 | public class CooperationInvitation extends Invitation { 20 | 21 | @Column(name = "role") 22 | @Convert(converter = InvitationRoleConverter.class) 23 | private RoleEnum role; 24 | 25 | @Column(name = "cooperation_id") 26 | private Long cooperationId; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/cooperation/CooperationInvitationRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.cooperation; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums.InvitationStatus; 6 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums.InvitationType; 7 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 8 | import org.springframework.data.repository.PagingAndSortingRepository; 9 | 10 | public interface CooperationInvitationRepository extends PagingAndSortingRepository, 11 | JpaSpecificationExecutor { 12 | 13 | List findAllBySentDatetimeIsNullAndStatusEqualsAndEnabledEqualsAndTypeEquals( 14 | InvitationStatus status, Boolean enabled, InvitationType type); 15 | 16 | List findCooperationInvitationsByEmail(String email); 17 | 18 | } 19 | 20 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/enums/InvitationStatus.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums; 2 | 3 | import java.util.Map; 4 | import java.util.function.Function; 5 | import java.util.stream.Collectors; 6 | import java.util.stream.Stream; 7 | 8 | public enum InvitationStatus { 9 | 10 | PENDING("pending"), 11 | 12 | PROCESSING("processing"), 13 | 14 | ACCEPTED("accepted"), 15 | 16 | OVERDUE("overdue"), 17 | 18 | ERROR("error"); 19 | 20 | 21 | private final String value; 22 | 23 | private static final Map STATUSES = Stream.of(InvitationStatus.values()) 24 | .collect(Collectors.toMap(InvitationStatus::getValue, Function.identity())); 25 | 26 | InvitationStatus(String value) { 27 | this.value = value; 28 | } 29 | 30 | @Override 31 | public String toString() { 32 | return String.valueOf(value); 33 | } 34 | 35 | public String getValue() { 36 | return value; 37 | } 38 | 39 | public static InvitationStatus getEnum(String value) { 40 | return STATUSES.get(value); 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/cooperation/invitation/enums/InvitationType.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.cooperation.invitation.enums; 2 | 3 | public enum InvitationType { 4 | 5 | APARTMENT("apartment"), 6 | 7 | COOPERATION("cooperation"); 8 | 9 | private String value; 10 | 11 | InvitationType(String value) { 12 | this.value = value; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return String.valueOf(value); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/general/address/Address.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.general.address; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.SequenceGenerator; 6 | import javax.persistence.Table; 7 | 8 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | 12 | @Getter 13 | @Setter 14 | @Entity 15 | @Table(name = "addresses") 16 | @SequenceGenerator(name = "sequence", sequenceName = "addresses_sequence") 17 | public class Address extends BaseEntity { 18 | 19 | @Column(name = "region") 20 | private String region; 21 | 22 | @Column(name = "city") 23 | private String city; 24 | 25 | @Column(name = "district") 26 | private String district; 27 | 28 | @Column(name = "street") 29 | private String street; 30 | 31 | @Column(name = "house_block") 32 | private String houseBlock; 33 | 34 | @Column(name = "house_number") 35 | private String houseNumber; 36 | 37 | @Column(name = "zip_code") 38 | private String zipCode; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/general/contact/ContactRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.general.contact; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 7 | import org.springframework.data.repository.PagingAndSortingRepository; 8 | import org.springframework.stereotype.Repository; 9 | 10 | @Repository 11 | public interface ContactRepository extends PagingAndSortingRepository, 12 | JpaSpecificationExecutor { 13 | 14 | List findAllByUserIdAndType(Long userId, ContactType type); 15 | 16 | List findAllByCooperationIdAndType(Long cooperationId, ContactType type); 17 | 18 | List findAllByCooperationId(Long cooperationId); 19 | 20 | Optional findByIdAndCooperationId(Long id, Long cooperationId); 21 | 22 | Optional findByIdAndUserId(Long id, Long userId); 23 | } 24 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/general/contact/ContactType.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.general.contact; 2 | 3 | public enum ContactType { 4 | 5 | EMAIL("email"), 6 | 7 | PHONE("phone"); 8 | 9 | private String value; 10 | 11 | ContactType(String value) { 12 | this.value = value; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return String.valueOf(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/general/contact/email/EmailContact.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.general.contact.email; 2 | 3 | import javax.persistence.DiscriminatorValue; 4 | import javax.persistence.Entity; 5 | 6 | import com.softserveinc.ita.homeproject.homedata.general.contact.Contact; 7 | import lombok.Getter; 8 | import lombok.Setter; 9 | 10 | @Getter 11 | @Setter 12 | @Entity 13 | @DiscriminatorValue("email") 14 | public class EmailContact extends Contact { 15 | 16 | private String email; 17 | } 18 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/general/contact/phone/PhoneContact.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.general.contact.phone; 2 | 3 | import javax.persistence.DiscriminatorValue; 4 | import javax.persistence.Entity; 5 | 6 | import com.softserveinc.ita.homeproject.homedata.general.contact.Contact; 7 | import lombok.Getter; 8 | import lombok.Setter; 9 | 10 | @Getter 11 | @Setter 12 | @Entity 13 | @DiscriminatorValue("phone") 14 | public class PhoneContact extends Contact { 15 | 16 | private String phone; 17 | } 18 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/general/news/News.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.general.news; 2 | 3 | import java.time.LocalDateTime; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.SequenceGenerator; 7 | 8 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | 12 | @Getter 13 | @Setter 14 | @Entity 15 | @SequenceGenerator(name = "sequence", sequenceName = "news_sequence") 16 | public class News extends BaseEntity { 17 | 18 | @Column(name = "create_date") 19 | private LocalDateTime createDate; 20 | 21 | @Column(name = "update_date") 22 | private LocalDateTime updateDate; 23 | 24 | @Column(name = "title") 25 | private String title; 26 | 27 | @Column(name = "text") 28 | private String text; 29 | 30 | @Column(name = "description") 31 | private String description; 32 | 33 | @Column(name = "photo_url") 34 | private String photoUrl; 35 | 36 | @Column(name = "source") 37 | private String source; 38 | 39 | @Column(name = "enabled") 40 | private Boolean enabled; 41 | } 42 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/general/news/NewsRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.general.news; 2 | 3 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 4 | import org.springframework.data.repository.PagingAndSortingRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * NewsRepository is the interface that is needed 9 | * for interaction with News in the database. 10 | * 11 | * @author Ihor Svyrydenko 12 | */ 13 | 14 | @Repository 15 | public interface NewsRepository extends PagingAndSortingRepository, JpaSpecificationExecutor { 16 | } 17 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/PollRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll; 2 | 3 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 4 | import org.springframework.data.repository.PagingAndSortingRepository; 5 | 6 | public interface PollRepository extends PagingAndSortingRepository, 7 | JpaSpecificationExecutor { 8 | } 9 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/converters/PollStatusAttributeConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.converters; 2 | 3 | import javax.persistence.AttributeConverter; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.poll.enums.PollStatus; 6 | 7 | public class PollStatusAttributeConverter implements AttributeConverter { 8 | @Override 9 | public String convertToDatabaseColumn(PollStatus attribute) { 10 | if (attribute == null) { 11 | return null; 12 | } else { 13 | return attribute.name(); 14 | } 15 | } 16 | 17 | @Override 18 | public PollStatus convertToEntityAttribute(String dbData) { 19 | if (dbData == null) { 20 | return null; 21 | } else { 22 | try { 23 | return PollStatus.valueOf(dbData); 24 | } catch (IllegalArgumentException e) { 25 | throw new IllegalArgumentException(dbData + " not supported."); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/converters/PollTypeAttributeConverter.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.converters; 2 | 3 | import javax.persistence.AttributeConverter; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.poll.enums.PollType; 6 | 7 | public class PollTypeAttributeConverter implements AttributeConverter { 8 | @Override 9 | public String convertToDatabaseColumn(PollType attribute) { 10 | if (attribute == null) { 11 | return null; 12 | } else { 13 | return attribute.name(); 14 | } 15 | } 16 | 17 | @Override 18 | public PollType convertToEntityAttribute(String dbData) { 19 | if (dbData == null) { 20 | return null; 21 | } else { 22 | try { 23 | return PollType.valueOf(dbData); 24 | } catch (IllegalArgumentException e) { 25 | throw new IllegalArgumentException(dbData + " not supported."); 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/enums/PollQuestionType.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.enums; 2 | 3 | public enum PollQuestionType { 4 | 5 | ADVICE("advice"), 6 | 7 | MULTIPLE_CHOICE("multiple_choice"), 8 | 9 | DOUBLE_CHOICE("double_choice"); 10 | 11 | private String value; 12 | 13 | PollQuestionType(String value) { 14 | this.value = value; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return String.valueOf(value); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/enums/PollStatus.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.enums; 2 | 3 | public enum PollStatus { 4 | 5 | DRAFT("draft"), 6 | 7 | ACTIVE("active"), 8 | 9 | COMPLETED("completed"), 10 | 11 | SUSPENDED("suspended"); 12 | 13 | private final String value; 14 | 15 | PollStatus(String value) { 16 | this.value = value; 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return String.valueOf(value); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/enums/PollType.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.enums; 2 | 3 | public enum PollType { 4 | SIMPLE("simple"), 5 | 6 | MAJOR("major"); 7 | 8 | private final String value; 9 | 10 | PollType(String value) { 11 | this.value = value; 12 | } 13 | 14 | @Override 15 | public String toString() { 16 | return String.valueOf(value); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/question/AdviceChoiceQuestion.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.question; 2 | 3 | import javax.persistence.DiscriminatorValue; 4 | import javax.persistence.Entity; 5 | 6 | import com.softserveinc.ita.homeproject.homedata.poll.question.PollQuestion; 7 | import lombok.Getter; 8 | import lombok.Setter; 9 | 10 | @Getter 11 | @Setter 12 | @Entity 13 | @DiscriminatorValue("advice") 14 | public class AdviceChoiceQuestion extends PollQuestion { 15 | } 16 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/question/AnswerVariant.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.question; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.JoinColumn; 6 | import javax.persistence.ManyToOne; 7 | import javax.persistence.SequenceGenerator; 8 | import javax.persistence.Table; 9 | 10 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | 14 | @Getter 15 | @Setter 16 | @Entity 17 | @Table(name = "answer_variants") 18 | @SequenceGenerator(name = "sequence", sequenceName = "answer_variants_sequence") 19 | public class AnswerVariant extends BaseEntity { 20 | 21 | @Column(name = "answer") 22 | private String answer; 23 | 24 | @ManyToOne 25 | @JoinColumn(name = "poll_question_id") 26 | private PollQuestion question; 27 | } 28 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/question/AnswerVariantRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.question; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.stereotype.Repository; 8 | 9 | /** 10 | * AnswerVariantRepository is the interface that is needed 11 | * for interaction with AnswerVariants in the database. 12 | * 13 | * @author Ihor Samoshost 14 | */ 15 | @Repository 16 | public interface AnswerVariantRepository extends JpaRepository { 17 | List findAllByQuestion(PollQuestion question); 18 | 19 | Optional findByQuestionAndAnswer(PollQuestion pollQuestion, String answer); 20 | } 21 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/question/DoubleChoiceQuestion.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.question; 2 | 3 | import javax.persistence.DiscriminatorValue; 4 | import javax.persistence.Entity; 5 | 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter 10 | @Setter 11 | @Entity 12 | @DiscriminatorValue("double_choice") 13 | public class DoubleChoiceQuestion extends MultipleChoiceQuestion{ 14 | } 15 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/question/MultipleChoiceQuestion.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.question; 2 | 3 | import java.util.List; 4 | import javax.persistence.CascadeType; 5 | import javax.persistence.Column; 6 | import javax.persistence.DiscriminatorValue; 7 | import javax.persistence.Entity; 8 | import javax.persistence.OneToMany; 9 | 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | 13 | @Getter 14 | @Setter 15 | @Entity 16 | @DiscriminatorValue("multiple_choice") 17 | public class MultipleChoiceQuestion extends PollQuestion { 18 | 19 | @Column(name = "max_answer_count") 20 | private Integer maxAnswerCount; 21 | 22 | @OneToMany(mappedBy = "question", cascade = CascadeType.PERSIST) 23 | private List answerVariants; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/question/PollQuestionRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.question; 2 | 3 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 4 | import org.springframework.data.repository.PagingAndSortingRepository; 5 | 6 | public interface PollQuestionRepository extends PagingAndSortingRepository, 7 | JpaSpecificationExecutor { 8 | 9 | } 10 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/results/ResultQuestion.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.results; 2 | 3 | import javax.persistence.Column; 4 | import javax.persistence.Entity; 5 | import javax.persistence.JoinColumn; 6 | import javax.persistence.ManyToOne; 7 | import javax.persistence.OneToOne; 8 | import javax.persistence.SequenceGenerator; 9 | import javax.persistence.Table; 10 | 11 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 12 | import com.softserveinc.ita.homeproject.homedata.poll.Poll; 13 | import com.softserveinc.ita.homeproject.homedata.poll.question.AnswerVariant; 14 | import lombok.Getter; 15 | import lombok.Setter; 16 | 17 | 18 | @Getter 19 | @Setter 20 | @Entity 21 | @Table(name = "result_questions") 22 | @SequenceGenerator(name = "sequence", sequenceName = "result_questions_sequence") 23 | public class ResultQuestion extends BaseEntity { 24 | 25 | @OneToOne 26 | @JoinColumn(name = "answer_variant_id") 27 | private AnswerVariant answerVariant; 28 | 29 | @ManyToOne 30 | @JoinColumn(name = "poll_id") 31 | private Poll poll; 32 | 33 | @Column(name = "vote_count") 34 | private int voteCount; 35 | 36 | @Column(name = "percent_votes") 37 | private String percentVotes; 38 | } 39 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/results/ResultQuestionRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.results; 2 | 3 | 4 | import java.util.Collection; 5 | 6 | import com.softserveinc.ita.homeproject.homedata.poll.Poll; 7 | import org.springframework.data.jpa.repository.JpaRepository; 8 | import org.springframework.stereotype.Repository; 9 | 10 | @Repository 11 | public interface ResultQuestionRepository extends JpaRepository { 12 | Collection findAllByPoll(Poll poll); 13 | } 14 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/votes/VoteAnswerVariant.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.votes; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.JoinColumn; 5 | import javax.persistence.ManyToOne; 6 | import javax.persistence.SequenceGenerator; 7 | import javax.persistence.Table; 8 | 9 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 10 | import com.softserveinc.ita.homeproject.homedata.poll.question.AnswerVariant; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | 14 | 15 | @Getter 16 | @Setter 17 | @Entity 18 | @Table(name = "votes_answer_variants") 19 | @SequenceGenerator(name = "sequence", sequenceName = "votes_answer_variants_sequence") 20 | public class VoteAnswerVariant extends BaseEntity { 21 | 22 | @ManyToOne 23 | @JoinColumn(name = "vote_id") 24 | private Vote vote; 25 | 26 | @ManyToOne 27 | @JoinColumn(name = "answer_variant_id", nullable = false) 28 | private AnswerVariant answerVariant; 29 | } 30 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/votes/VoteAnswerVariantRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.votes; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | 5 | public interface VoteAnswerVariantRepository extends JpaRepository { 6 | } 7 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/poll/votes/VoteRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.poll.votes; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.poll.Poll; 6 | import com.softserveinc.ita.homeproject.homedata.user.User; 7 | import org.springframework.data.repository.PagingAndSortingRepository; 8 | import org.springframework.stereotype.Repository; 9 | 10 | /** 11 | * VoteRepository is the interface that is needed 12 | * for interaction with Votes in the database. 13 | * 14 | * @author Ihor Samoshost 15 | */ 16 | @Repository 17 | public interface VoteRepository extends PagingAndSortingRepository { 18 | Vote findByPollIdAndUser(Long pollId, User user); 19 | 20 | List findAllByPoll(Poll poll); 21 | } 22 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/UserCooperation.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user; 2 | 3 | import javax.persistence.Entity; 4 | import javax.persistence.JoinColumn; 5 | import javax.persistence.ManyToOne; 6 | import javax.persistence.SequenceGenerator; 7 | import javax.persistence.Table; 8 | 9 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 10 | import com.softserveinc.ita.homeproject.homedata.cooperation.Cooperation; 11 | import com.softserveinc.ita.homeproject.homedata.user.role.Role; 12 | import lombok.Getter; 13 | import lombok.Setter; 14 | 15 | @Getter 16 | @Setter 17 | @Entity 18 | @Table(name = "user_cooperation") 19 | @SequenceGenerator(name = "sequence", sequenceName = "user_cooperation_sequence") 20 | public class UserCooperation extends BaseEntity { 21 | 22 | @ManyToOne 23 | @JoinColumn(name = "user_id") 24 | private User user; 25 | 26 | @ManyToOne 27 | @JoinColumn(name = "cooperation_id") 28 | private Cooperation cooperation; 29 | 30 | @ManyToOne 31 | @JoinColumn(name = "role_id") 32 | private Role role; 33 | } 34 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/UserCooperationRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.user.User; 6 | import com.softserveinc.ita.homeproject.homedata.user.UserCooperation; 7 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 8 | import org.springframework.data.querydsl.QuerydslPredicateExecutor; 9 | import org.springframework.data.repository.PagingAndSortingRepository; 10 | import org.springframework.stereotype.Repository; 11 | 12 | @Repository 13 | public interface UserCooperationRepository extends PagingAndSortingRepository, 14 | JpaSpecificationExecutor, QuerydslPredicateExecutor { 15 | 16 | List findUserCooperationByUser(User user); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/UserCredentials.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user; 2 | 3 | 4 | import javax.persistence.Entity; 5 | import javax.persistence.Id; 6 | import javax.persistence.Table; 7 | 8 | import lombok.AllArgsConstructor; 9 | import lombok.Getter; 10 | import lombok.NoArgsConstructor; 11 | import lombok.Setter; 12 | 13 | @Entity 14 | @Getter 15 | @Setter 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | @Table(name = "user_credentials") 19 | public class UserCredentials { 20 | @Id 21 | private Long id; 22 | 23 | private String email; 24 | 25 | private String password; 26 | 27 | private Boolean enabled; 28 | } 29 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/UserCredentialsRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user; 2 | 3 | import java.util.Optional; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | @Repository 9 | public interface UserCredentialsRepository extends JpaRepository { 10 | 11 | Optional findByEmail(String email); 12 | } 13 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user; 2 | 3 | import java.util.Optional; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 8 | import org.springframework.data.repository.PagingAndSortingRepository; 9 | import org.springframework.stereotype.Repository; 10 | 11 | /** 12 | * UserRepository is the interface that is needed 13 | * for interaction with Users in the database. 14 | * 15 | * @author Mykyta Morar 16 | */ 17 | @Repository 18 | public interface UserRepository extends PagingAndSortingRepository, JpaSpecificationExecutor { 19 | 20 | /** 21 | * Method for finding users in database by email 22 | * 23 | * @param email is the email of the user that is being searched 24 | * @return an instance of Optional(User) class 25 | */ 26 | Optional findByEmail(String email); 27 | 28 | Page findAllByEnabledTrue(Pageable var1); 29 | 30 | Optional findByEmailAndPassword(String email, String password); 31 | } 32 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/UserSession.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user; 2 | 3 | import java.time.LocalDateTime; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.SequenceGenerator; 7 | import javax.persistence.Table; 8 | 9 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | 13 | @Getter 14 | @Setter 15 | @Entity 16 | @Table(name = "user_tokens") 17 | @SequenceGenerator(name = "sequence", sequenceName="user_tokens_sequence") 18 | public class UserSession extends BaseEntity { 19 | 20 | @Column(name = "user_id") 21 | private Long userId; 22 | 23 | @Column(name = "access_token") 24 | private String accessToken; 25 | 26 | @Column(name = "refresh_token") 27 | private String refreshToken; 28 | 29 | @Column(name = "expire_date") 30 | private LocalDateTime expireDate; 31 | } 32 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/UserSessionRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface UserSessionRepository extends JpaRepository { 11 | 12 | boolean existsUserSessionByAccessToken(String accessToken); 13 | 14 | void deleteByAccessToken(String accessToken); 15 | 16 | void deleteByUserId(Long userId); 17 | 18 | List findAllByUserId(Long userId); 19 | 20 | Optional findByRefreshToken(String refreshToken); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/ownership/OwnershipRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user.ownership; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 6 | import org.springframework.data.repository.PagingAndSortingRepository; 7 | import org.springframework.stereotype.Repository; 8 | 9 | @Repository 10 | public interface OwnershipRepository extends PagingAndSortingRepository, 11 | JpaSpecificationExecutor { 12 | 13 | List findAllByApartmentId(Long apartmentId); 14 | } 15 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/password/enums/PasswordRecoveryTokenStatus.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user.password.enums; 2 | 3 | import java.util.Map; 4 | import java.util.function.Function; 5 | import java.util.stream.Collectors; 6 | import java.util.stream.Stream; 7 | 8 | import lombok.Getter; 9 | 10 | 11 | @Getter 12 | public enum PasswordRecoveryTokenStatus { 13 | 14 | PENDING("pending"), 15 | 16 | ACTIVE("active"), 17 | 18 | EXPIRED("expired"); 19 | 20 | private final String value; 21 | 22 | private static final Map STATUSES = 23 | Stream.of(PasswordRecoveryTokenStatus.values()) 24 | .collect(Collectors.toMap(PasswordRecoveryTokenStatus::getValue, Function.identity())); 25 | 26 | PasswordRecoveryTokenStatus(String value) { 27 | this.value = value; 28 | } 29 | 30 | public static PasswordRecoveryTokenStatus getEnum(String value) { 31 | return STATUSES.get(value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/permission/Permission.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user.permission; 2 | 3 | import java.util.List; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.ManyToMany; 7 | import javax.persistence.SequenceGenerator; 8 | import javax.persistence.Table; 9 | 10 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 11 | import com.softserveinc.ita.homeproject.homedata.user.role.Role; 12 | import lombok.Getter; 13 | import lombok.Setter; 14 | 15 | @Getter 16 | @Setter 17 | @Entity 18 | @Table(name = "permissions") 19 | @SequenceGenerator(name = "sequence", sequenceName = "permissions_sequence") 20 | public class Permission extends BaseEntity { 21 | 22 | @ManyToMany(mappedBy = "permissions") 23 | private List roles; 24 | 25 | @Column(name = "name") 26 | private String name; 27 | } 28 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/permission/PermissionRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user.permission; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.user.permission.Permission; 4 | import org.springframework.data.repository.CrudRepository; 5 | import org.springframework.stereotype.Repository; 6 | 7 | /** 8 | * PermissionRepository is the interface that 9 | * is needed for interaction with Permissions 10 | * in the database. 11 | * 12 | * @author Mykyta Morar 13 | */ 14 | @Repository 15 | public interface PermissionRepository extends CrudRepository { 16 | } 17 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/role/Role.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user.role; 2 | 3 | import java.util.List; 4 | import javax.persistence.Column; 5 | import javax.persistence.Entity; 6 | import javax.persistence.JoinColumn; 7 | import javax.persistence.JoinTable; 8 | import javax.persistence.ManyToMany; 9 | import javax.persistence.SequenceGenerator; 10 | import javax.persistence.Table; 11 | 12 | import com.softserveinc.ita.homeproject.homedata.BaseEntity; 13 | import com.softserveinc.ita.homeproject.homedata.user.permission.Permission; 14 | import lombok.Getter; 15 | import lombok.Setter; 16 | 17 | @Getter 18 | @Setter 19 | @Entity 20 | @Table(name = "roles") 21 | @SequenceGenerator(name = "sequence", sequenceName = "roles_sequence") 22 | public class Role extends BaseEntity { 23 | 24 | @ManyToMany 25 | @JoinTable(name = "role_permissions", 26 | joinColumns = @JoinColumn(name = "role_id"), 27 | inverseJoinColumns = @JoinColumn(name = "permission_id") 28 | ) 29 | private List permissions; 30 | 31 | @Column(name = "name") 32 | private String name; 33 | } 34 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/role/RoleEnum.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user.role; 2 | 3 | import java.util.Map; 4 | import java.util.function.Function; 5 | import java.util.stream.Collectors; 6 | import java.util.stream.Stream; 7 | 8 | public enum RoleEnum { 9 | 10 | ADMIN("admin"), 11 | USER("user"), 12 | OWNER("owner"), 13 | COOPERATION_ADMIN("cooperation_admin"); 14 | 15 | 16 | private static final Map ROLES = Stream.of(RoleEnum.values()) 17 | .collect(Collectors.toMap(RoleEnum::getName, Function.identity())); 18 | 19 | private final String name; 20 | 21 | RoleEnum(String name) { 22 | this.name = name; 23 | } 24 | 25 | public String getName() { 26 | return name; 27 | } 28 | 29 | public static RoleEnum getEnum(String value) { 30 | return ROLES.get(value); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /home-data/src/main/java/com/softserveinc/ita/homeproject/homedata/user/role/RoleRepository.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homedata.user.role; 2 | 3 | import java.util.Optional; 4 | 5 | import org.springframework.data.repository.CrudRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | /** 9 | * RoleRepository is the interface that is needed 10 | * for interaction with Roles in the database. 11 | * 12 | * @author Mykyta Morar 13 | */ 14 | @Repository 15 | public interface RoleRepository extends CrudRepository { 16 | 17 | /** 18 | * Method for finding roles in database by name 19 | * 20 | * @param name is the name of the role 21 | * @return an instance of Role class 22 | */ 23 | Optional findByName(String name); 24 | } 25 | -------------------------------------------------------------------------------- /home-data/src/main/resources/application-home-data.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=${DATASOURCE_URL:jdbc:postgresql://localhost:5433/postgres} 2 | spring.datasource.username=${DATASOURCE_USER:postgres} 3 | spring.datasource.password=${DATASOURCE_PASSWORD:password} 4 | spring.datasource.driver-class-name=org.postgresql.Driver 5 | spring.jpa.hibernate.ddl-auto=validate 6 | -------------------------------------------------------------------------------- /home-data/src/test/java/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-data/src/test/java/.keep -------------------------------------------------------------------------------- /home-docs/developer-checks.md: -------------------------------------------------------------------------------- 1 | ## LINKS YOU SHOULD CHECK BEFORE PULL REQUEST 2 | 3 | ### API DOC 4 | - http://localhost:8080/api/0/apidocs/index.html 5 | 6 | ### HEALTH CHECK 7 | - http://localhost:8090/actuator/health -------------------------------------------------------------------------------- /home-docs/home-api-tests.md: -------------------------------------------------------------------------------- 1 | # How to run home-api-tests module guide. 2 | 3 | There are several options on how to run home-api-tests. 4 | 5 | - Use terminal command 'mvn clean install' with api-tests and api-tests-infrastructure profiles. 6 | Also path database and application admin-user credentials. 7 | Terminal command should look like this: 8 | 9 | `mvn clean install 10 | -Pjacoco 11 | -Papi-tests-infrastructure 12 | -Papi-tests 13 | -Dpostgres.user={your main postgres superuser} 14 | -Dpostgres.password={your postgres superuser password} 15 | -Dhome.application.admin.username={your application admin username} 16 | -Dhome.application.admin.password={your application admin password} 17 | -Dapi.tests.verbose.logging=false` 18 | 19 | 20 | - Run home-application, add mentioned above variables to your Junit template VM options, 21 | 22 | as well as your home-application external port. 23 | This will allow to run each test separately. 24 | Don't forget to run home-data-migration after making database schema changes. 25 | Junit template VM options should look like this: 26 | 27 | ` 28 | -Dhome.application.external.port={your home-application external port} 29 | -Dpostgres.user={your postgres superuser} 30 | -Dpostgres.password={your postgres superuser password} 31 | -Dmailhog.external.port={your mailhog port}` -------------------------------------------------------------------------------- /home-docs/project-description.md: -------------------------------------------------------------------------------- 1 | ## About the HOME project 2 | Home project uses design-first development approach. 3 | That means that we stick to the OpenApi 3.0 specification. 4 | To simplify, get rid of boilerplate code and speed up the development of the server (and client) side, project uses OpenAPI Generator Maven plugin. 5 | ModelMapper is also used to generate converters for DTOs. 6 | To run code generation you simply can build the application with Maven command `mvn clean install`. 7 | Controllers, DTOs and converters will be generated after that. 8 | 9 | ### Continuous integration and deployment 10 | Project uses GitHub actions for CI. 11 | Each commit in Pull Request is checked by CI using `mvn clean install`. 12 | Merging in the `dev` branch provokes CI to build artifacts, then updated `dev` is deployed to Heroku. 13 | 14 | 15 | ## Technologies and tools used in the project 16 | - Java 11 17 | - Maven 18 | - JAX-RS 19 | - Spring Boot 20 | - PostgreSQL 21 | - GitHub Actions 22 | - Heroku 23 | - Docker 24 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/HomeOauthServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.domain.EntityScan; 6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; 7 | import org.springframework.context.annotation.PropertySource; 8 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 9 | 10 | @SpringBootApplication(exclude = {SecurityAutoConfiguration.class}) 11 | @PropertySource("classpath:application-home-oauth-server.properties") 12 | @EntityScan(basePackages = "com.softserveinc.ita.homeproject.homedata") 13 | @EnableJpaRepositories(basePackages = "com.softserveinc.ita.homeproject.homedata") 14 | 15 | public class HomeOauthServerApplication { 16 | 17 | public static void main(String[] args) { 18 | SpringApplication.run(HomeOauthServerApplication.class, args); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/dto/AccessTokenDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public class AccessTokenDto { 9 | 10 | private String accessToken; 11 | } 12 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/dto/CreateTokenDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public class CreateTokenDto { 9 | 10 | private String accessToken; 11 | 12 | private String refreshToken; 13 | } 14 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/dto/RefreshTokenDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public class RefreshTokenDto { 9 | 10 | private String refreshToken; 11 | } 12 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/dto/UserCredentialsDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public class UserCredentialsDto { 9 | private String email; 10 | 11 | private String password; 12 | } 13 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/exception/BaseOauthException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver.exception; 2 | 3 | public class BaseOauthException extends RuntimeException { 4 | 5 | protected BaseOauthException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/exception/NotAcceptableOauthException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver.exception; 2 | 3 | public class NotAcceptableOauthException extends BaseOauthException { 4 | 5 | public NotAcceptableOauthException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/exception/NotFoundOauthException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver.exception; 2 | 3 | public class NotFoundOauthException extends BaseOauthException { 4 | 5 | public NotFoundOauthException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/java/com/softserveinc/ita/homeproject/homeoauthserver/service/OauthService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeoauthserver.service; 2 | 3 | import com.softserveinc.ita.homeproject.homeoauthserver.dto.AccessTokenDto; 4 | import com.softserveinc.ita.homeproject.homeoauthserver.dto.CreateTokenDto; 5 | import com.softserveinc.ita.homeproject.homeoauthserver.dto.RefreshTokenDto; 6 | import com.softserveinc.ita.homeproject.homeoauthserver.dto.UserCredentialsDto; 7 | 8 | public interface OauthService { 9 | 10 | CreateTokenDto generateToken(UserCredentialsDto userCredentialsDto); 11 | 12 | AccessTokenDto updateToken(RefreshTokenDto refreshTokenDto); 13 | } 14 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/resources/application-home-oauth-server.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=${DATASOURCE_URL:jdbc:postgresql://localhost:5433/postgres} 2 | spring.datasource.username=${DATASOURCE_USER:postgres} 3 | spring.datasource.password=${DATASOURCE_PASSWORD:password} 4 | spring.datasource.driver-class-name=org.postgresql.Driver 5 | spring.jpa.hibernate.ddl-auto=validate 6 | 7 | server.port=${PORT:9000} 8 | 9 | jwt.secret=secret 10 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/resources/static/api/0/oauth2/rapidoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Home OAuth 2.0 Server | REST API Documentation | Rapidoc 8 | 9 | 10 | 11 | 12 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/resources/static/api/0/oauth2/redoc/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Home OAuth 2.0 Server | REST API Documentation | Redoc 5 | 6 | 7 | 8 | 9 | 10 | 13 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/resources/static/api/0/oauth2/version.json: -------------------------------------------------------------------------------- 1 | { 2 | "project": "${description}", 3 | "version": "${version}", 4 | "build_number": "${buildNumber}", 5 | "build_date": "${timestamp}" 6 | } 7 | -------------------------------------------------------------------------------- /home-oauth-server/src/main/resources/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-oauth-server/src/main/resources/static/favicon.ico -------------------------------------------------------------------------------- /home-oauth-server/src/test/resources/application-home-oauth-server-test.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.driver-class-name=org.h2.Driver 2 | spring.datasource.url=jdbc:h2:mem:db 3 | spring.datasource.username=sa 4 | spring.datasource.password= 5 | spring.jpa.hibernate.ddl-auto=create-drop 6 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect 7 | 8 | jwt.secret=secret 9 | -------------------------------------------------------------------------------- /home-open-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | 8 | home 9 | com.softserveinc.ita.homeproject 10 | ${revision} 11 | 12 | 13 | jar 14 | home-open-api 15 | 16 | 17 | 18 | 19 | io.swagger.codegen.v3 20 | swagger-codegen-maven-plugin 21 | 22 | 23 | org.openapitools.openapistylevalidator 24 | openapi-style-validator-maven-plugin 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /home-open-api/src/main/java/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-open-api/src/main/java/.keep -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/models/address.yaml: -------------------------------------------------------------------------------- 1 | Address: 2 | type: object 3 | properties: 4 | region: 5 | type: string 6 | example: "Dnipropetrovsk region" 7 | minLength: 1 8 | maxLength: 50 9 | city: 10 | type: string 11 | example: "Dnipro" 12 | minLength: 1 13 | maxLength: 50 14 | district: 15 | type: string 16 | example: "Zavodskoy" 17 | minLength: 1 18 | maxLength: 50 19 | street: 20 | type: string 21 | example: "Kirova" 22 | minLength: 1 23 | maxLength: 25 24 | house_block: 25 | type: string 26 | example: "2/B" 27 | minLength: 1 28 | maxLength: 10 29 | house_number: 30 | type: string 31 | example: "23-B" 32 | minLength: 1 33 | maxLength: 10 34 | zip_code: 35 | type: string 36 | example: "52956" 37 | -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/models/answer.yaml: -------------------------------------------------------------------------------- 1 | ReadAnswerVariant: 2 | allOf: 3 | - $ref: 'common.yaml#/BaseReadView' 4 | type: object 5 | properties: 6 | answer: 7 | type: string 8 | minLength: 1 9 | maxLength: 255 10 | example: "Green" 11 | CreateUpdateAnswerVariant: 12 | type: object 13 | required: 14 | - answer 15 | properties: 16 | answer: 17 | type: string 18 | minLength: 1 19 | maxLength: 255 20 | example: "Green" 21 | AnswerVariantLookup: 22 | type: object 23 | properties: 24 | id: 25 | type: integer 26 | format: int64 27 | example: 1 28 | -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/models/owner.yaml: -------------------------------------------------------------------------------- 1 | ReadOwner: 2 | allOf: 3 | - $ref: 'common.yaml#/BaseReadView' 4 | type: object 5 | properties: 6 | first_name: 7 | type: string 8 | example: "Petro" 9 | middle_name: 10 | type: string 11 | example: "Petrovich" 12 | last_name: 13 | type: string 14 | example: "Petrov" 15 | contacts: 16 | type: array 17 | example: [ 18 | { "id": 1, 19 | "type": "email", 20 | "main": false, 21 | "email": "readUserEmail@example.com" 22 | } 23 | ] 24 | items: 25 | $ref: 'contact.yaml#/ReadContact' 26 | -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/models/ownership.yaml: -------------------------------------------------------------------------------- 1 | ReadOwnership: 2 | allOf: 3 | - $ref: 'common.yaml#/BaseReadView' 4 | type: object 5 | properties: 6 | owner: 7 | $ref: 'owner.yaml#/ReadOwner' 8 | ownership_part: 9 | type: string 10 | minimum: 0.0001 11 | maximum: 1.0 12 | multipleOf: 1e-4 13 | example: 0.6588 14 | UpdateOwnership: 15 | type: object 16 | required: 17 | - ownership_part 18 | properties: 19 | ownership_part: 20 | type: string 21 | minimum: 0.0001 22 | maximum: 1.0 23 | multipleOf: 1e-4 24 | example: 0.6588 25 | -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/models/passwordRestoration.yaml: -------------------------------------------------------------------------------- 1 | PasswordRestorationRequest: 2 | description: User's email to send restoration approval message as a payload 3 | type: object 4 | required: 5 | - email 6 | properties: 7 | email: 8 | type: string 9 | example: "mailbox@example.com" 10 | 11 | 12 | PasswordRestorationApproval: 13 | description: User's email to send restoration approval message 14 | type: object 15 | required: 16 | - email 17 | - token 18 | - new_password 19 | - password_confirmation 20 | properties: 21 | email: 22 | type: string 23 | example: "mailbox@example.com" 24 | token: 25 | type: string 26 | example: "2cf3efb9-fbb1-11ec-b75b-df6ce2a0c19a" 27 | new_password: 28 | type: string 29 | example: "newStrongPassw0rd" 30 | password_confirmation: 31 | type: string 32 | example: "newStrongPassw0rd" 33 | -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/paths/currentUser.yaml: -------------------------------------------------------------------------------- 1 | current-user: 2 | get: 3 | tags: 4 | - current user 5 | summary: Return current User 6 | description: Retrieves the current logged User. 7 | operationId: getCurrentUser 8 | responses: 9 | 200: 10 | $ref: '../responses/responses.yaml#/UserResponse' 11 | 400: 12 | $ref: '../responses/responses.yaml#/BadRequest' 13 | 401: 14 | $ref: '../responses/responses.yaml#/Unauthorized' 15 | 404: 16 | $ref: '../responses/responses.yaml#/NotFound' 17 | default: 18 | $ref: '../responses/responses.yaml#/InternalServerError' 19 | -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/paths/logout.yaml: -------------------------------------------------------------------------------- 1 | logout: 2 | post: 3 | tags: 4 | - logout 5 | summary: Logout from current device 6 | description: Logout from current device 7 | operationId: logout 8 | responses: 9 | 200: 10 | $ref: '../responses/responses.yaml#/NoContentResponse' 11 | 400: 12 | $ref: '../responses/responses.yaml#/BadRequest' 13 | 401: 14 | $ref: '../responses/responses.yaml#/Unauthorized' 15 | 404: 16 | $ref: '../responses/responses.yaml#/NotFound' 17 | default: 18 | $ref: '../responses/responses.yaml#/InternalServerError' 19 | 20 | logout-all: 21 | post: 22 | tags: 23 | - logout 24 | summary: Logout from all devices 25 | description: Logout from all devices 26 | operationId: logoutAll 27 | responses: 28 | 200: 29 | $ref: '../responses/responses.yaml#/NoContentResponse' 30 | 400: 31 | $ref: '../responses/responses.yaml#/BadRequest' 32 | 401: 33 | $ref: '../responses/responses.yaml#/Unauthorized' 34 | 404: 35 | $ref: '../responses/responses.yaml#/NotFound' 36 | default: 37 | $ref: '../responses/responses.yaml#/InternalServerError' 38 | -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/paths/pollsVotes.yaml: -------------------------------------------------------------------------------- 1 | polls-votes: 2 | post: 3 | tags: 4 | - poll vote 5 | summary: Create vote 6 | description: Create a vote in poll. Vote can be created only if poll status is active. 7 | Number of answers must be validated according to max_answer_count of the question 8 | operationId: createVote 9 | parameters: 10 | - $ref: '../parameters/parameters.yaml#/p_poll_id' 11 | requestBody: 12 | $ref: '../requests/requestBodies.yaml#/CreateVoteBody' 13 | responses: 14 | '201': 15 | $ref: '../responses/responses.yaml#/VoteResponse' 16 | '400': 17 | $ref: '../responses/responses.yaml#/BadRequest' 18 | '401': 19 | $ref: '../responses/responses.yaml#/Unauthorized' 20 | '403': 21 | $ref: '../responses/responses.yaml#/Forbidden' 22 | default: 23 | $ref: '../responses/responses.yaml#/InternalServerError' 24 | -------------------------------------------------------------------------------- /home-open-api/src/main/resources/yaml/paths/templateFile.yaml: -------------------------------------------------------------------------------- 1 | template-file: 2 | get: 3 | tags: 4 | - template file 5 | summary: Return template file 6 | description: Retrieves the template file. 7 | operationId: getTemplateFile 8 | responses: 9 | 200: 10 | description: OK 11 | content: 12 | application/vnd.ms-excel: 13 | schema: 14 | type: string 15 | format: binary 16 | -------------------------------------------------------------------------------- /home-open-api/src/test/java/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ita-social-projects/Home/396c28a95d75c5904d1b61de7b3cee45d0e537c9/home-open-api/src/test/java/.keep -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/BaseDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public abstract class BaseDto { 9 | private Long id; 10 | } 11 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/cooperation/CooperationDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.cooperation; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homedata.general.address.Address; 6 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 7 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.house.HouseDto; 8 | import com.softserveinc.ita.homeproject.homeservice.dto.general.contact.ContactDto; 9 | import lombok.Getter; 10 | import lombok.Setter; 11 | 12 | @Getter 13 | @Setter 14 | public class CooperationDto extends BaseDto { 15 | 16 | private String name; 17 | 18 | private Address address; 19 | 20 | private List houses; 21 | 22 | private List contacts; 23 | 24 | private String usreo; 25 | 26 | private String iban; 27 | 28 | private String adminEmail; 29 | } 30 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/cooperation/apartment/ApartmentDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.cooperation.apartment; 2 | 3 | import java.math.BigDecimal; 4 | import java.util.List; 5 | 6 | import com.softserveinc.ita.homeproject.homedata.general.address.Address; 7 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 8 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.apartment.ApartmentInvitationDto; 9 | import com.softserveinc.ita.homeproject.homeservice.dto.user.ownership.OwnershipDto; 10 | import lombok.Getter; 11 | import lombok.Setter; 12 | 13 | @Getter 14 | @Setter 15 | public class ApartmentDto extends BaseDto { 16 | 17 | private String apartmentNumber; 18 | 19 | private BigDecimal apartmentArea; 20 | 21 | private List invitations; 22 | 23 | private List ownerships; 24 | 25 | private Long houseId; 26 | } 27 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/cooperation/house/HouseDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.cooperation.house; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.general.address.Address; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public class HouseDto extends BaseDto { 11 | 12 | private Integer quantityFlat; 13 | 14 | private Double houseArea; 15 | 16 | private Integer adjoiningArea; 17 | 18 | private Address address; 19 | } 20 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/cooperation/invitation/InvitationDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.enums.InvitationStatusDto; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.enums.InvitationTypeDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.general.email.Mailable; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter 10 | @Setter 11 | public abstract class InvitationDto extends Mailable { 12 | 13 | private InvitationStatusDto status; 14 | 15 | private InvitationTypeDto type; 16 | 17 | private String email; 18 | 19 | private String token; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/cooperation/invitation/apartment/ApartmentInvitationDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.apartment; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.general.address.Address; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.InvitationDto; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public class ApartmentInvitationDto extends InvitationDto { 11 | 12 | private Address address; 13 | 14 | private Long houseId; 15 | 16 | private String apartmentNumber; 17 | 18 | private Long apartmentId; 19 | } 20 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/cooperation/invitation/cooperation/CooperationInvitationDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.cooperation; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.InvitationDto; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.user.role.RoleDto; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public class CooperationInvitationDto extends InvitationDto { 11 | 12 | private RoleDto role; 13 | 14 | private Long cooperationId; 15 | } 16 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/cooperation/invitation/enums/InvitationStatusDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.enums; 2 | 3 | public enum InvitationStatusDto { 4 | 5 | PENDING("pending"), 6 | 7 | PROCESSING("processing"), 8 | 9 | ACCEPTED("accepted"), 10 | 11 | OVERDUE("overdue"), 12 | 13 | ERROR("error"); 14 | 15 | 16 | private final String value; 17 | 18 | InvitationStatusDto(String value) { 19 | this.value = value; 20 | } 21 | 22 | @Override 23 | public String toString() { 24 | return String.valueOf(value); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/cooperation/invitation/enums/InvitationTypeDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.enums; 2 | 3 | public enum InvitationTypeDto { 4 | COOPERATION("cooperation"), 5 | APARTMENT("apartment"); 6 | 7 | private String value; 8 | 9 | InvitationTypeDto(String value) { 10 | this.value = value; 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return String.valueOf(this.value); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/general/contact/ContactDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.general.contact; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.general.contact.enums.ContactTypeDto; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public abstract class ContactDto extends BaseDto { 11 | 12 | private ContactTypeDto type; 13 | 14 | private Boolean main; 15 | } 16 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/general/contact/EmailContactDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.general.contact; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public class EmailContactDto extends ContactDto { 9 | 10 | private String email; 11 | } 12 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/general/contact/PhoneContactDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.general.contact; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public class PhoneContactDto extends ContactDto { 9 | 10 | private String phone; 11 | } 12 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/general/contact/enums/ContactTypeDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.general.contact.enums; 2 | 3 | public enum ContactTypeDto { 4 | 5 | EMAIL("email"), 6 | 7 | PHONE("phone"); 8 | 9 | private String value; 10 | 11 | ContactTypeDto(String value) { 12 | this.value = value; 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return String.valueOf(value); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/general/mail/MailDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.general.mail; 2 | 3 | import java.math.BigDecimal; 4 | import javax.validation.constraints.Email; 5 | 6 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Builder; 9 | import lombok.Getter; 10 | import lombok.NoArgsConstructor; 11 | import lombok.Setter; 12 | 13 | @Getter 14 | @Setter 15 | @Builder 16 | @AllArgsConstructor 17 | @NoArgsConstructor 18 | public class MailDto extends BaseDto { 19 | @Email 20 | private String email; 21 | 22 | private String role; 23 | 24 | private String cooperationName; 25 | 26 | private BigDecimal ownershipPat; 27 | 28 | private String apartmentNumber; 29 | 30 | private String link; 31 | 32 | private Boolean isRegistered; 33 | 34 | private String type; 35 | 36 | private String token; 37 | } 38 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/general/news/NewsDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.general.news; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Getter 8 | @Setter 9 | public class NewsDto extends BaseDto { 10 | 11 | private String title; 12 | 13 | private String photoUrl; 14 | 15 | private String description; 16 | 17 | private String source; 18 | 19 | private String text; 20 | } 21 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/PollDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll; 2 | 3 | import java.time.LocalDateTime; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 8 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.house.HouseDto; 9 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.enums.PollStatusDto; 10 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.enums.PollTypeDto; 11 | import lombok.Getter; 12 | import lombok.Setter; 13 | 14 | @Getter 15 | @Setter 16 | public class PollDto extends BaseDto { 17 | 18 | private String header; 19 | 20 | private LocalDateTime creationDate; 21 | 22 | private String description; 23 | 24 | private LocalDateTime completionDate; 25 | 26 | private List polledHouses; 27 | 28 | private List includedHouses = new ArrayList<>(); 29 | 30 | private PollStatusDto status; 31 | 32 | private PollTypeDto type; 33 | 34 | private String result; 35 | } 36 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/enums/PollQuestionTypeDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.enums; 2 | 3 | public enum PollQuestionTypeDto { 4 | 5 | ADVICE("advice"), 6 | 7 | MULTIPLE_CHOICE("multiple_choice"), 8 | 9 | DOUBLE_CHOICE("double_choice"); 10 | 11 | private String value; 12 | 13 | PollQuestionTypeDto(String value) { 14 | this.value = value; 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return String.valueOf(value); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/enums/PollStatusDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.enums; 2 | 3 | public enum PollStatusDto { 4 | DRAFT("draft"), 5 | 6 | ACTIVE("active"), 7 | 8 | COMPLETED("completed"), 9 | 10 | SUSPENDED("suspended"); 11 | 12 | private final String value; 13 | 14 | PollStatusDto(String value) { 15 | this.value = value; 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return String.valueOf(value); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/enums/PollTypeDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.enums; 2 | 3 | public enum PollTypeDto { 4 | SIMPLE("simple"), 5 | 6 | MAJOR("major"); 7 | 8 | private final String value; 9 | 10 | PollTypeDto(String value) { 11 | this.value = value; 12 | } 13 | 14 | @Override 15 | public String toString() { 16 | return String.valueOf(value); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/question/AdviceChoiceQuestionDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.question; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.question.PollQuestionDto; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Getter 8 | @Setter 9 | public class AdviceChoiceQuestionDto extends PollQuestionDto { 10 | } 11 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/question/DoubleChoiceQuestionDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.question; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public class DoubleChoiceQuestionDto extends MultipleChoiceQuestionDto{ 9 | } 10 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/question/MultipleChoiceQuestionDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.question; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.results.AnswerVariantDto; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter 10 | @Setter 11 | public class MultipleChoiceQuestionDto extends PollQuestionDto { 12 | 13 | private Integer maxAnswerCount; 14 | 15 | private List answerVariants; 16 | } 17 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/question/PollQuestionDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.question; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.enums.PollQuestionTypeDto; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public abstract class PollQuestionDto extends BaseDto { 11 | 12 | private PollQuestionTypeDto type; 13 | 14 | private String question; 15 | 16 | private Long pollId; 17 | } 18 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/results/AnswerVariantDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.results; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Getter 8 | @Setter 9 | public class AnswerVariantDto extends BaseDto { 10 | private String answer; 11 | } 12 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/results/ResultQuestionDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.results; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Getter 8 | @Setter 9 | public class ResultQuestionDto extends BaseDto { 10 | 11 | private AnswerVariantDto answerVariantDto; 12 | 13 | private String percentVotes; 14 | 15 | private int voteCount; 16 | } 17 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/votes/AdviceQuestionVoteDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.votes; 2 | 3 | import lombok.Getter; 4 | import lombok.Setter; 5 | 6 | @Getter 7 | @Setter 8 | public class AdviceQuestionVoteDto extends QuestionVoteDto { 9 | 10 | private String answer; 11 | } 12 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/votes/MultipleChoiceQuestionVoteDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.votes; 2 | 3 | import java.util.List; 4 | 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public class MultipleChoiceQuestionVoteDto extends QuestionVoteDto { 11 | 12 | private List answers; 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/votes/QuestionVoteDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.votes; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.enums.PollQuestionTypeDto; 5 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.question.PollQuestionDto; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter 10 | @Setter 11 | public abstract class QuestionVoteDto extends BaseDto { 12 | 13 | private PollQuestionTypeDto type; 14 | 15 | private PollQuestionDto question; 16 | } 17 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/votes/VoteDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.votes; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | @Getter 10 | @Setter 11 | public class VoteDto extends BaseDto { 12 | private Long pollId; 13 | 14 | private Long userId; 15 | 16 | private List questionVotes; 17 | } 18 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/votes/VoteQuestionVariantDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.votes; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.results.AnswerVariantDto; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public class VoteQuestionVariantDto extends BaseDto { 11 | 12 | private AnswerVariantDto answerVariant; 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/poll/votes/VoteWithAnswerVariantDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.poll.votes; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 6 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.results.AnswerVariantDto; 7 | import lombok.Getter; 8 | import lombok.Setter; 9 | 10 | 11 | @Getter 12 | @Setter 13 | public class VoteWithAnswerVariantDto extends BaseDto { 14 | 15 | private Long voteId; 16 | 17 | private List answerVariantDtos; 18 | } 19 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/user/UserDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.user; 2 | 3 | import java.util.List; 4 | 5 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 6 | import com.softserveinc.ita.homeproject.homeservice.dto.general.contact.ContactDto; 7 | import lombok.Getter; 8 | import lombok.Setter; 9 | 10 | @Getter 11 | @Setter 12 | public class UserDto extends BaseDto { 13 | 14 | private String firstName; 15 | 16 | private String middleName; 17 | 18 | private String lastName; 19 | 20 | private String email; 21 | 22 | private String password; 23 | 24 | private List contacts; 25 | 26 | private String registrationToken; 27 | } 28 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/user/ownership/OwnershipDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.user.ownership; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.user.UserDto; 5 | import lombok.Getter; 6 | import lombok.Setter; 7 | 8 | @Getter 9 | @Setter 10 | public class OwnershipDto extends BaseDto { 11 | 12 | private UserDto user; 13 | 14 | private String ownershipPart; 15 | } 16 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/user/password/PasswordRecoveryTokenDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.user.password; 2 | 3 | import java.time.LocalDateTime; 4 | 5 | import com.softserveinc.ita.homeproject.homeservice.service.general.email.Mailable; 6 | import lombok.Getter; 7 | import lombok.Setter; 8 | 9 | 10 | @Getter 11 | @Setter 12 | public class PasswordRecoveryTokenDto extends Mailable { 13 | 14 | private String email; 15 | 16 | private String token; 17 | 18 | private LocalDateTime sentDateTime; 19 | 20 | private Boolean enabled; 21 | } 22 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/user/password/PasswordRestorationApprovalDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.user.password; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | 8 | @Getter 9 | @Setter 10 | public class PasswordRestorationApprovalDto extends BaseDto { 11 | 12 | private String email; 13 | 14 | private String token; 15 | 16 | private String newPassword; 17 | 18 | private String passwordConfirmation; 19 | } 20 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/user/password/PasswordRestorationRequestDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.user.password; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | 7 | @Getter 8 | @Setter 9 | public class PasswordRestorationRequestDto extends BaseDto { 10 | 11 | private String email; 12 | } 13 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/dto/user/role/RoleDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.dto.user.role; 2 | 3 | public enum RoleDto { 4 | 5 | ADMIN("admin"), 6 | USER("user"), 7 | OWNER("owner"), 8 | COOPERATION_ADMIN("cooperation_admin"); 9 | 10 | private final String value; 11 | 12 | RoleDto(String value) { 13 | this.value = value; 14 | } 15 | 16 | public String getValue() { 17 | return value; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/exception/BadRequestHomeException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.exception; 2 | 3 | public class BadRequestHomeException extends BaseHomeException { 4 | public BadRequestHomeException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/exception/BaseHomeException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.exception; 2 | 3 | public abstract class BaseHomeException extends RuntimeException { 4 | 5 | protected BaseHomeException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/exception/InvitationException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.exception; 2 | 3 | public class InvitationException extends RuntimeException{ 4 | 5 | public InvitationException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/exception/NotAcceptableInvitationException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.exception; 2 | 3 | public class NotAcceptableInvitationException extends InvitationException { 4 | public NotAcceptableInvitationException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/exception/NotFoundHomeException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.exception; 2 | 3 | public class NotFoundHomeException extends BaseHomeException { 4 | 5 | public NotFoundHomeException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/exception/PasswordException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.exception; 2 | 3 | 4 | public class PasswordException extends BaseHomeException { 5 | public PasswordException(String message) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/exception/PasswordRestorationException.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.exception; 2 | 3 | 4 | public class PasswordRestorationException extends BaseHomeException{ 5 | 6 | public PasswordRestorationException(String message) { 7 | super(message); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/ServiceMappingConfig.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config; 2 | 3 | import static com.softserveinc.ita.homeproject.homeservice.exception.ExceptionMessages.ILLEGAL_STATE_RESOLVING_TYPE_MESSAGE; 4 | 5 | import org.modelmapper.TypeMap; 6 | import org.springframework.core.GenericTypeResolver; 7 | 8 | 9 | public interface ServiceMappingConfig { 10 | void addMappings(TypeMap typeMap); 11 | 12 | @SuppressWarnings("unchecked cast") 13 | default Class getSourceType() { 14 | return (Class) getResolvedClasses()[0]; 15 | } 16 | 17 | @SuppressWarnings("unchecked cast") 18 | default Class getDestinationType() { 19 | return (Class) getResolvedClasses()[1]; 20 | } 21 | 22 | private Class[] getResolvedClasses() { 23 | Class[] typeArguments = 24 | GenericTypeResolver.resolveTypeArguments(this.getClass(), ServiceMappingConfig.class); 25 | final int expectedTypeArgumentsSize = 2; 26 | if (typeArguments == null || typeArguments.length != expectedTypeArgumentsSize) { 27 | throw new IllegalStateException(ILLEGAL_STATE_RESOLVING_TYPE_MESSAGE); 28 | } 29 | return typeArguments; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/TypeMatcher.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config; 2 | 3 | public interface TypeMatcher { 4 | boolean match(Class sourceType, Class destinationType); 5 | } 6 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/quartz/jobs/DeleteAllExpiredAndDisabledPasswordRestorationTokensJob.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.quartz.jobs; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.quartz.config.QuartzJobBeanAutoConfiguration; 4 | import com.softserveinc.ita.homeproject.homeservice.service.user.password.PasswordRestorationServiceImpl; 5 | import lombok.RequiredArgsConstructor; 6 | import lombok.SneakyThrows; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.quartz.JobExecutionContext; 9 | import org.springframework.scheduling.quartz.QuartzJobBean; 10 | import org.springframework.stereotype.Component; 11 | 12 | 13 | @Component 14 | @Slf4j 15 | @RequiredArgsConstructor 16 | @QuartzJobBeanAutoConfiguration(cron = "${home.jobs.erase-password-restoration-tokens.cron}") 17 | public class DeleteAllExpiredAndDisabledPasswordRestorationTokensJob extends QuartzJobBean { 18 | 19 | private final PasswordRestorationServiceImpl passwordRestorationService; 20 | 21 | @SneakyThrows 22 | @Override 23 | protected void executeInternal(JobExecutionContext jobExecutionContext) { 24 | log.info("Start password restoration token erasure"); 25 | passwordRestorationService.deleteAllExpiredAndDisabledPasswordRestorationTokens(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/quartz/jobs/SendApartmentEmailJob.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.quartz.jobs; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.quartz.config.QuartzJobBeanAutoConfiguration; 4 | import com.softserveinc.ita.homeproject.homeservice.service.general.email.SendApartmentEmailService; 5 | import lombok.RequiredArgsConstructor; 6 | import lombok.SneakyThrows; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.quartz.JobExecutionContext; 9 | import org.springframework.scheduling.quartz.QuartzJobBean; 10 | import org.springframework.stereotype.Component; 11 | 12 | @Component 13 | @Slf4j 14 | @RequiredArgsConstructor 15 | @QuartzJobBeanAutoConfiguration(cron = "${home.jobs.send-apartment-email.cron}") 16 | public class SendApartmentEmailJob extends QuartzJobBean { 17 | 18 | private final SendApartmentEmailService sendApartmentEmailJob; 19 | 20 | @SneakyThrows 21 | @Override 22 | public void executeInternal(JobExecutionContext context) { 23 | sendApartmentEmailJob.executeAllInvitationsByType(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/quartz/jobs/SendCooperationEmailJob.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.quartz.jobs; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.quartz.config.QuartzJobBeanAutoConfiguration; 4 | import com.softserveinc.ita.homeproject.homeservice.service.general.email.SendCooperationEmailService; 5 | import lombok.RequiredArgsConstructor; 6 | import lombok.SneakyThrows; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.quartz.JobExecutionContext; 9 | import org.springframework.scheduling.quartz.QuartzJobBean; 10 | import org.springframework.stereotype.Component; 11 | 12 | @Component 13 | @Slf4j 14 | @RequiredArgsConstructor 15 | @QuartzJobBeanAutoConfiguration(cron = "${home.jobs.send-cooperation-email.cron}") 16 | public class SendCooperationEmailJob extends QuartzJobBean { 17 | 18 | private final SendCooperationEmailService sendCooperationEmailJob; 19 | 20 | @SneakyThrows 21 | @Override 22 | public void executeInternal(JobExecutionContext context) { 23 | sendCooperationEmailJob.executeAllInvitationsByType(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/quartz/jobs/SendPasswordRestorationApprovalEmailJob.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.quartz.jobs; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.quartz.config.QuartzJobBeanAutoConfiguration; 4 | import com.softserveinc.ita.homeproject.homeservice.service.general.email.SendPasswordRestorationApprovalEmailServiceImpl; 5 | import lombok.RequiredArgsConstructor; 6 | import lombok.SneakyThrows; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.quartz.JobExecutionContext; 9 | import org.springframework.scheduling.quartz.QuartzJobBean; 10 | import org.springframework.stereotype.Component; 11 | 12 | 13 | @Component 14 | @Slf4j 15 | @RequiredArgsConstructor 16 | @QuartzJobBeanAutoConfiguration(cron = "${home.jobs.send-password-restoration-email.cron}") 17 | public class SendPasswordRestorationApprovalEmailJob extends QuartzJobBean { 18 | 19 | private final SendPasswordRestorationApprovalEmailServiceImpl sendPasswordRestorationApprovalJob; 20 | 21 | @SneakyThrows 22 | @Override 23 | public void executeInternal(JobExecutionContext context) { 24 | sendPasswordRestorationApprovalJob.executeAllInvitationsByType(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/quartz/jobs/SetOverdueStatusForInvitationsJob.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.quartz.jobs; 2 | 3 | import java.util.Set; 4 | 5 | import com.softserveinc.ita.homeproject.homeservice.quartz.config.QuartzJobBeanAutoConfiguration; 6 | import com.softserveinc.ita.homeproject.homeservice.service.cooperation.invitation.InvitationServiceImpl; 7 | import lombok.NoArgsConstructor; 8 | import org.quartz.JobExecutionContext; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.scheduling.quartz.QuartzJobBean; 11 | import org.springframework.stereotype.Component; 12 | 13 | @Component 14 | @NoArgsConstructor 15 | @QuartzJobBeanAutoConfiguration(cron = "0 0 11,23 ? * *") 16 | public class SetOverdueStatusForInvitationsJob extends QuartzJobBean { 17 | @Autowired 18 | private Set invitationServices; 19 | 20 | @Override 21 | public void executeInternal(JobExecutionContext context) { 22 | invitationServices.forEach(InvitationServiceImpl::markInvitationsAsOverdue); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/cooperation/CooperationService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.cooperation; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.cooperation.Cooperation; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.CooperationDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 6 | 7 | public interface CooperationService extends QueryableService { 8 | 9 | CooperationDto createCooperation(CooperationDto createCooperationDto); 10 | 11 | CooperationDto updateCooperation(Long id, CooperationDto updateCooperationDto); 12 | 13 | void deactivateCooperation(Long id); 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/cooperation/apartment/ApartmentService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.cooperation.apartment; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.cooperation.apatment.Apartment; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.apartment.ApartmentDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 6 | 7 | public interface ApartmentService extends QueryableService { 8 | ApartmentDto createApartment(Long houseId, ApartmentDto createApartmentDto); 9 | 10 | ApartmentDto updateApartment(Long houseId, Long apartmentId, ApartmentDto updateApartmentDto); 11 | 12 | void deactivateApartment(Long houseId, Long apartmentId); 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/cooperation/data/transfer/ImportExportTemplateFileService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.cooperation.data.transfer; 2 | 3 | import java.io.File; 4 | 5 | public interface ImportExportTemplateFileService { 6 | 7 | File getTemplateFile(); 8 | } 9 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/cooperation/data/transfer/ImportExportTemplateFileServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.cooperation.data.transfer; 2 | 3 | import java.io.File; 4 | 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.stereotype.Service; 7 | 8 | 9 | @Service 10 | public class ImportExportTemplateFileServiceImpl implements ImportExportTemplateFileService { 11 | 12 | @Value("${import.export.template.file.path}") 13 | private String importExportTemplateFilePath; 14 | 15 | @Override 16 | public File getTemplateFile() { 17 | return new File(importExportTemplateFilePath); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/cooperation/house/HouseService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.cooperation.house; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.cooperation.house.House; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.house.HouseDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 6 | 7 | public interface HouseService extends QueryableService { 8 | 9 | HouseDto createHouse(Long cooperationId, HouseDto createHouseDto); 10 | 11 | HouseDto updateHouse(Long id, HouseDto updateHouseDto); 12 | 13 | void deactivateById(Long coopId, Long id); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/cooperation/invitation/InvitationService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.cooperation.invitation; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.Invitation; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.invitation.InvitationDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 6 | import com.softserveinc.ita.homeproject.homeservice.service.general.email.MailableService; 7 | 8 | 9 | public interface InvitationService extends QueryableService, 10 | MailableService { 11 | 12 | D createInvitation(D invitationDto); 13 | 14 | void markInvitationsAsOverdue(); 15 | 16 | void deactivateInvitation(Long id); 17 | 18 | void acceptUserInvitation(T invitation); 19 | 20 | void registerWithRegistrationToken(String token); 21 | 22 | InvitationDto findInvitationByRegistrationToken(String token); 23 | } 24 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/general/contact/ContactService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.general.contact; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.general.contact.Contact; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.general.contact.ContactDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 6 | 7 | public interface ContactService extends QueryableService { 8 | 9 | ContactDto createContact(Long parentEntityId, ContactDto createContactDto); 10 | 11 | ContactDto updateContact(Long parentEntityId, Long id, ContactDto updateContactDto); 12 | 13 | void deactivateContact(Long id); 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/general/contact/cooperation/CooperationContactService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.general.contact.cooperation; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.service.general.contact.ContactService; 4 | 5 | public interface CooperationContactService extends ContactService { 6 | } 7 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/general/contact/user/UserContactService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.general.contact.user; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.service.general.contact.ContactService; 4 | 5 | public interface UserContactService extends ContactService { 6 | } 7 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/general/email/Mailable.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.general.email; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.BaseDto; 4 | 5 | 6 | public abstract class Mailable extends BaseDto { 7 | 8 | public abstract String getEmail(); 9 | 10 | public abstract String getToken(); 11 | } 12 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/general/email/MailableService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.general.email; 2 | 3 | import java.util.List; 4 | 5 | 6 | public interface MailableService { 7 | List getAllUnsentLetters(); 8 | 9 | void updateSentDateTimeAndStatus(Long id); 10 | } 11 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/general/mail/MailService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.general.mail; 2 | 3 | import java.time.LocalDateTime; 4 | import javax.activation.DataHandler; 5 | import javax.mail.MessagingException; 6 | 7 | import com.softserveinc.ita.homeproject.homeservice.dto.general.mail.MailDto; 8 | 9 | public interface MailService { 10 | 11 | /** 12 | For properly working usage of this functionality most of the symbols in 13 | the sending letter should contain more non-ascii symbols instead of ascii. 14 | See {@link javax.mail.internet.MimeUtility#getEncoding(DataHandler)} 15 | */ 16 | LocalDateTime sendTextMessage(MailDto mailDto) throws MessagingException; 17 | } 18 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/general/news/NewsService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.general.news; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.general.news.News; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.general.news.NewsDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 6 | 7 | public interface NewsService extends QueryableService { 8 | NewsDto create(NewsDto newsDto); 9 | 10 | NewsDto update(Long id, NewsDto newsDto); 11 | 12 | void deactivateNews(Long id); 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/poll/PollService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.poll; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.poll.Poll; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.PollDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 6 | 7 | 8 | public interface PollService extends QueryableService { 9 | PollDto create(Long cooperationId, PollDto pollDto); 10 | 11 | PollDto update(Long cooperationId, Long id, PollDto pollDto); 12 | 13 | void deactivate(Long id); 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/poll/house/PollHouseService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.poll.house; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.cooperation.house.House; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.cooperation.house.HouseDto; 5 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.PollDto; 6 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 7 | 8 | public interface PollHouseService extends QueryableService { 9 | PollDto add(Long houseId, Long pollId); 10 | 11 | void remove(Long houseId, Long pollId); 12 | } 13 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/poll/question/PollQuestionService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.poll.question; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.poll.question.PollQuestion; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.question.PollQuestionDto; 5 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 6 | 7 | public interface PollQuestionService extends QueryableService { 8 | 9 | PollQuestionDto createPollQuestion(PollQuestionDto pollQuestionDto); 10 | 11 | PollQuestionDto updatePollQuestion(PollQuestionDto updatePollQuestion); 12 | 13 | void deactivatePollQuestion(Long pollId, Long pollQuestionId); 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/poll/template/TemplateService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.poll.template; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.general.mail.MailDto; 4 | 5 | public interface TemplateService { 6 | String createMessageTextFromTemplate(MailDto mailDto); 7 | } 8 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/poll/vote/VoteService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.poll.vote; 2 | 3 | import com.softserveinc.ita.homeproject.homeservice.dto.poll.votes.VoteDto; 4 | 5 | public interface VoteService { 6 | VoteDto createVote(VoteDto voteDto); 7 | } 8 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/user/UserCooperationService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.user; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.cooperation.CooperationInvitation; 4 | import com.softserveinc.ita.homeproject.homedata.user.ownership.Ownership; 5 | 6 | public interface UserCooperationService { 7 | 8 | void createUserCooperationViaInvitation(CooperationInvitation invitation); 9 | 10 | void createUserCooperationForOwnership(Ownership ownership); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/user/UserService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.user; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.user.User; 4 | import com.softserveinc.ita.homeproject.homeservice.dto.user.UserDto; 5 | import com.softserveinc.ita.homeproject.homeservice.dto.user.password.PasswordRestorationApprovalDto; 6 | import com.softserveinc.ita.homeproject.homeservice.dto.user.password.PasswordRestorationRequestDto; 7 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 8 | 9 | public interface UserService extends QueryableService { 10 | 11 | UserDto createUser(UserDto createUserDto); 12 | 13 | UserDto updateUser(Long id, UserDto updateUserDto); 14 | 15 | UserDto getCurrentUser(); 16 | 17 | void deactivateUser(Long id); 18 | 19 | void requestPasswordRestoration(PasswordRestorationRequestDto requestDto); 20 | 21 | void changePassword(PasswordRestorationApprovalDto approvalDto); 22 | } 23 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/user/UserSessionService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.user; 2 | 3 | public interface UserSessionService { 4 | 5 | boolean validateUserByAccessToken(String accessToken); 6 | 7 | void logout(String token); 8 | 9 | void logoutAll(); 10 | } 11 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/service/user/ownership/OwnershipService.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.service.user.ownership; 2 | 3 | import com.softserveinc.ita.homeproject.homedata.cooperation.invitation.apartment.ApartmentInvitation; 4 | import com.softserveinc.ita.homeproject.homedata.user.ownership.Ownership; 5 | import com.softserveinc.ita.homeproject.homeservice.dto.user.ownership.OwnershipDto; 6 | import com.softserveinc.ita.homeproject.homeservice.service.QueryableService; 7 | 8 | public interface OwnershipService extends QueryableService { 9 | 10 | Ownership createOwnership(ApartmentInvitation apartmentInvitation); 11 | 12 | OwnershipDto updateOwnership(Long apartmentId, Long id, OwnershipDto updateOwnershipDto); 13 | 14 | void deactivateOwnershipById(Long apartmentId, Long id); 15 | } 16 | -------------------------------------------------------------------------------- /home-service/src/main/java/com/softserveinc/ita/homeproject/homeservice/util/ValidationHelper.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.util; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | @Component 6 | public class ValidationHelper { 7 | 8 | /** 9 | * ^ # start-of-string 10 | * (?=.*\d) # a digit must occur at least once 11 | * (?=.*[a-z]) # a lower case letter must occur at least once 12 | * (?=.*[A-Z]) # an upper case letter must occur at least once 13 | * (?=\S+$) # no whitespace allowed in the entire string 14 | * (?=\s*\S).* # empty password not allowed 15 | * .{8,} # anything, at least eight places though 16 | * $ # end-of-string 17 | */ 18 | private static final String PASSWORD_VALIDATION_REGEX 19 | = "^(?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=\\S+$)(?=\\s*\\S).*.{8,}$"; 20 | 21 | public boolean validatePasswordComplexity(String password) { 22 | return password != null && password.matches(PASSWORD_VALIDATION_REGEX); 23 | } 24 | 25 | public boolean validatePasswordConfirmation(String password, String passwordConfirmation) { 26 | return password != null && password.equals(passwordConfirmation); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /home-service/src/main/resources/application-home-service.properties: -------------------------------------------------------------------------------- 1 | #Mail service 2 | spring.mail.host=${MAIL_HOST:smtp.gmail.com} 3 | spring.mail.port=${MAIL_PORT:587} 4 | spring.mail.username=${MAIL_USERNAME:test.ita.emails@gmail.com} 5 | spring.mail.password=${MAIL_PASSWORD:wubtugptvtkmehxn} 6 | spring.mail.properties.mail.smtp.auth=true 7 | spring.mail.properties.mail.smtp.starttls.enable=true 8 | 9 | home.project.ui.host=https://home-project-ui.herokuapp.com 10 | home.project.swagger.host=https://home-project-academy.herokuapp.com 11 | 12 | #Quartz service 13 | spring.quartz.job-store-type = jdbc 14 | spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreCMT 15 | spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate 16 | spring.quartz.overwrite-existing-jobs = true 17 | home.jobs.send-apartment-email.cron=0/5 * * * * ? 18 | home.jobs.send-cooperation-email.cron=0/5 * * * * ? 19 | home.jobs.send-password-restoration-email.cron=0/5 * * * * ? 20 | home.jobs.erase-password-restoration-tokens.cron=0 0 0/5 * * ? 21 | -------------------------------------------------------------------------------- /home-service/src/main/resources/home-service.properties: -------------------------------------------------------------------------------- 1 | home.service.min.poll.duration.in.days=2 2 | 3 | home.service.template.invitation.path.registration=/template/invitation-to-registration.mustache 4 | home.service.template.invitation.path.cooperation=/template/invitation-to-cooperation.mustache 5 | home.service.template.invitation.path.apartment=/template/invitation-to-apartment.mustache 6 | home.service.template.password.restoration.path=/template/password-recovery-approval.mustache 7 | import.export.template.file.path=home-application/src/main/resources/files/template.xlsx 8 | -------------------------------------------------------------------------------- /home-service/src/main/resources/template/invitation-to-apartment.mustache: -------------------------------------------------------------------------------- 1 |

Вітаємо! Вас запрошено до квартири {{apartmentNumber}}

2 |

Токен для підтвердження реєстрації: {{token}}

3 | Для підтвердження перейдіть за посиланням і введіть токен. 4 | Посилання для підтвердження 5 | -------------------------------------------------------------------------------- /home-service/src/main/resources/template/invitation-to-cooperation.mustache: -------------------------------------------------------------------------------- 1 | {{#cooperationName}} 2 |

Вітаємо! Вас запрошено до кооперативу {{cooperationName}} в якості {{role}}

3 | {{/cooperationName}} 4 | {{^cooperationName}} 5 |

Вітаємо! Вас запрошено до кооперативу з адміністратором в якості {{role}}

6 | {{/cooperationName}} 7 |

Токен для підтвердження реєстрації: {{token}}

8 | Для підтвердження перейдіть за посиланням і введіть токен. 9 | Посилання для підтвердження 10 | -------------------------------------------------------------------------------- /home-service/src/main/resources/template/invitation-to-registration.mustache: -------------------------------------------------------------------------------- 1 |

Вітаємо! Вас запрошено до программи, яка допомагає з комунікацією в ОСББ

2 |

Токен для підтвердження реєстрації: {{token}}

3 | Для підтвердження перейдіть за посиланням і введіть токен. 4 | Посилання для підтвердження 5 | -------------------------------------------------------------------------------- /home-service/src/main/resources/template/password-recovery-approval.mustache: -------------------------------------------------------------------------------- 1 |

Вітаємо! Вам надіслано посилання для підтвердження зміни паролю

2 | Якщо Ви дійсно хочете змінити пароль, перейдіть за посиланням відображенним нижче. Якщо ні - ігноруйте це надсилання 3 |

Токен для підтвердження зміни паролю: {{token}}

4 | Посилання для підтвердження 5 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/BaseModelDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | public abstract class BaseModelDto { 4 | } 5 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/Container1Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | public class Container1Dto extends ContainerDto { 4 | } 5 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/Container2Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | public class Container2Dto extends ContainerDto { 4 | } 5 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/ContainerDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | public abstract class ContainerDto extends BaseModelDto { 4 | private InnerDto outerField; 5 | 6 | public InnerDto getOuterField() { 7 | return outerField; 8 | } 9 | 10 | public void setOuterField(InnerDto outerField) { 11 | this.outerField = outerField; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/Inner1Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | import java.util.List; 4 | 5 | public class Inner1Dto extends InnerDto { 6 | 7 | private List innerItemList; 8 | 9 | private String onChild1; 10 | 11 | public String getOnChild1() { 12 | return onChild1; 13 | } 14 | 15 | public void setOnChild1(String onChild1) { 16 | this.onChild1 = onChild1; 17 | } 18 | 19 | public List getInnerItemList() { 20 | return innerItemList; 21 | } 22 | 23 | public void setInnerItemList(List innerItemList) { 24 | this.innerItemList = innerItemList; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/Inner2Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | public class Inner2Dto extends InnerDto { 4 | private String onChild2; 5 | 6 | public String getOnChild2() { 7 | return onChild2; 8 | } 9 | 10 | public void setOnChild2(String onChild2) { 11 | this.onChild2 = onChild2; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/InnerDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | public abstract class InnerDto extends BaseModelDto { 4 | private String onParent; 5 | 6 | public void setOnParent(String onParent) { 7 | this.onParent = onParent; 8 | } 9 | 10 | public String getOnParent() { 11 | return onParent; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/InnerItem1Dto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | public class InnerItem1Dto extends InnerItemDto { 4 | 5 | public Integer amount; 6 | 7 | public Integer getAmount() { 8 | return amount; 9 | } 10 | 11 | public void setAmount(Integer amount) { 12 | this.amount = amount; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/destination/InnerItemDto.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.destination; 2 | 3 | public abstract class InnerItemDto { 4 | 5 | private String name; 6 | 7 | public String getName() { 8 | return name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/BaseModel.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | public abstract class BaseModel { 4 | } 5 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/ChildContainer1.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | public class ChildContainer1 extends Container { 4 | } 5 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/ChildContainer2.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | public class ChildContainer2 extends Container { 4 | } 5 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/Container.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | public abstract class Container extends BaseModel { 4 | 5 | private Inner outerField; 6 | 7 | public void setOuterField(Inner outerField) { 8 | this.outerField = outerField; 9 | } 10 | 11 | public Inner getOuterField() { 12 | return outerField; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/Inner.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | public abstract class Inner extends BaseModel { 4 | private String onParent; 5 | 6 | public void setOnParent(String onParent) { 7 | this.onParent = onParent; 8 | } 9 | 10 | public String getOnParent() { 11 | return onParent; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/Inner1.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | import java.util.List; 4 | 5 | public class Inner1 extends Inner { 6 | 7 | private List innerItemList; 8 | 9 | private String onChild1; 10 | 11 | public String getOnChild1() { 12 | return onChild1; 13 | } 14 | 15 | public void setOnChild1(String onChild1) { 16 | this.onChild1 = onChild1; 17 | } 18 | 19 | public List getInnerItemList() { 20 | return innerItemList; 21 | } 22 | 23 | public void setInnerItemList(List innerItemList) { 24 | this.innerItemList = innerItemList; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/Inner2.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | public class Inner2 extends Inner { 4 | private String onChild2; 5 | 6 | public String getOnChild2() { 7 | return onChild2; 8 | } 9 | 10 | public void setOnChild2(String onChild2) { 11 | this.onChild2 = onChild2; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/InnerItem.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | public abstract class InnerItem { 4 | 5 | private String name; 6 | 7 | public String getName() { 8 | return name; 9 | } 10 | 11 | public void setName(String name) { 12 | this.name = name; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/test/java/com/softserveinc/ita/homeproject/homeservice/mapper/config/classes/source/InnerItem1.java: -------------------------------------------------------------------------------- 1 | package com.softserveinc.ita.homeproject.homeservice.mapper.config.classes.source; 2 | 3 | public class InnerItem1 extends InnerItem { 4 | 5 | public Integer amount; 6 | 7 | public Integer getAmount() { 8 | return amount; 9 | } 10 | 11 | public void setAmount(Integer amount) { 12 | this.amount = amount; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /home-service/src/test/resources/application-home-service-test.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.driver-class-name=org.h2.Driver 2 | spring.datasource.url=jdbc:h2:mem:db 3 | spring.datasource.username=sa 4 | spring.datasource.password= 5 | spring.jpa.hibernate.ddl-auto=create-drop 6 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect 7 | home.jobs.send-apartment-email.cron=0/5 * * * * ? 8 | home.jobs.send-cooperation-email.cron=0/5 * * * * ? 9 | home.jobs.send-password-restoration-email.cron=0/5 * * * * ? 10 | home.jobs.erase-password-restoration-tokens.cron=0/5 * * * * ? 11 | --------------------------------------------------------------------------------