Visits table and data
This commit is contained in:
parent
ac2f0c1d6d
commit
ad063b3eab
@ -59,7 +59,6 @@ public class AuthComponent implements UserDetailsService {
|
|||||||
if (!jwtUtils.validateToken(refreshToken)) throw new UnauthorizedHTTPException("Invalid refresh token");
|
if (!jwtUtils.validateToken(refreshToken)) throw new UnauthorizedHTTPException("Invalid refresh token");
|
||||||
|
|
||||||
String login = jwtUtils.getLogin(refreshToken);
|
String login = jwtUtils.getLogin(refreshToken);
|
||||||
System.out.println(login);
|
|
||||||
UserModel userModel = getUserByLoginStrict(login);
|
UserModel userModel = getUserByLoginStrict(login);
|
||||||
|
|
||||||
return _generateTokenPair(userModel);
|
return _generateTokenPair(userModel);
|
||||||
|
@ -30,7 +30,6 @@ public class JWTUtils {
|
|||||||
|
|
||||||
public String generateAccessToken(@NonNull UserDetails userDetails) {
|
public String generateAccessToken(@NonNull UserDetails userDetails) {
|
||||||
Key key = Keys.hmacShaKeyFor(SECRET_KEY.getBytes());
|
Key key = Keys.hmacShaKeyFor(SECRET_KEY.getBytes());
|
||||||
System.out.println(userDetails);
|
|
||||||
return Jwts.builder()
|
return Jwts.builder()
|
||||||
.setSubject(userDetails.getUsername())
|
.setSubject(userDetails.getUsername())
|
||||||
.claim("roles", userDetails.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()))
|
.claim("roles", userDetails.getAuthorities().stream().map(GrantedAuthority::getAuthority).collect(Collectors.toList()))
|
||||||
|
32
src/main/resources/db/changelog/01/0005-visits.xml
Normal file
32
src/main/resources/db/changelog/01/0005-visits.xml
Normal 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>
|
@ -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>
|
@ -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
|
|
@ -9,9 +9,11 @@
|
|||||||
<include file="db/changelog/01/0001-users.xml"/>
|
<include file="db/changelog/01/0001-users.xml"/>
|
||||||
<include file="db/changelog/01/0003-user_roles.xml"/>
|
<include file="db/changelog/01/0003-user_roles.xml"/>
|
||||||
<include file="db/changelog/01/0004-gates.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/0002-roles-data.xml"/>
|
||||||
<include file="db/changelog/data/0001-user-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/0003-user_roles-data.xml"/>
|
||||||
<include file="db/changelog/data/0004-gates-data.xml"/>
|
<include file="db/changelog/data/0004-gates-data.xml"/>
|
||||||
|
<include file="db/changelog/data/0005-visits-data.xml"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user