Visits table and data

This commit is contained in:
Universall 2025-02-19 12:52:04 +03:00
parent ac2f0c1d6d
commit ad063b3eab
6 changed files with 94 additions and 2 deletions

View File

@ -59,7 +59,6 @@ public class AuthComponent implements UserDetailsService {
if (!jwtUtils.validateToken(refreshToken)) throw new UnauthorizedHTTPException("Invalid refresh token");
String login = jwtUtils.getLogin(refreshToken);
System.out.println(login);
UserModel userModel = getUserByLoginStrict(login);
return _generateTokenPair(userModel);

View File

@ -30,7 +30,6 @@ public class JWTUtils {
public String generateAccessToken(@NonNull UserDetails userDetails) {
Key key = Keys.hmacShaKeyFor(SECRET_KEY.getBytes());
System.out.println(userDetails);
return Jwts.builder()
.setSubject(userDetails.getUsername())
.claim("roles", userDetails.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()))

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet id="visits" author="universall">
<createTable tableName="visits">
<column name="id" type="INTEGER" autoIncrement="true">
<constraints primaryKey="true"/>
</column>
<column name="user_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="gate_id" type="INTEGER">
<constraints nullable="false"/>
</column>
<column name="created_at" type="DATETIME"/>
</createTable>
<addForeignKeyConstraint baseTableName="visits"
baseColumnNames="user_id"
referencedTableName="users"
referencedColumnNames="id"
constraintName="fk_visits_users"/>
<addForeignKeyConstraint baseTableName="visits"
baseColumnNames="gate_id"
referencedTableName="gates"
referencedColumnNames="id"
constraintName="fk_visits_gates"/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">
<changeSet id="visits-data" author="universall">
<loadData tableName="visits" file="db/changelog/data/csv/0005-visits-data.csv" separator=";" quotchar='"'/>
</changeSet>
</databaseChangeLog>

View File

@ -0,0 +1,51 @@
id;user_id;gate_id;created_at
1;1;1;2023-10-01 08:00:00
2;2;2;2023-10-01 09:15:00
3;3;3;2023-10-01 10:30:00
4;4;4;2023-10-01 11:45:00
5;5;5;2023-10-01 12:00:00
6;1;2;2023-10-01 13:15:00
7;2;3;2023-10-01 14:30:00
8;3;4;2023-10-01 15:45:00
9;4;5;2023-10-01 16:00:00
10;5;1;2023-10-01 17:15:00
11;1;3;2023-10-02 08:30:00
12;2;4;2023-10-02 09:45:00
13;3;5;2023-10-02 10:00:00
14;4;1;2023-10-02 11:15:00
15;5;2;2023-10-02 12:30:00
16;1;4;2023-10-02 13:45:00
17;2;5;2023-10-02 14:00:00
18;3;1;2023-10-02 15:15:00
19;4;2;2023-10-02 16:30:00
20;5;3;2023-10-02 17:45:00
21;1;5;2023-10-03 08:00:00
22;2;1;2023-10-03 09:15:00
23;3;2;2023-10-03 10:30:00
24;4;3;2023-10-03 11:45:00
25;5;4;2023-10-03 12:00:00
26;1;1;2023-10-03 13:15:00
27;2;2;2023-10-03 14:30:00
28;3;3;2023-10-03 15:45:00
29;4;4;2023-10-03 16:00:00
30;5;5;2023-10-03 17:15:00
31;1;2;2023-10-04 08:30:00
32;2;3;2023-10-04 09:45:00
33;3;4;2023-10-04 10:00:00
34;4;5;2023-10-04 11:15:00
35;5;1;2023-10-04 12:30:00
36;1;3;2023-10-04 13:45:00
37;2;4;2023-10-04 14:00:00
38;3;5;2023-10-04 15:15:00
39;4;1;2023-10-04 16:30:00
40;5;2;2023-10-04 17:45:00
41;1;4;2023-10-05 08:00:00
42;2;5;2023-10-05 09:15:00
43;3;1;2023-10-05 10:30:00
44;4;2;2023-10-05 11:45:00
45;5;3;2023-10-05 12:00:00
46;1;5;2023-10-05 13:15:00
47;2;1;2023-10-05 14:30:00
48;3;2;2023-10-05 15:45:00
49;4;3;2023-10-05 16:00:00
50;5;4;2023-10-05 17:15:00
1 id user_id gate_id created_at
2 1 1 1 2023-10-01 08:00:00
3 2 2 2 2023-10-01 09:15:00
4 3 3 3 2023-10-01 10:30:00
5 4 4 4 2023-10-01 11:45:00
6 5 5 5 2023-10-01 12:00:00
7 6 1 2 2023-10-01 13:15:00
8 7 2 3 2023-10-01 14:30:00
9 8 3 4 2023-10-01 15:45:00
10 9 4 5 2023-10-01 16:00:00
11 10 5 1 2023-10-01 17:15:00
12 11 1 3 2023-10-02 08:30:00
13 12 2 4 2023-10-02 09:45:00
14 13 3 5 2023-10-02 10:00:00
15 14 4 1 2023-10-02 11:15:00
16 15 5 2 2023-10-02 12:30:00
17 16 1 4 2023-10-02 13:45:00
18 17 2 5 2023-10-02 14:00:00
19 18 3 1 2023-10-02 15:15:00
20 19 4 2 2023-10-02 16:30:00
21 20 5 3 2023-10-02 17:45:00
22 21 1 5 2023-10-03 08:00:00
23 22 2 1 2023-10-03 09:15:00
24 23 3 2 2023-10-03 10:30:00
25 24 4 3 2023-10-03 11:45:00
26 25 5 4 2023-10-03 12:00:00
27 26 1 1 2023-10-03 13:15:00
28 27 2 2 2023-10-03 14:30:00
29 28 3 3 2023-10-03 15:45:00
30 29 4 4 2023-10-03 16:00:00
31 30 5 5 2023-10-03 17:15:00
32 31 1 2 2023-10-04 08:30:00
33 32 2 3 2023-10-04 09:45:00
34 33 3 4 2023-10-04 10:00:00
35 34 4 5 2023-10-04 11:15:00
36 35 5 1 2023-10-04 12:30:00
37 36 1 3 2023-10-04 13:45:00
38 37 2 4 2023-10-04 14:00:00
39 38 3 5 2023-10-04 15:15:00
40 39 4 1 2023-10-04 16:30:00
41 40 5 2 2023-10-04 17:45:00
42 41 1 4 2023-10-05 08:00:00
43 42 2 5 2023-10-05 09:15:00
44 43 3 1 2023-10-05 10:30:00
45 44 4 2 2023-10-05 11:45:00
46 45 5 3 2023-10-05 12:00:00
47 46 1 5 2023-10-05 13:15:00
48 47 2 1 2023-10-05 14:30:00
49 48 3 2 2023-10-05 15:45:00
50 49 4 3 2023-10-05 16:00:00
51 50 5 4 2023-10-05 17:15:00

View File

@ -9,9 +9,11 @@
<include file="db/changelog/01/0001-users.xml"/>
<include file="db/changelog/01/0003-user_roles.xml"/>
<include file="db/changelog/01/0004-gates.xml"/>
<include file="db/changelog/01/0005-visits.xml"/>
<include file="db/changelog/data/0002-roles-data.xml"/>
<include file="db/changelog/data/0001-user-data.xml"/>
<include file="db/changelog/data/0003-user_roles-data.xml"/>
<include file="db/changelog/data/0004-gates-data.xml"/>
<include file="db/changelog/data/0005-visits-data.xml"/>
</databaseChangeLog>