Initial Commit
This commit is contained in:
commit
dcfa2f0cac
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
14
.idea/misc.xml
generated
Normal file
14
.idea/misc.xml
generated
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
7
.idea/vcs.xml
generated
Normal file
7
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
61
pom.xml
Normal file
61
pom.xml
Normal file
@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>org.example</groupId>
|
||||
<artifactId>Android-Bootcamp-2025-Backend</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.5.5</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.liquibase</groupId>
|
||||
<artifactId>liquibase-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-ui</artifactId>
|
||||
<version>1.7.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
11
src/main/java/org/example/App.java
Normal file
11
src/main/java/org/example/App.java
Normal file
@ -0,0 +1,11 @@
|
||||
package org.example;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class App {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(App.class, args);
|
||||
}
|
||||
}
|
41
src/main/java/org/example/config/WebSecurityConfig.java
Normal file
41
src/main/java/org/example/config/WebSecurityConfig.java
Normal file
@ -0,0 +1,41 @@
|
||||
package org.example.config;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
@RequiredArgsConstructor
|
||||
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
private final UserDetailsService userDetailsService;
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf().disable()
|
||||
.authorizeRequests()
|
||||
.antMatchers("/api/**").permitAll()
|
||||
// .antMatchers("api/{username}/passing").hasAuthority("ROLE_ADMIN")
|
||||
// .antMatchers("api/{username}/**").hasAnyAuthority("ROLE_USER", "ROLE_ADMIN")
|
||||
.anyRequest().authenticated()
|
||||
.and().httpBasic().and().headers().frameOptions().disable();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder());
|
||||
}
|
||||
|
||||
private PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
}
|
51
src/main/java/org/example/controller/UserController.java
Normal file
51
src/main/java/org/example/controller/UserController.java
Normal file
@ -0,0 +1,51 @@
|
||||
package org.example.controller;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.example.dto.PassingDTO;
|
||||
import org.example.dto.UserDTO;
|
||||
import org.example.service.PassingService;
|
||||
import org.example.service.UserService;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("api/{username}")
|
||||
@RequiredArgsConstructor
|
||||
public class UserController {
|
||||
|
||||
private final UserService userService;
|
||||
private final PassingService passingService;
|
||||
|
||||
@GetMapping("/auth")
|
||||
public ResponseEntity<String> getUserByUsername(@PathVariable String username) {
|
||||
UserDTO userDTO = userService.getUserByUsername(username);
|
||||
return ResponseEntity.ok("данный логин существует - можно пользоваться приложением");
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
public ResponseEntity<UserDTO> getUserInfoByUsername(@PathVariable String username) {
|
||||
return ResponseEntity.ok(userService.getUserInfoByUsername(username));
|
||||
}
|
||||
|
||||
@PatchMapping("/open")
|
||||
public ResponseEntity<String> patchUserByUsername(@PathVariable String username) {
|
||||
UserDTO userDTO = userService.patchUserByUsername(username);
|
||||
return ResponseEntity.ok("дверь открылась");
|
||||
}
|
||||
|
||||
@GetMapping("/passing")
|
||||
public ResponseEntity<PassingDTO> getPassingByUsername(@PathVariable String username) {
|
||||
return ResponseEntity.ok(passingService.getPassingByUsername(username));
|
||||
}
|
||||
|
||||
@GetMapping("/passing/paginated")
|
||||
public ResponseEntity<Page<PassingDTO>> getAllPassingPaginated(
|
||||
@RequestParam(defaultValue = "0") int page,
|
||||
@RequestParam(defaultValue = "1") int size) {
|
||||
Pageable pageable = PageRequest.of(page, size);
|
||||
return ResponseEntity.ok(passingService.getAllPassingPaginated(pageable));
|
||||
}
|
||||
}
|
9
src/main/java/org/example/dto/CodeDTO.java
Normal file
9
src/main/java/org/example/dto/CodeDTO.java
Normal file
@ -0,0 +1,9 @@
|
||||
package org.example.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CodeDTO {
|
||||
private Long Id;
|
||||
private Long code;
|
||||
}
|
13
src/main/java/org/example/dto/PassingDTO.java
Normal file
13
src/main/java/org/example/dto/PassingDTO.java
Normal file
@ -0,0 +1,13 @@
|
||||
package org.example.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.mapping.Set;
|
||||
|
||||
@Data
|
||||
public class PassingDTO {
|
||||
private Long id;
|
||||
private String Username;
|
||||
private String type;
|
||||
private String time;
|
||||
private Long code;
|
||||
}
|
13
src/main/java/org/example/dto/UserDTO.java
Normal file
13
src/main/java/org/example/dto/UserDTO.java
Normal file
@ -0,0 +1,13 @@
|
||||
package org.example.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserDTO {
|
||||
private Long id;
|
||||
private String username;
|
||||
private String name;
|
||||
private String photo;
|
||||
private String position;
|
||||
// private String lastVisit;
|
||||
}
|
17
src/main/java/org/example/entity/Code.java
Normal file
17
src/main/java/org/example/entity/Code.java
Normal file
@ -0,0 +1,17 @@
|
||||
package org.example.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "code")
|
||||
public class Code {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "code")
|
||||
private Long code;
|
||||
}
|
26
src/main/java/org/example/entity/Passing.java
Normal file
26
src/main/java/org/example/entity/Passing.java
Normal file
@ -0,0 +1,26 @@
|
||||
package org.example.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "passing")
|
||||
public class Passing {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@JoinColumn(name = "username")
|
||||
private String username;
|
||||
|
||||
@Column(name = "time")
|
||||
private String time;
|
||||
|
||||
@Column(name = "type")
|
||||
private String type;
|
||||
|
||||
@Column(name = "code")
|
||||
private Long code;
|
||||
}
|
67
src/main/java/org/example/entity/User.java
Normal file
67
src/main/java/org/example/entity/User.java
Normal file
@ -0,0 +1,67 @@
|
||||
package org.example.entity;
|
||||
|
||||
import liquibase.pro.packaged.C;
|
||||
import lombok.Data;
|
||||
import lombok.Generated;
|
||||
import org.springframework.security.core.GrantedAuthority;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Entity
|
||||
@Table(name = "user")
|
||||
public class User implements UserDetails{
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "username")
|
||||
private String username;
|
||||
|
||||
@Column(name = "password")
|
||||
private String password;
|
||||
|
||||
@Column(name = "name")
|
||||
private String name;
|
||||
|
||||
@Column(name = "photo")
|
||||
private String photo;
|
||||
|
||||
@Column(name = "position")
|
||||
private String position;
|
||||
|
||||
// @Column(name = "lastVisit")
|
||||
// private String lastVisit;
|
||||
|
||||
@Override
|
||||
public Collection<? extends GrantedAuthority> getAuthorities() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonExpired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAccountNonLocked() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCredentialsNonExpired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package org.example.exception;
|
||||
|
||||
public class UserNotFoundException extends RuntimeException {
|
||||
public UserNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.example.exception.handler;
|
||||
|
||||
import org.example.exception.UserNotFoundException;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler extends RuntimeException {
|
||||
@ExceptionHandler(UserNotFoundException.class)
|
||||
public ResponseEntity<String> handleUserNotFoundException(UserNotFoundException e) {
|
||||
return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);
|
||||
}
|
||||
}
|
10
src/main/java/org/example/repository/CodeRepository.java
Normal file
10
src/main/java/org/example/repository/CodeRepository.java
Normal file
@ -0,0 +1,10 @@
|
||||
package org.example.repository;
|
||||
|
||||
import org.example.entity.Code;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface CodeRepository extends JpaRepository<Code, Long> {
|
||||
Optional<Code> findByCode(Long code);
|
||||
}
|
15
src/main/java/org/example/repository/PassingRepository.java
Normal file
15
src/main/java/org/example/repository/PassingRepository.java
Normal file
@ -0,0 +1,15 @@
|
||||
package org.example.repository;
|
||||
|
||||
import org.example.entity.Passing;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface PassingRepository extends JpaRepository<Passing, Long> {
|
||||
Optional<Passing> findByUsername(String login);
|
||||
|
||||
@Override
|
||||
Page<Passing> findAll(Pageable pageable);
|
||||
}
|
11
src/main/java/org/example/repository/UserRepository.java
Normal file
11
src/main/java/org/example/repository/UserRepository.java
Normal file
@ -0,0 +1,11 @@
|
||||
package org.example.repository;
|
||||
|
||||
import org.example.entity.User;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public interface UserRepository extends JpaRepository<User, Long> {
|
||||
Optional<User> findByUsername(String username);
|
||||
|
||||
}
|
11
src/main/java/org/example/service/PassingService.java
Normal file
11
src/main/java/org/example/service/PassingService.java
Normal file
@ -0,0 +1,11 @@
|
||||
package org.example.service;
|
||||
|
||||
import org.example.dto.PassingDTO;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
public interface PassingService {
|
||||
PassingDTO getPassingByUsername(String username);
|
||||
|
||||
Page<PassingDTO> getAllPassingPaginated(Pageable pageable);
|
||||
}
|
11
src/main/java/org/example/service/UserService.java
Normal file
11
src/main/java/org/example/service/UserService.java
Normal file
@ -0,0 +1,11 @@
|
||||
package org.example.service;
|
||||
|
||||
import org.example.dto.UserDTO;
|
||||
|
||||
public interface UserService {
|
||||
UserDTO getUserByUsername(String username);
|
||||
|
||||
UserDTO getUserInfoByUsername(String username);
|
||||
|
||||
UserDTO patchUserByUsername(String username);
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package org.example.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.example.dto.PassingDTO;
|
||||
import org.example.exception.UserNotFoundException;
|
||||
import org.example.repository.PassingRepository;
|
||||
import org.example.service.PassingService;
|
||||
import org.example.util.PassingMapper;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PassingServiceImpl implements PassingService {
|
||||
private final PassingRepository passingRepository;
|
||||
@Override
|
||||
public PassingDTO getPassingByUsername(String Username) {
|
||||
return passingRepository.findByUsername(Username).map(PassingMapper::convertToDto).orElseThrow(() -> new UserNotFoundException("Посещения не найдены"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PassingDTO> getAllPassingPaginated(Pageable pageable) {
|
||||
return passingRepository.findAll(pageable).map(PassingMapper::convertToDto);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package org.example.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.example.entity.User;
|
||||
import org.example.repository.UserRepository;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserDetailsServiceImpl implements UserDetailsService {
|
||||
|
||||
private final UserRepository userRepository;
|
||||
|
||||
@Override
|
||||
public UserDetails loadUserByUsername(String s) throws UsernameNotFoundException {
|
||||
Optional<User> optionalUser = userRepository.findByUsername(s);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UsernameNotFoundException("Пользователь не найден");
|
||||
}
|
||||
|
||||
return optionalUser.get();
|
||||
}
|
||||
}
|
46
src/main/java/org/example/service/impl/UserServiceImpl.java
Normal file
46
src/main/java/org/example/service/impl/UserServiceImpl.java
Normal file
@ -0,0 +1,46 @@
|
||||
package org.example.service.impl;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.example.dto.UserDTO;
|
||||
import org.example.entity.User;
|
||||
import org.example.exception.UserNotFoundException;
|
||||
import org.example.repository.CodeRepository;
|
||||
import org.example.repository.UserRepository;
|
||||
import org.example.service.UserService;
|
||||
import org.example.util.UserMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class UserServiceImpl implements UserService {
|
||||
private final UserRepository userRepository;
|
||||
private final CodeRepository codeRepository;
|
||||
@Override
|
||||
public UserDTO getUserByUsername(String username) {
|
||||
Optional<User> optionalUser = userRepository.findByUsername(username);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException("логина не существует или неверный");
|
||||
}
|
||||
|
||||
return UserMapper.convertToDto(optionalUser.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO getUserInfoByUsername(String username) {
|
||||
return userRepository.findByUsername(username).map(UserMapper::convertToDto).orElseThrow(() -> new UserNotFoundException("логина не существует или неверный"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO patchUserByUsername(String username) {
|
||||
Optional<User> optionalUser = userRepository.findByUsername(username);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException("логина не существует или неверный");
|
||||
}
|
||||
return UserMapper.convertToDto(optionalUser.get());
|
||||
}
|
||||
|
||||
}
|
19
src/main/java/org/example/util/PassingMapper.java
Normal file
19
src/main/java/org/example/util/PassingMapper.java
Normal file
@ -0,0 +1,19 @@
|
||||
package org.example.util;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.example.dto.PassingDTO;
|
||||
import org.example.entity.Passing;
|
||||
|
||||
@UtilityClass
|
||||
public class PassingMapper {
|
||||
public PassingDTO convertToDto(Passing passing) {
|
||||
PassingDTO dto = new PassingDTO();
|
||||
dto.setId(passing.getId());
|
||||
dto.setUsername(passing.getUsername());
|
||||
dto.setType(passing.getType());
|
||||
dto.setTime(passing.getTime());
|
||||
dto.setCode(passing.getCode());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
20
src/main/java/org/example/util/UserMapper.java
Normal file
20
src/main/java/org/example/util/UserMapper.java
Normal file
@ -0,0 +1,20 @@
|
||||
package org.example.util;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
import org.example.dto.UserDTO;
|
||||
import org.example.entity.User;
|
||||
|
||||
@UtilityClass
|
||||
public class UserMapper {
|
||||
public UserDTO convertToDto(User user) {
|
||||
UserDTO dto = new UserDTO();
|
||||
dto.setId(user.getId());
|
||||
dto.setUsername(user.getUsername());
|
||||
dto.setName(user.getName());
|
||||
dto.setPhoto(user.getPhoto());
|
||||
dto.setPosition(user.getPosition());
|
||||
// dto.setLastVisit(user.getLastVisit());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
22
src/main/resources/application.yml
Normal file
22
src/main/resources/application.yml
Normal file
@ -0,0 +1,22 @@
|
||||
spring:
|
||||
datasource:
|
||||
url: jdbc:h2:mem:testdb
|
||||
|
||||
h2:
|
||||
console:
|
||||
enabled: true
|
||||
|
||||
liquibase:
|
||||
enabled: true
|
||||
change-log: classpath:db.changelog/db.changelog-master.xml
|
||||
|
||||
jpa:
|
||||
generate-ddl: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
show-sql: true
|
||||
|
||||
spring-doc:
|
||||
swagger-ui:
|
||||
path: /swagger-ui.html
|
||||
operationsSorter: method
|
@ -0,0 +1,38 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-18--0001-user" author="agavrilov">
|
||||
<preConditions>
|
||||
<not>
|
||||
<tableExists tableName="user"/>
|
||||
</not>
|
||||
</preConditions>
|
||||
|
||||
<createTable tableName="user">
|
||||
<column name="id" type="BIGINT" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="username" type="VARCHAR(50)">
|
||||
<constraints unique="true" nullable="false"/>
|
||||
</column>
|
||||
<column name="password" type="VARCHAR(255)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="name" type="VARCHAR(100)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="photo" type="VARCHAR(200)"/>
|
||||
<column name="position" type="VARCHAR(50)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="authorities" type="VARCHAR(20)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="lastVisit" type="VARCHAR(100)"/>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,23 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-18--0002-code" author="agavrilov">
|
||||
<preConditions>
|
||||
<not>
|
||||
<tableExists tableName="code"/>
|
||||
</not>
|
||||
</preConditions>
|
||||
|
||||
<createTable tableName="code">
|
||||
<column name="id" type="BIGINT" autoIncrement="true">
|
||||
<constraints nullable="false" unique="true" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="code" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -0,0 +1,33 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19--0003-passing" author="agavrilov">
|
||||
<preConditions>
|
||||
<not>
|
||||
<tableExists tableName="passing"/>
|
||||
</not>
|
||||
</preConditions>
|
||||
|
||||
<createTable tableName="passing">
|
||||
<column name = "id" type="BIGINT" autoIncrement="true">
|
||||
<constraints nullable="false" unique="true" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="username" type="VARCHAR(100)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="time" type="VARCHAR(50)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="type" type="VARCHAR(100)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="code" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,24 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19--0006-position" author="agavrilov">
|
||||
<preConditions>
|
||||
<not>
|
||||
<tableExists tableName="position"/>
|
||||
</not>
|
||||
</preConditions>
|
||||
|
||||
<createTable tableName="position">
|
||||
<column name="id" type="INT" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="position" type="VARCHAR(100)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,27 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="db.changelog/1.0/2025-02-19--0007-user-position" author="agavrilov">
|
||||
<preConditions>
|
||||
<not>
|
||||
<tableExists tableName="userPosition"/>
|
||||
</not>
|
||||
</preConditions>
|
||||
|
||||
<createTable tableName="userPosition">
|
||||
<column name="id" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="userId" type="INT">
|
||||
<constraints foreignKeyName="fk_userId" referencedTableName="user" referencedColumnNames="id"/>
|
||||
</column>
|
||||
<column name="positionId" type="INT">
|
||||
<constraints foreignKeyName="fk_positionId" referencedTableName="position" referencedColumnNames="id"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,24 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19-0004-type" author="agavrilov">
|
||||
<preConditions>
|
||||
<not>
|
||||
<tableExists tableName="inputType"/>
|
||||
</not>
|
||||
</preConditions>
|
||||
|
||||
<createTable tableName="inputType">
|
||||
<column name="id" type="INT" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="type" type="VARCHAR(20)">
|
||||
<constraints nullable="false" unique="true"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,25 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19-0005-authority" author="agavrilov">
|
||||
<preConditions>
|
||||
<not>
|
||||
<tableExists tableName="authority"/>
|
||||
</not>
|
||||
</preConditions>
|
||||
|
||||
<createTable tableName="authority">
|
||||
<column name="id" type="INT" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="role" type="VARCHAR(20)">
|
||||
<constraints nullable="false" unique="true"/>
|
||||
</column>
|
||||
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,27 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19-0008-authority-user-data" author="agavrilov">
|
||||
<preConditions>
|
||||
<not>
|
||||
<tableExists tableName="userAuthority"/>
|
||||
</not>
|
||||
</preConditions>
|
||||
|
||||
<createTable tableName="userAuthority">
|
||||
<column name = "id" type="INT" autoIncrement="true">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="userId" type="INT">
|
||||
<constraints nullable="false" foreignKeyName="fk_userId" referencedTableName="user" referencedColumnNames="id"/>
|
||||
</column>
|
||||
<column name="authorityId" type="INT">
|
||||
<constraints nullable="false" foreignKeyName="fk_authority" referencedTableName="authority" referencedColumnNames="id"/>
|
||||
</column>
|
||||
</createTable>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-18--0001-user-data" author="agavrilov">
|
||||
<loadData tableName="user" file="db.changelog/data/csv/2025-02-18--0001-user-data.csv" separator=";" encoding="UTF-8"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-18--0002-code-data" author="agavrilov">
|
||||
<loadData tableName="code" file="db.changelog/data/csv/2025-02-18--0002-code-data.csv" separator=";" encoding="UTF-8"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19--0003-input-type-data" author="agavrilov">
|
||||
<loadData tableName="inputType" file="db.changelog/data/csv/2025-02-19--0003-input-type-data.csv" separator=";" encoding="UTF-8"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19--0004-passing-data" author="agavrilov">
|
||||
<loadData tableName="passing" file="db.changelog/data/csv/2025-02-19--0004-passing-data.csv" separator=";" encoding="UTF-8"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19--0005-passing-data" author="agavrilov">
|
||||
<loadData tableName="authority" file="db.changelog/data/csv/2025-02-19--0005-authority-data.csv" separator=";" encoding="UTF-8"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19--0006-position-data" author="agavrilov">
|
||||
<loadData tableName="position" file="db.changelog/data/csv/2025-02-19--0006-position-data.csv" separator=";" encoding="UTF-8"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19--0007-user-position-data" author="agavrilov">
|
||||
<loadData tableName="userPosition" file="db.changelog/data/csv/2025-02-19--0007-user-position-data.csv" separator=";" encoding="UTF-8"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,11 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<changeSet id="2025-02-19-0008-user-authority-data" author="agavrilov">
|
||||
<loadData tableName="userPosition" file="db.changelog/data/csv/2025-02-19-0008-user-authority-data.csv" separator=";" encoding="UTF-8"/>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
@ -0,0 +1,5 @@
|
||||
username;password;name;photo;position;authorities;lastVisit
|
||||
pivanov;$2a$10$eObqG4zk7CbKPPTv0daHm.bcpK6zwyFPpjAVXOeDWrT/3TpVcxpia;Иванов Петр Федорович;https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg;Разработчик;ROLE_ADMIN;2024-02-12T08:30:00
|
||||
ipetrov;$2a$10$eObqG4zk7CbKPPTv0daHm.bcpK6zwyFPpjAVXOeDWrT/3TpVcxpia;Петров Иван Константинович;https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg;Аналитик;ROLE_USER;2024-02-30T08:35:00
|
||||
asemenov;$2a$10$eObqG4zk7CbKPPTv0daHm.bcpK6zwyFPpjAVXOeDWrT/3TpVcxpia;Семенов Анатолий Анатольевич;https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg;Разработчик;ROLE_USER;2024-02-31T08:31:00
|
||||
afedorov;$2a$10$eObqG4zk7CbKPPTv0daHm.bcpK6zwyFPpjAVXOeDWrT/3TpVcxpia;Федоров Александр Сергеевич;https://funnyducks.ru/upload/iblock/0cd/0cdeb7ec3ed6fddda0f90fccee05557d.jpg;Тестировщик;ROLE_USER;2024-02-30T08:36:00
|
|
@ -0,0 +1,6 @@
|
||||
code
|
||||
1234567890123456789
|
||||
9223372036854775807
|
||||
1122334455667788990
|
||||
998877665544332211
|
||||
5566778899001122334
|
|
@ -0,0 +1,3 @@
|
||||
type
|
||||
Карта
|
||||
Вход через смартфон
|
|
@ -0,0 +1,4 @@
|
||||
username;type;time;code
|
||||
pivanov;Карта;12:00;1234567890123456789
|
||||
ipetrov;Вход со смартфона;13:00;9223372036854775807
|
||||
asemenov;Карта;10:00;1234567890123456789
|
|
@ -0,0 +1,3 @@
|
||||
role
|
||||
ROLE_USER
|
||||
ROLE_ADMIN
|
|
@ -0,0 +1,4 @@
|
||||
position
|
||||
Разработчик
|
||||
Аналитик
|
||||
Тестировщик
|
|
@ -0,0 +1,5 @@
|
||||
userId;positionId
|
||||
1;1
|
||||
2;2
|
||||
3;1
|
||||
4;3
|
|
@ -0,0 +1,5 @@
|
||||
userId;authorityId
|
||||
1;1
|
||||
2;1
|
||||
3;1
|
||||
4;1
|
|
26
src/main/resources/db.changelog/db.changelog-master.xml
Normal file
26
src/main/resources/db.changelog/db.changelog-master.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
|
||||
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
|
||||
|
||||
<!--create-->
|
||||
<!-- <include file="db.changelog/1.0/2025-02-19--0006-position.xml"/>-->
|
||||
<!-- <include file="db.changelog/1.0/2025-02-19-0005-authority.xml"/>-->
|
||||
<include file="db.changelog/1.0/2025-02-18--0001-user.xml"/>
|
||||
<include file="db.changelog/1.0/2025-02-18--0002-code.xml"/>
|
||||
<!-- <include file="db.changelog/1.0/2025-02-19-0004-input-type.xml"/>-->
|
||||
<include file="db.changelog/1.0/2025-02-19--0003-passing.xml"/>
|
||||
<!-- <include file="db.changelog/1.0/2025-02-19--0007-user-position.xml"/>-->
|
||||
<!-- <include file="db.changelog/1.0/2025-02-19-0008-user-authority.xml"/>-->
|
||||
<!--fill-->
|
||||
<include file="db.changelog/data/2025-02-18--0001-user-data.xml"/>
|
||||
<include file="db.changelog/data/2025-02-18--0002-code-data.xml"/>
|
||||
<!-- <include file="db.changelog/data/2025-02-19-0003-input-type-data.xml"/>-->
|
||||
<include file="db.changelog/data/2025-02-19-0004-passing-data.xml"/>
|
||||
<!-- <include file="db.changelog/data/2025-02-19-0005-authority-data.xml"/>-->
|
||||
<!-- <include file="db.changelog/data/2025-02-19-0006-position-data.xml"/>-->
|
||||
<!-- <include file="db.changelog/data/2025-02-19-0007-user-position-data.xml"/>-->
|
||||
<!-- <include file="db.changelog/data/2025-02-19-0008-user-authority-data.xml"/>-->
|
||||
|
||||
</databaseChangeLog>
|
Loading…
x
Reference in New Issue
Block a user