Skip to content

Commit

Permalink
SMA-30: applied code style
Browse files Browse the repository at this point in the history
  • Loading branch information
markpernia committed Jan 28, 2024
1 parent 5a79831 commit fbc6d20
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sportsmatch;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import com.sportsmatch.models.*;
import com.sportsmatch.repositories.*;
import lombok.AllArgsConstructor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
@RequestMapping("/api/v1")
public class APIController {

@GetMapping("/hello")
@Tag(name = "ex.secured endpoint")
public String hello(Authentication authentication) {
User user = (User) authentication.getPrincipal();
return "Welcome "+ user.getName() + " to Secured Endpoint ";
}
@GetMapping("/hello")
@Tag(name = "ex.secured endpoint")
public String hello(Authentication authentication) {
User user = (User) authentication.getPrincipal();
return "Welcome " + user.getName() + " to Secured Endpoint ";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
@AllArgsConstructor
public class Token {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String token;
private Boolean isValid;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Enumerated(EnumType.STRING)
private TokenType tokenType;
private String token;
private Boolean isValid;

@ManyToOne
private User user;
@Enumerated(EnumType.STRING)
private TokenType tokenType;

@ManyToOne private User user;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.sportsmatch.models;

public enum TokenType {

BEARER
BEARER
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@

import com.sportsmatch.models.Token;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface TokenRepository extends JpaRepository<Token, Long> {

boolean existsByToken(String token);
boolean existsByToken(String token);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
public interface UserRepository extends JpaRepository<User, Long> {

Optional<User> findUserById(Long id);

Optional<User> findByEmail(String email);

boolean existsByEmail(String email);
}

0 comments on commit fbc6d20

Please sign in to comment.