Docker support, changed DB scheme

This commit is contained in:
Индекс Зиро 2025-02-19 16:21:44 +03:00
parent 60c6f318d6
commit 848b61108e
9 changed files with 35 additions and 24 deletions

@ -1,5 +1,5 @@
FROM eclipse-temurin:21
LABEL authors="indx"
COPY ./build/libs/NTO-Finals-0.0.1-SNAPSHOT.jar /opt/app/
CMD ["java", "-jar", "/opt/app/NTO-Finals-0.0.1-SNAPSHOT.jar"]
COPY ./build/libs/S-QR-Backend-0.0.1-SNAPSHOT.jar /opt/app/
CMD ["java", "-jar", "/opt/app/S-QR-Backend-0.0.1-SNAPSHOT.jar"]

@ -1,18 +1,18 @@
services:
# app:
# build:
# context: ../
# dockerfile: ./docker/Dockerfile
# container_name: app
# depends_on:
# - postgres_nto
# environment:
# - SPRING_DATASOURCE_URL=jdbc:postgresql://postgres_nto:5432/application_db
# - SPRING_DATASOURCE_USERNAME=$USERNAME
# - SPRING_DATASOURCE_PASSWORD=$PASSWORD
#
# ports:
# - "8081:8081"
app:
build:
context: ../
dockerfile: ./docker/Dockerfile
container_name: app
depends_on:
- postgres_nto
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres_nto:5432/application_db
- SPRING_DATASOURCE_USERNAME=indexzero
- SPRING_DATASOURCE_PASSWORD=gkl370WVUPMgLhK
ports:
- "8081:8080"
postgres_nto:
image: postgres:latest

@ -11,4 +11,5 @@ public class EntranceDTO {
private LocalDateTime entryTime;
private String readerName;
private String type;
private String entryType;
}

@ -22,4 +22,7 @@ public class Code {
@Column(name = "name")
String name;
@Column(name = "entry_type")
String entryType;
}

@ -13,6 +13,7 @@ public class EntranceMapper {
entranceDTO.setEmployeeLogin(entrance.getEmployee().getLogin());
entranceDTO.setEntryTime(entrance.getVisitTime());
entranceDTO.setReaderName(entrance.getReader().getName());
entranceDTO.setEntryType(entrance.getReader().getEntryType());
entranceDTO.setType(entrance.getType());
return entranceDTO;

@ -3,6 +3,7 @@ spring:
name: NTO-Finals
datasource:
# INFO: Comment url, username and password for usage with docker
url: jdbc:postgresql://localhost:5432/application_db
username: indexzero
password: gkl370WVUPMgLhK

@ -5,7 +5,7 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="2024-10-20--0001-code" author="anepretimov">
<changeSet id="2024-10-20--0001-code-03" author="anepretimov">
<preConditions onFail="MARK_RAN">
<not>
@ -27,6 +27,11 @@
<column name="name" type="VARCHAR(200)">
<constraints nullable="false"/>
</column>
<column name="entry_type" type="VARCHAR(200)">
<constraints nullable="false"/>
</column>
</createTable>
</changeSet>

@ -5,7 +5,7 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="2024-10-20--0001-code-data" author="anepretimov">
<changeSet id="2024-10-20--0001-code-data-02" author="anepretimov">
<loadData tableName="code" file="db.changelog/data/csv/2024-10-20--0001-code-data.csv"
separator=";"
quotchar='"'

@ -1,6 +1,6 @@
id;value;name
1;1234567890123456789;Главный Вход
2;9223372036854775807;Задний Вход
3;1122334455667788990;Вход с парковки
4;998877665544332211;Вход с улицы Колатушкина
5;5566778899001122334;Вход с улицы Пушкина
id;value;name;entry_type
1;1234567890123456789;Главный Вход;Вход
2;9223372036854775807;Главный Выход;Выход
3;1122334455667788990;Задний вход;Вход
4;998877665544332211;Выход с парковки;Выход
5;5566778899001122334;Вход с улицы Пушкина;Вход
1 id value name entry_type
2 1 1234567890123456789 Главный Вход Вход
3 2 9223372036854775807 Задний Вход Главный Выход Выход
4 3 1122334455667788990 Вход с парковки Задний вход Вход
5 4 998877665544332211 Вход с улицы Колатушкина Выход с парковки Выход
6 5 5566778899001122334 Вход с улицы Пушкина Вход