Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM --platform=linux/amd64 eclipse-temurin:17-jre-alpine
WORKDIR /app
COPY target/jira-1.0.jar jiraApp.jar
EXPOSE 8080
CMD ["java", "-jar", "jiraApp.jar"]
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,36 @@
- https://habr.com/ru/articles/259055/

Список выполненных задач:
...

✅1. Разобраться со структурой проекта (onboarding).
✅2. Удалить социальные сети: vk, yandex. (Easy task)
✅3. Вынести чувствительную информацию в отдельный проперти файл.
✅9. Написать Dockerfile для основного сервера
✅10. Написать docker-compose файл для запуска контейнера сервера вместе с БД и nginx.(Hard task)


4. Переделать тесты так, чтоб во время тестов использовалась in memory БД (H2), а не PostgreSQL.
Для этого нужно определить 2 бина, и выборка какой из них использовать должно определяться активным профилем Spring.
H2 не поддерживает все фичи, которые есть у PostgreSQL, поэтому тебе прийдется немного упростить скрипты с тестовыми
данными.

5. Написать тесты для всех публичных методов контроллера ProfileRestController. Хоть методов только 2, но тестовых
методов должно быть больше, т.к. нужно проверить success and unsuccess path.

6. Сделать рефакторинг метода com.javarush.jira.bugtracking.attachment.FileUtil#upload чтоб он использовал современный
подход для работы с файловой системной. (Easy task)

7. Добавить новый функционал: добавления тегов к задаче (REST API + реализация на сервисе). Фронт делать необязательно. Таблица task_tag уже создана.

8. Добавить подсчет времени сколько задача находилась в работе и тестировании. Написать 2 метода на уровне сервиса, которые параметром принимают задачу и возвращают затраченное время:
Сколько задача находилась в работе (ready_for_review минус in_progress ).
Сколько задача находилась на тестировании (done минус ready_for_review).
Для написания этого задания, нужно добавить в конец скрипта инициализации базы данных changelog.sql 3 записи в таблицу ACTIVITY
insert into ACTIVITY ( ID, AUTHOR_ID, TASK_ID, UPDATED, STATUS_CODE ) values ...
Со статусами:
время начала работы над задачей – in_progress
время окончания разработки - ready_for_review
время конца тестирования - done

11. Добавить локализацию минимум на двух языках для шаблонов писем (mails) и стартовой страницы index.html.
12. Переделать механизм распознавания «свой-чужой» между фронтом и беком с JSESSIONID на JWT. Из сложностей – тебе придётся переделать отправку форм с фронта, чтоб добавлять хедер аутентификации. Extra-hard task
35 changes: 35 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
version: "3.8"
services:
app:
container_name: jira-app
build:
context: .
dockerfile: Dockerfile
restart: always
ports:
- "8080:8080"
depends_on:
- db
- nginx
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/jira
- SPRING_DATASOURCE_USERNAME=jira
- SPRING_DATASOURCE_PASSWORD=JiraRush

db:
image: postgres:11
volumes:
- ./data/db:/var/lib/postgresql/data
environment:
POSTGRES_DB: jira
POSTGRES_USER: jira
POSTGRES_PASSWORD: JiraRush

nginx:
container_name: nginx
image: nginx:latest
restart: always
ports:
- "80:80"
volumes:
- ./config/nginx.conf:/etc/nginx/conf.d/nginx.conf
16 changes: 0 additions & 16 deletions resources/static/fontawesome/css/all.css
Original file line number Diff line number Diff line change
Expand Up @@ -8603,14 +8603,6 @@ readers do not read off random characters that represent icons */
content: "\f3e8";
}

.fa-vk:before {
content: "\f189";
}

.fa-untappd:before {
content: "\f405";
}

.fa-mailchimp:before {
content: "\f59e";
}
Expand Down Expand Up @@ -9955,10 +9947,6 @@ readers do not read off random characters that represent icons */
content: "\f3bc";
}

.fa-yandex:before {
content: "\f413";
}

.fa-readme:before {
content: "\f4d5";
}
Expand Down Expand Up @@ -10183,10 +10171,6 @@ readers do not read off random characters that represent icons */
content: "\f7c6";
}

.fa-yandex-international:before {
content: "\f414";
}

.fa-cc-amex:before {
content: "\f1f3";
}
Expand Down
2 changes: 1 addition & 1 deletion resources/static/fontawesome/css/all.min.css

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions resources/view/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ <h3 class="mb-3">Sign in</h3>
type="button">
<i class="fa-brands fa-google"></i>
</a>
<a class="btn btn-primary btn-lg me-2" href="/oauth2/authorization/vk" style="padding-left: 17px; padding-right: 17px;"
type="button">
<i class="fa-brands fa-vk"></i>
</a>
<a class="btn btn-danger btn-lg me-2" href="/oauth2/authorization/yandex" style="padding-left: 21px; padding-right: 21px;"
type="button">
<i class="fa-brands fa-yandex"></i>
</a>
<a class="btn btn-dark btn-lg me-2" href="/oauth2/authorization/github" type="button">
<i class="fa-brands fa-github"></i>
</a>
Expand Down
8 changes: 0 additions & 8 deletions resources/view/unauth/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ <h3 class="mb-3">Registration</h3>
type="button">
<i class="fa-brands fa-google"></i>
</a>
<a class="btn btn-primary btn-lg me-2" href="/oauth2/authorization/vk" style="padding-left: 17px; padding-right: 17px;"
type="button">
<i class="fa-brands fa-vk"></i>
</a>
<a class="btn btn-danger btn-lg me-2" href="/oauth2/authorization/yandex" style="padding-left: 21px; padding-right: 21px;"
type="button">
<i class="fa-brands fa-yandex"></i>
</a>
<a class="btn btn-dark btn-lg me-2" href="/oauth2/authorization/github" type="button">
<i class="fa-brands fa-github"></i>
</a>
Expand Down

This file was deleted.

This file was deleted.

36 changes: 36 additions & 0 deletions src/main/resources/application-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
spring:
datasource:
username: ${DB_USERNAME:jira}
password: ${DB_PASSWORD:JiraRush}

security:
oauth2:
client:
registration:
github:
client-id: ${GITHUB_CLIENT_ID:3d0d8738e65881fff266}
client-secret: ${GITHUB_CLIENT_SECRET:0f97031ce6178b7dfb67a6af587f37e222a16120}
scope:
- email
google:
client-id: ${GOOGLE_CLIENT_ID:329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com}
client-secret: ${GOOGLE_CLIENT_SECRET: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}
scope:
- email
- profile
gitlab:
client-id: ${GITLAB_CLIENT_ID:b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494}
client-secret: ${GITLAB_CLIENT_SECRET:e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004}
client-name: ${GITLAB_CLIENT_NAME:GitLab}
redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}"
authorization-grant-type: authorization_code
scope: read_user
provider:
gitlab:
authorization-uri: ${GITLAB_AUTHORIZATION_URI:https://gitlab.com/oauth/authorize}
token-uri: ${GITLAB_TOKEN_URI:https://gitlab.com/oauth/token}
user-info-uri: ${GITLAB_USER_INFO_URI:https://gitlab.com/api/v4/user}
user-name-attribute: email
mail:
username: ${MAIL_USERNAME:jira4jr@gmail.com}
password: ${MAIL_PASSWORD:zdfzsrqvgimldzyj}
59 changes: 2 additions & 57 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ app:
max-pool-size: 100

spring:
config:
import: application-secret.yaml
init:
mode: never
jpa:
Expand All @@ -27,8 +29,6 @@ spring:
jdbc.batch_size: 20
datasource:
url: jdbc:postgresql://localhost:5432/jira
username: jira
password: JiraRush

liquibase:
changeLog: "classpath:db/changelog.sql"
Expand All @@ -46,59 +46,6 @@ spring:
cache-names: users
caffeine.spec: maximumSize=10000,expireAfterAccess=5m

security:
oauth2:
client:
registration:
github:
client-id: 3d0d8738e65881fff266
client-secret: 0f97031ce6178b7dfb67a6af587f37e222a16120
scope:
- email
google:
client-id: 329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com
client-secret: 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
scope:
- email
- profile
vk:
client-id: 51562377
client-secret: jNM1YHQy1362Mqs49wUN
client-name: Vkontakte
redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}"
client-authentication-method: client_secret_post
authorization-grant-type: authorization_code
scope: email
yandex:
client-id: 2f3395214ba84075956b76a34b231985
client-secret: ed236c501e444a609b0f419e5e88f1e1
client-name: Yandex
redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}"
authorization-grant-type: authorization_code
gitlab:
client-id: b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494
client-secret: e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004
client-name: GitLab
redirect-uri: "{baseUrl}/login/oauth2/code/{registrationId}"
authorization-grant-type: authorization_code
scope: read_user
provider:
vk:
authorization-uri: https://oauth.vk.com/authorize
token-uri: https://oauth.vk.com/access_token
user-info-uri: https://api.vk.com/method/users.get?v=8.1
user-name-attribute: response
yandex:
authorization-uri: https://oauth.yandex.ru/authorize
token-uri: https://oauth.yandex.ru/token
user-info-uri: https://login.yandex.ru/info
user-name-attribute: login
gitlab:
authorization-uri: https://gitlab.com/oauth/authorize
token-uri: https://gitlab.com/oauth/token
user-info-uri: https://gitlab.com/api/v4/user
user-name-attribute: email

sql:
init:
mode: always
Expand All @@ -111,8 +58,6 @@ spring:
enable: true
auth: true
host: smtp.gmail.com
username: jira4jr@gmail.com
password: zdfzsrqvgimldzyj
port: 587
thymeleaf.check-template-location: false

Expand Down
4 changes: 1 addition & 3 deletions src/main/resources/data4dev/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ values (1, 'skype', 'userSkype'),
(1, 'mobile', '+01234567890'),
(1, 'website', 'user.com'),
(2, 'github', 'adminGitHub'),
(2, 'tg', 'adminTg'),
(2, 'vk', 'adminVk');

(2, 'tg', 'adminTg');
delete
from ATTACHMENT;
alter
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/db/changelog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ values ('task', 'Task', 2),
('mobile', 'Mobile', 0),
('phone', 'Phone', 0),
('website', 'Website', 0),
('vk', 'VK', 0),
('linkedin', 'LinkedIn', 0),
('github', 'GitHub', 0),
-- PRIORITY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public static ProfileTo getUpdatedTo() {
new ContactTo("website", "new.com"),
new ContactTo("github", "newGitHub"),
new ContactTo("tg", "newTg"),
new ContactTo("vk", "newVk"),
new ContactTo("linkedin", "newLinkedin")));
}

Expand All @@ -57,7 +56,6 @@ public static Profile getUpdated(long id) {
new Contact(id, "website", "new.com"),
new Contact(id, "github", "newGitHub"),
new Contact(id, "tg", "newTg"),
new Contact(id, "vk", "newVk"),
new Contact(id, "linkedin", "newLinkedin")));
return profile;
}
Expand Down
3 changes: 1 addition & 2 deletions src/test/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ values (1, 'skype', 'userSkype'),
(1, 'mobile', '+01234567890'),
(1, 'website', 'user.com'),
(2, 'github', 'adminGitHub'),
(2, 'tg', 'adminTg'),
(2, 'vk', 'adminVk');
(2, 'tg', 'adminTg');


insert into PROJECT (code, title, description, type_code, parent_id)
Expand Down