본문 바로가기

전체 글136

RelationRepository RelationRepository Relaiton 엔티티를 DB에서 가져오는 RelationRepository를 생성한다. 복잡한 Query문이 들어가거나 Paging을 해야 하는 경우에는 QueryDsl을 사용한다. 1. Spring Data JPA ■ RelationRepository [RelationRepository] public interface RelationRepository extends JpaRepository, RelationRepositoryCustom { @Query("select relations from Relation relations " + "join relations.fromAccount fromAccount " + "join fetch relations.toAccount .. 2022. 6. 1.
Relation API 명세 Relation API 명세 Account 간의 관계를 나타내는 Relation entity를 생성하고 Relation을 사용하는 API에 대한 명세를 작성한다. 1. Relation Account 간의 관계를 나타내는 entity. 관계는 세 가지로, [친구, 친구 요청, 차단] 상태가 존재한다. [Relation] @Entity @Where(clause = "deleted = false") @Getter @Builder @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) public class Relation extends BaseTime { @Id @GeneratedValue @Column(name = "relation_id.. 2022. 5. 30.
myLogin myLogin Spring security에서는 로그인 처리를 하는 url을 제공해주는데, 그 기본값은 "/login" 이다. 해당 url는 코드상에 노출되어있지 않기 때문에 따로 커스텀하기에 어려움이 있다. 때문에 security의 로그인 처리 과정을 그대로 적용하되, 직접 관련 로직을 커스텀할 수 있도록 개별적인 login API를 만든다. 1. API 명세 ■ myLogin username과 password를 받아 인증을 처리하는 API [myLogin] @PostMapping("/myLogin") public ResultMessage myLogin(@Valid @RequestBody LoginForm loginForm, HttpServletResponse response) { } ● 입력 ○ lo.. 2022. 5. 18.
아기 상-어 아기 상-어 백준 16236번 문제 https://www.acmicpc.net/problem/16236 16236번: 아기 상어 N×N 크기의 공간에 물고기 M마리와 아기 상어 1마리가 있다. 공간은 1×1 크기의 정사각형 칸으로 나누어져 있다. 한 칸에는 물고기가 최대 1마리 존재한다. 아기 상어와 물고기는 모두 크기를 가 www.acmicpc.net 1. 문제 문제 N×N 크기의 공간에 물고기 M마리와 아기 상어 1마리가 있다. 공간은 1×1 크기의 정사각형 칸으로 나누어져 있다. 한 칸에는 물고기가 최대 1마리 존재한다. 아기 상어와 물고기는 모두 크기를 가지고 있고, 이 크기는 자연수이다. 가장 처음에 아기 상어의 크기는 2이고, 아기 상어는 1초에 상하좌우로 인접한 한 칸씩 이동한다. 아기 상어.. 2022. 5. 16.