-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2d3b8e
commit 0d5b6e3
Showing
8 changed files
with
342 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: GitHub Action | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Build with Maven | ||
run: mvn -B package --file pom.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,64 @@ | ||
# job4j_social_media_api | ||
 | ||
# Social Media API | ||
|
||
## RESTful API для социальной медиа платформы, позволяющей пользователям регистрироваться, входить в систему, создавать посты, переписываться, подписываться на других пользователей и получать свою ленту активности | ||
|
||
### Возможности: | ||
|
||
1. Аутентификация и авторизация: | ||
|
||
- Пользователи могут зарегистрироваться, указав имя пользователя, электронную почту и пароль. | ||
|
||
- Пользователи могут войти в систему, предоставив правильные учетные данные. | ||
|
||
- API обеспечивает защиту конфиденциальности пользовательских данных, включая хэширование паролей и использование JWT. | ||
|
||
2. Управление постами: | ||
|
||
- Пользователи могут создавать новые посты, указывая текст, заголовок и прикрепляя изображения. | ||
|
||
- Пользователи могут просматривать посты других пользователей. | ||
|
||
- Пользователи могут обновлять и удалять свои собственные посты. | ||
|
||
3. Взаимодействие пользователей: | ||
|
||
- Пользователи могут отправлять заявки в друзья другим пользователям. С этого момента, пользователь, отправивший заявку, остается | ||
подписчиком до тех пор, пока сам не откажется от подписки. Если пользователь, получивший заявку, принимает ее, оба пользователя становятся | ||
друзьями. Если отклонит, то пользователь, отправивший заявку, как и указано ранее, все равно остается подписчиком. | ||
|
||
- Пользователи, являющиеся друзьями, также являются подписчиками друг на друга. | ||
|
||
- Если один из друзей удаляет другого из друзей, то он также отписывается. Второй пользователь при этом остается подписчиком. | ||
|
||
- Друзья могут писать друг другу сообщения. | ||
|
||
4. Подписки и лента активности: | ||
|
||
- Лента активности пользователя отображает последние посты от пользователей, на которых он подписан. | ||
|
||
- Лента активности поддерживает пагинацию и сортировку по времени создания постов. | ||
|
||
5. Обработка ошибок: | ||
|
||
- API обрабатывает и возвращает понятные сообщения об ошибках при неправильном запросе или внутренних проблемах сервера. | ||
|
||
- API осуществляет валидацию введенных данных и возвращать информативные сообщения при неправильном формате. | ||
|
||
6. Документация API: | ||
|
||
- API задокументировано с использованием Swagger. | ||
|
||
- Документация содержит описание доступных эндпоинтов, форматы запросов и ответов, а также требования к аутентификации. | ||
|
||
### Технологии и инструменты: | ||
|
||
- Язык программирования: Java | ||
|
||
- Фреймворк: Spring Boot | ||
|
||
- База данных: PostgreSQL | ||
|
||
- Аутентификация и авторизация: Spring Security | ||
|
||
- Документация API: Swagger |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE module PUBLIC | ||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN" | ||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> | ||
|
||
<module name="Checker"> | ||
|
||
<!--Расширение файла должно быть java, properties, xml--> | ||
<property name="fileExtensions" value="java, properties, xml"/> | ||
|
||
<!-- Checks for Size Violations. --> | ||
<!-- See http://checkstyle.sf.net/config_sizes.html --> | ||
<module name="FileLength"/> | ||
|
||
<!-- Checks for Headers --> | ||
<!-- See http://checkstyle.sf.net/config_header.html --> | ||
<!-- <module name="Header"> --> | ||
<!-- <property name="headerFile" value="${checkstyle.header.file}"/> --> | ||
<!-- <property name="fileExtensions" value="java"/> --> | ||
<!-- </module> --> | ||
|
||
<module name="TreeWalker"> | ||
|
||
<module name="EmptyLineSeparator"> <!-- Java Style Guide: Source file structure --> | ||
<property name="tokens" value=" | ||
CLASS_DEF, ENUM_DEF, INTERFACE_DEF, CTOR_DEF, STATIC_INIT, INSTANCE_INIT, VARIABLE_DEF, METHOD_DEF"/> | ||
<property name="allowNoEmptyLineBetweenFields" value="true"/> | ||
<property name="allowMultipleEmptyLines" value="false"/> | ||
<property name="allowMultipleEmptyLinesInsideClassMembers" value="false"/> | ||
</module> | ||
|
||
<!-- Checks for Naming Conventions. --> | ||
<!-- See http://checkstyle.sf.net/config_naming.html --> | ||
<module name="ConstantName"/> | ||
<!--<module name="LocalFinalVariableName"/>--> | ||
<module name="LocalVariableName"/> | ||
<module name="MemberName"/> | ||
<module name="MethodName"/> | ||
<module name="PackageName"> | ||
<property name="format" value="^[a-z]+(\.[a-z0-9]*)*$"/> | ||
</module> | ||
<module name="ParameterName"/> | ||
<module name="StaticVariableName"/> | ||
<module name="TypeName"/> | ||
|
||
<!-- Checks for Size Violations. --> | ||
<!-- See http://checkstyle.sf.net/config_sizes.html --> | ||
<!--<module name="LineLength"/>--> | ||
<module name="MethodLength"> | ||
<property name="tokens" value="METHOD_DEF"/> | ||
<property name="max" value="50"/> | ||
</module> | ||
<module name="ParameterNumber"/> | ||
|
||
<!-- Checks for whitespace --> | ||
<!-- See http://checkstyle.sf.net/config_whitespace.html --> | ||
<module name="EmptyForIteratorPad"/> | ||
<module name="GenericWhitespace"/> | ||
<module name="MethodParamPad"/> | ||
<module name="NoWhitespaceAfter"/> | ||
<module name="NoWhitespaceBefore"/> | ||
<module name="OperatorWrap"/> | ||
<module name="ParenPad"/> | ||
<module name="TypecastParenPad"/> | ||
<module name="WhitespaceAfter"/> | ||
<module name="WhitespaceAround"/> | ||
|
||
<!-- Modifier Checks --> | ||
<!-- See http://checkstyle.sf.net/config_modifiers.html --> | ||
|
||
<!-- Checks for blocks. You know, those {}'s --> | ||
<!-- See http://checkstyle.sf.net/config_blocks.html --> | ||
<module name="AvoidNestedBlocks"/> | ||
<module name="LeftCurly"/> | ||
<module name="NeedBraces"/> | ||
<module name="RightCurly"/> | ||
|
||
<!-- Checks for common coding problems --> | ||
<!-- See http://checkstyle.sf.net/config_coding.html --> | ||
<!--<module name="AvoidInlineConditionals"/>--> | ||
<module name="EmptyStatement"/> | ||
<module name="EqualsHashCode"/> | ||
<!--<module name="HiddenField"/>--> | ||
<module name="IllegalInstantiation"/> | ||
<module name="InnerAssignment"/> | ||
<!--<module name="MagicNumber"/>--> | ||
<module name="MissingSwitchDefault"/> | ||
<module name="SimplifyBooleanExpression"/> | ||
<module name="SimplifyBooleanReturn"/> | ||
|
||
<!-- Checks for class design --> | ||
<!-- See http://checkstyle.sf.net/config_design.html --> | ||
<!--<module name="DesignForExtension"/>--> | ||
<!--<module name="FinalClass"/>--> | ||
<!--<module name="HideUtilityClassConstructor"/>--> | ||
<module name="InterfaceIsType"/> | ||
|
||
<!-- Miscellaneous other checks. --> | ||
<!-- See http://checkstyle.sf.net/config_misc.html --> | ||
<module name="ArrayTypeStyle"/> | ||
<!--<module name="FinalParameters"/>--> | ||
<module name="TodoComment"/> | ||
<module name="UpperEll"/> | ||
<module name="EmptyBlock"/> | ||
<module name="EmptyBlock"> | ||
<property name="tokens" value="LITERAL_CATCH"/> | ||
</module> | ||
</module> | ||
|
||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.4.1</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>ru.job4j</groupId> | ||
<artifactId>job4j_social_media_api</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>job4j_social_media_api</name> | ||
<description>job4j_social_media_api</description> | ||
<url/> | ||
<licenses> | ||
<license/> | ||
</licenses> | ||
<developers> | ||
<developer/> | ||
</developers> | ||
<scm> | ||
<connection/> | ||
<developerConnection/> | ||
<tag/> | ||
<url/> | ||
</scm> | ||
<properties> | ||
<java.version>17</java.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-checkstyle-plugin</artifactId> | ||
<version>3.6.0</version> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.puppycrawl.tools</groupId> | ||
<artifactId>checkstyle</artifactId> | ||
<version>10.3.3</version> | ||
</dependency> | ||
</dependencies> | ||
<executions> | ||
<execution> | ||
<id>validate</id> | ||
<phase>validate</phase> | ||
<configuration> | ||
<configLocation>checkstyle.xml</configLocation> | ||
<consoleOutput>true</consoleOutput> | ||
<failsOnError>true</failsOnError> | ||
<includeTestSourceDirectory>true</includeTestSourceDirectory> | ||
</configuration> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
12 changes: 12 additions & 0 deletions
12
src/main/java/ru/job4j/api/Job4jSocialMediaApiApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ru.job4j.api; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class Job4jSocialMediaApiApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(Job4jSocialMediaApiApplication.class, args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
spring.application.name=job4j_social_media_api |
13 changes: 13 additions & 0 deletions
13
src/test/java/ru/job4j/api/Job4jSocialMediaApiApplicationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ru.job4j.api; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@SpringBootTest | ||
class Job4jSocialMediaApiApplicationTests { | ||
|
||
@Test | ||
void contextLoads() { | ||
} | ||
|
||
} |