diff --git a/pom.xml b/pom.xml
index 78af1157..e6f97f76 100644
--- a/pom.xml
+++ b/pom.xml
@@ -356,6 +356,13 @@
3.4.3
+
+
+ org.eclipse.jgit
+ org.eclipse.jgit
+ 6.7.0.202309050840-r
+
+
@@ -366,7 +373,7 @@
org.apache.maven.plugins
maven-checkstyle-plugin
- 3.2.0
+ 3.3.1
check
diff --git a/src/main/java/com/softserve/teachua/controller/version/VersionController.java b/src/main/java/com/softserve/teachua/controller/version/VersionController.java
new file mode 100644
index 00000000..e2cf4595
--- /dev/null
+++ b/src/main/java/com/softserve/teachua/controller/version/VersionController.java
@@ -0,0 +1,35 @@
+package com.softserve.teachua.controller.version;
+
+import com.softserve.teachua.controller.marker.Api;
+import com.softserve.teachua.dto.version.VersionDto;
+import com.softserve.teachua.service.VersionService;
+import io.swagger.v3.oas.annotations.security.SecurityRequirement;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@RestController
+@Tag(name = "version", description = "the build version API")
+@SecurityRequirement(name = "api")
+public class VersionController implements Api {
+ private VersionService versionService;
+
+ @Autowired
+ public VersionController(VersionService versionService) {
+ this.versionService = versionService;
+ }
+
+ /**
+ * Use this endpoint to get the version information. The controller returns {@code VersionDto}.
+ *
+ * @return {@code VersionDto}.
+ */
+ @GetMapping("/version")
+ public VersionDto getDate() {
+ log.debug("VersionController start");
+ return versionService.getVersion();
+ }
+}
diff --git a/src/main/java/com/softserve/teachua/dto/version/VersionDto.java b/src/main/java/com/softserve/teachua/dto/version/VersionDto.java
new file mode 100644
index 00000000..0a6278ee
--- /dev/null
+++ b/src/main/java/com/softserve/teachua/dto/version/VersionDto.java
@@ -0,0 +1,32 @@
+package com.softserve.teachua.dto.version;
+
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.With;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+@Builder
+@With
+public class VersionDto {
+ @NotNull
+ @NotEmpty
+ @NotBlank(message = "commitNumber cannot be empty")
+ private String backendCommitNumber;
+
+ @NotNull
+ @NotEmpty
+ @NotBlank(message = "commitDate cannot be empty")
+ private String backendCommitDate;
+
+ @NotNull
+ @NotEmpty
+ @NotBlank(message = "buildDate cannot be empty")
+ private String buildDate;
+}
diff --git a/src/main/java/com/softserve/teachua/dto/version/VersionEnum.java b/src/main/java/com/softserve/teachua/dto/version/VersionEnum.java
new file mode 100644
index 00000000..26ee38a9
--- /dev/null
+++ b/src/main/java/com/softserve/teachua/dto/version/VersionEnum.java
@@ -0,0 +1,24 @@
+package com.softserve.teachua.dto.version;
+
+public enum VersionEnum {
+ BACKEND_COMMIT_NUMBER("backendCommitNumber"),
+ BACKEND_COMMIT_DATE("backendCommitDate"),
+ BUILD_DATE("buildDate");
+
+ private String fieldName;
+
+ private VersionEnum(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ @Override
+ public String toString() {
+ return "VersionEnum{"
+ + "fieldName='" + fieldName + '\''
+ + '}';
+ }
+}
diff --git a/src/main/java/com/softserve/teachua/service/PropertiesService.java b/src/main/java/com/softserve/teachua/service/PropertiesService.java
new file mode 100644
index 00000000..f2990461
--- /dev/null
+++ b/src/main/java/com/softserve/teachua/service/PropertiesService.java
@@ -0,0 +1,9 @@
+package com.softserve.teachua.service;
+
+import java.util.Map;
+
+public interface PropertiesService {
+ Map readProperties(String fileName);
+
+ void writeProperties(String fileName, String commitName, int commitDateTime);
+}
diff --git a/src/main/java/com/softserve/teachua/service/VersionService.java b/src/main/java/com/softserve/teachua/service/VersionService.java
new file mode 100644
index 00000000..87c769ad
--- /dev/null
+++ b/src/main/java/com/softserve/teachua/service/VersionService.java
@@ -0,0 +1,12 @@
+package com.softserve.teachua.service;
+
+import com.softserve.teachua.dto.version.VersionDto;
+import org.eclipse.jgit.revwalk.RevCommit;
+
+public interface VersionService {
+ VersionDto getVersion();
+
+ void setVersion();
+
+ RevCommit getCommit();
+}
diff --git a/src/main/java/com/softserve/teachua/service/impl/PropertiesServiceImpl.java b/src/main/java/com/softserve/teachua/service/impl/PropertiesServiceImpl.java
new file mode 100644
index 00000000..f08b7b99
--- /dev/null
+++ b/src/main/java/com/softserve/teachua/service/impl/PropertiesServiceImpl.java
@@ -0,0 +1,73 @@
+package com.softserve.teachua.service.impl;
+
+import com.softserve.teachua.dto.version.VersionEnum;
+import com.softserve.teachua.service.PropertiesService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.time.format.DateTimeFormatter;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+@Slf4j
+@Service
+public class PropertiesServiceImpl implements PropertiesService {
+ public static final String PATH_SEPARATOR = "/";
+ public static final String PATH_MAIN_CLASS = "/../classes/";
+ public static final String LOCAL_DATE_TIME_TEMPLATE = "HH:mm:ss dd.MM.yyyy";
+ public static final String LOCAL_DATE_TEMPLATE = "dd.MM.yyyy";
+ private static final String BUILD_DATE = " Build Date is ";
+
+ public Map readProperties(String fileName) {
+ Map propertiesMap = new HashMap<>();
+ Properties appProps = new Properties();
+ try (FileInputStream fileInputStream = new FileInputStream(getFullPath(fileName))) {
+ appProps.load(fileInputStream);
+ for (Map.Entry