Skip to content

Commit

Permalink
✨ feat: 리포지토리 설정 (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunmin0317 committed Feb 28, 2024
1 parent 302c8ac commit 2b96da9
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.smunity.petition.domain.account.repository;

import com.smunity.petition.domain.account.entity.Department;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface DepartmentJpaRepository extends JpaRepository<Department, Long> {

Optional<Department> findByName(String name);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.smunity.petition.domain.account.repository;


import com.smunity.petition.domain.account.entity.Year;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface YearJpaRepository extends JpaRepository<Year, Long> {

Optional<Year> findByYear(String year);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.smunity.petition.domain.account.repository.user;

import com.smunity.petition.domain.account.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.Optional;

public interface UserJpaRepository extends JpaRepository<User, Long> {

Optional<User> findByUserName(String username);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.smunity.petition.domain.account.repository.user;


import com.smunity.petition.domain.account.entity.User;

import java.util.Optional;

public interface UserRepository {

Optional<User> findByUserName(String username);

User save(User user);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.smunity.petition.domain.account.repository.user;

import com.smunity.petition.domain.account.entity.User;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Repository;

import java.util.Optional;

@RequiredArgsConstructor
@Repository
public class UserRepositoryImpl implements UserRepository {

private final UserJpaRepository userJpaRepository;


@Override
public Optional<User> findByUserName(String username) {
return userJpaRepository.findByUserName(username);
}

@Override
public User save(User user) {
return userJpaRepository.save(user);
}
}

0 comments on commit 2b96da9

Please sign in to comment.