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
16 changes: 16 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# .env

APP_HOST_URL=http://jira_rush:8080
SPRING_DATASOURCE_URL=jdbc:postgresql://jira_db:5432/jira
DATASOURCE_PASSWORD=JiraRush
DATASOURCE_USERNAME=jira
OAUTH2_GITHUB_CLIENT_ID=3d0d8738e65881fff266
OAUTH2_GITHUB_CLIENT_SECRET=0f97031ce6178b7dfb67a6af587f37e222a16120
OAUTH2_GOOGLE_CLIENT_ID=329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com
OAUTH2_GOOGLE_CLIENT_SECRET=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
OAUTH2_GITLAB_CLIENT_ID=b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494
OAUTH2_GITLAB_CLIENT_SECRET=e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004
MAIL_HOST=smtp.gmail.com
MAIL_USERNAME=jira4jr@gmail.com
MAIL_PASSWORD=zdfzsrqvgimldzyj
MAIL_PORT=587
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17-oracle
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
COPY ./resources /resources
ENTRYPOINT ["java","-jar","/app.jar"]
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,17 @@

- https://habr.com/ru/articles/259055/

Список выполненных задач:
...
**Список выполненных задач:**
1-11 \
Для запуска без docker использовать файл localhost.env или вставить переменные окружения
```
APP_HOST_URL=http://localhost:8080; DATASOURCE_URL=jdbc:postgresql://localhost:5432/jira; DATASOURCE_PASSWORD=JiraRush; DATASOURCE_USERNAME=jira; OAUTH2_GITHUB_CLIENT_ID=3d0d8738e65881fff266; OAUTH2_GITHUB_CLIENT_SECRET=0f97031ce6178b7dfb67a6af587f37e222a16120; OAUTH2_GOOGLE_CLIENT_ID=329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com; OAUTH2_GOOGLE_CLIENT_SECRET=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; OAUTH2_GITLAB_CLIENT_ID=b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494; OAUTH2_GITLAB_CLIENT_SECRET=e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004; MAIL_HOST=smtp.gmail.com; MAIL_USERNAME=jira4jr@gmail.com; MAIL_PASSWORD=zdfzsrqvgimldzyj; MAIL_PORT=587
```
После запуска нужно выполнить скрипт resources/data4dev/data.sql \
Для запуска задач 9, 10 выполнить следующие команды, **используя jdk 17**

```
mvn clean install -P prod
docker compose up
```
После перейти по адресу http://localhost:8080
4 changes: 2 additions & 2 deletions config/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ server {

location ~ (/$|/view/|/ui/|/oauth2/) {
expires 0m;
proxy_pass http://localhost:8080;
proxy_pass http://jira_rush:8080;
proxy_connect_timeout 30s;
}
location ~ (/api/|/doc|/swagger-ui/|/v3/api-docs/) {
proxy_pass http://localhost:8080;
proxy_pass http://jira_rush:8080;
proxy_connect_timeout 150s;
}
location / {
Expand Down
34 changes: 34 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: '3.9'
services:
jira_rush:
container_name: jira_rush
build:
context: .
dockerfile: Dockerfile
env_file:
- .env
ports:
- "8080:8080"
depends_on:
- jira_db

jira_db:
container_name: jira_db
image: postgres:16.2
ports:
- "5432:5432"
environment:
POSTGRES_DB: jira
POSTGRES_USER: "${DATASOURCE_USERNAME}"
POSTGRES_PASSWORD: "${DATASOURCE_PASSWORD}"

nginx:
container_name: nginx
image: nginx:latest
restart: always
ports:
- "80:80"
volumes:
- ./config/nginx.conf:/etc/nginx/conf.d/nginx.conf
depends_on:
- jira_rush
16 changes: 16 additions & 0 deletions localhost.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# .env

APP_HOST_URL=http://localhost:8080
DATASOURCE_URL=jdbc:postgresql://localhost:5432/jira
DATASOURCE_PASSWORD=JiraRush
DATASOURCE_USERNAME=jira
OAUTH2_GITHUB_CLIENT_ID=3d0d8738e65881fff266
OAUTH2_GITHUB_CLIENT_SECRET=0f97031ce6178b7dfb67a6af587f37e222a16120
OAUTH2_GOOGLE_CLIENT_ID=329113642700-f8if6pu68j2repq3ef6umd5jgiliup60.apps.googleusercontent.com
OAUTH2_GOOGLE_CLIENT_SECRET=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
OAUTH2_GITLAB_CLIENT_ID=b8520a3266089063c0d8261cce36971defa513f5ffd9f9b7a3d16728fc83a494
OAUTH2_GITLAB_CLIENT_SECRET=e72c65320cf9d6495984a37b0f9cc03ec46be0bb6f071feaebbfe75168117004
MAIL_HOST=smtp.gmail.com
MAIL_USERNAME=jira4jr@gmail.com
MAIL_PASSWORD=zdfzsrqvgimldzyj
MAIL_PORT=587
20 changes: 20 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
Expand Down Expand Up @@ -195,5 +201,19 @@
</plugins>
</build>
</profile>

<profile>
<id>test-h2</id>
<properties>
<spring.profiles.active>test-h2</spring.profiles.active>
</properties>
</profile>

<profile>
<id>test-postgres</id>
<properties>
<spring.profiles.active>test-postgres</spring.profiles.active>
</properties>
</profile>
</profiles>
</project>
8 changes: 4 additions & 4 deletions resources/mails/email-confirmation.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>JiraRush - подтверждение почты</title>
<title th:text="#{mails.email-confirmation.head.title}">JiraRush - подтверждение почты</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>
</head>
<body>
<p th:text="'Привет, ' + ${user.firstName} + '.'"/>
<p>Чтобы завершить настройку учетной записи и начать пользоваться JiraRush, подтвердите, что вы правильно указали вашу
<p th:text="|#{mails.email-confirmation.greeting}', ' + ${user.firstName} + '.'|"/>
<p th:text="#{mails.email-confirmation.text}">Чтобы завершить настройку учетной записи и начать пользоваться JiraRush, подтвердите, что вы правильно указали вашу
электронную почту.</p>
<a th:href="${confirmationUrl}">Подтвердить почту</a>
<a th:href="${confirmationUrl}" th:text="#{mails.email-confirmation.confirm-link-text}">Подтвердить почту</a>
</body>
</html>
8 changes: 4 additions & 4 deletions resources/view/index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!DOCTYPE html>
<html lang="ru" xmlns:th="http://www.thymeleaf.org">
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<!--/*@thymesVar id="authUser" type="com.javarush.jira.login.AuthUser"*/-->

<th:block th:replace="~{layout/main::page(title='JiraRush: mini bugtracking system',appMain=~{::appMain})}">
<th:block th:replace="~{layout/main::page(title=#{home-page.head.title},appMain=~{::appMain})}">
<appMain>
<h1>JiraRush Home page</h1>
<h1 th:text="#{home-page.main-header}">JiraRush Home page</h1>
<div th:if="${authUser} != null">
<form action="/ui/logout" method="post">
<button class="btn btn-primary btn-lg mt-3" type="submit">Logout</button>
<button class="btn btn-primary btn-lg mt-3" type="submit" th:text="#{home-page.logout}">Logout</button>
</form>
</div>
</appMain>
Expand Down
22 changes: 16 additions & 6 deletions resources/view/layout/header.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,39 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html th:lang="${#locale.language}" xmlns:th="http://www.thymeleaf.org">
<!--/*@thymesVar id="authUser" type="com.javarush.jira.login.AuthUser"*/-->

<div th:fragment="header">
<header class="fixed-top d-none d-md-block header-nav">
<nav class="navbar navbar-expand-lg navbar-dark" id="header">
<div class="container-fluid">
<div class="collapse navbar-collapse mt-2 mb-2 px-5">
<span>
<a th:href="@{''(lang=en)}">En</a>
<a th:href="@{''(lang=ru)}">Ru</a>
<a th:href="@{''(lang=de)}">De</a>
</span>
<ul class="navbar-nav m-auto">
<form class="d-flex" role="search">
<input aria-label="Search" class="form-control" id="header-search" placeholder="Search"
<input aria-label="Search" class="form-control" id="header-search"
th:placeholder="#{layout.header.search}"
type="search">
</form>
<li class="nav-item menu-item me-3 ms-4">
<a class="btn btn-yellow" href="/doc" target="_blank" type="button">Swagger API</a>
</li>
</ul>
<div th:if="${authUser} == null">
<a class="btn btn-orange" href="/view/login" type="button">Login/Register</a>
<a class="btn btn-orange" href="/view/login" type="button"
th:text="#{layout.header.login-register}">Login/Register</a>
</div>
<th:block th:if="${authUser} != null">
<a class="btn btn-orange" href="/ui/profile" type="button"><i
class="fa-solid fa-address-card"></i> Profile</a>
<a class="btn btn-orange" href="/ui/profile" type="button"
th:utext="'<i class=&quot;fa-solid fa-address-card&quot;></i> ' + #{layout.header.profile}">
<i class='fa-solid fa-address-card'></i> Profile</a>
<form action="/ui/logout" class="mx-2" method="post">
<button class="btn btn-yellow btn-orange" type="submit"><i class="fa-solid fa-sign-out"></i>
<button class="btn btn-yellow btn-orange" type="submit"
th:utext="'<i class=&quot;fa-solid fa-sign-out&quot;></i> ' + #{layout.header.logout}">
<i class="fa-solid fa-sign-out"></i>
Logout
</button>
</form>
Expand Down
15 changes: 10 additions & 5 deletions resources/view/layout/sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,28 +38,33 @@
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mb-2 mb-lg-0" th:if="${authUser != null}">
<li class="nav-item mt-3 mt-lg-0 mb-0 mb-lg-3" id="tree">
<a class="nav-link sidebar-nav-link" href="/view/tree">
<a class="nav-link sidebar-nav-link" href="/view/tree"
th:utext="'<span class=&quot;ms-4&quot;><i class=&quot;fa-solid fa-folder-tree fa-fw me-2&quot;></i> ' + #{layout.sidebar.tree}">
<span class="ms-4"><i class="fa-solid fa-folder-tree fa-fw me-2"></i>Tree</span>
</a>
</li>
<li class="nav-item mt-3 mt-lg-0 mb-0 mb-lg-3" id="dashboard">
<a class="nav-link sidebar-nav-link" href="/ui/dashboard">
<a class="nav-link sidebar-nav-link" href="/ui/dashboard"
th:utext="'<span class=&quot;ms-4&quot;><i class=&quot;fa-solid fa-rectangle-list fa-fw me-2&quot;></i> '+ #{layout.sidebar.dashboard}">
<span class="ms-4"><i class="fa-solid fa-rectangle-list fa-fw me-2"></i>Dashboard</span>
</a>
</li>
<li class="nav-item mt-3 mt-lg-0 mb-0 mb-lg-3" id="reports">
<a class="nav-link sidebar-nav-link" href="/ui/reports">
<a class="nav-link sidebar-nav-link" href="/ui/reports"
th:utext="'<span class=&quot;ms-4&quot;><i class=&quot;fa-solid fa-chart-simple fa-fw me-2&quot;></i> ' + #{layout.sidebar.reports}">
<span class="ms-4"><i class="fa-solid fa-chart-simple fa-fw me-2"></i>Reports</span>
</a>
</li>
<th:block th:if="${authUser.isAdmin()}">
<li class="nav-item mt-3 mt-lg-0 mb-0 mb-lg-3" id="users">
<a class="nav-link sidebar-nav-link" href="/view/admin/users">
<a class="nav-link sidebar-nav-link" href="/view/admin/users"
th:utext="'<span class=&quot;ms-4&quot;><i class=&quot;fa-solid fa-users fa-fw me-2&quot;></i> ' + #{layout.sidebar.users}">
<span class="ms-4"><i class="fa-solid fa-users fa-fw me-2"></i>Users</span>
</a>
</li>
<li class="nav-item mt-3 mt-lg-0 mb-0 mb-lg-3" id="references">
<a class="nav-link sidebar-nav-link" href="/ui/admin/references">
<a class="nav-link sidebar-nav-link" href="/ui/admin/references"
th:utext="'<span class=&quot;ms-4&quot;><i class=&quot;fa-solid fa-book-bookmark fa-fw me-2&quot;></i> ' + #{layout.sidebar.references}">
<span class="ms-4"><i class="fa-solid fa-book-bookmark fa-fw me-2"></i>References</span>
</a>
</li>
Expand Down
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
1 change: 1 addition & 0 deletions resources/view/task.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ <h5>Status: [[${task.statusCode}]]</h5>
<h5>Type: [[${task.typeCode}]]</h5>
<h5>Updated: [[${#temporals.format(task?.updated, 'MM/dd/yyyy, HH:mm:ss')} ?: '-' ]]</h5>
<h5>Estimate: [[${task.estimate} ?: '-']]</h5>
<h5>Tags: <div th:each="tag :${task.tags}" th:text="${tag}"></div> </h5>
<hr>
<h6 th:if="${task.parentId != null}">Parent: <a th:href="@{'/ui/tasks/' + ${task.parentId}}">[[${task.parent.code}]]</a>
</h6>
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
import org.springframework.core.io.UrlResource;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand All @@ -25,14 +22,13 @@ public static void upload(MultipartFile multipartFile, String directoryPath, Str
throw new IllegalRequestDataException("Select a file to upload.");
}

File dir = new File(directoryPath);
if (dir.exists() || dir.mkdirs()) {
File file = new File(directoryPath + fileName);
try (OutputStream outStream = new FileOutputStream(file)) {
outStream.write(multipartFile.getBytes());
} catch (IOException ex) {
throw new IllegalRequestDataException("Failed to upload file" + multipartFile.getOriginalFilename());
}
Path path = Paths.get(directoryPath);
try {
Files.createDirectories(path);
Path file = path.resolve(fileName);
multipartFile.transferTo(file);
} catch (IOException e) {
throw new IllegalRequestDataException("Failed to upload file" + multipartFile.getOriginalFilename());
}
}

Expand Down
Loading