Changeset 29c0ed0 for src/main/java
- Timestamp:
- 01/04/21 19:20:57 (4 years ago)
- Branches:
- master
- Children:
- 83a5af4
- Parents:
- efdb71a
- Location:
- src/main/java/it/finki/tinki
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/tinki/bootstrap/DataHolder.java
refdb71a r29c0ed0 1 1 package it.finki.tinki.bootstrap; 2 2 3 import it.finki.tinki.model.Address; 3 4 import it.finki.tinki.model.Skill; 4 import it.finki.tinki.repository.SkillRepository; 5 import it.finki.tinki.model.Users.Company; 6 import it.finki.tinki.model.Users.User; 7 import it.finki.tinki.model.enumerator.AccountType; 8 import it.finki.tinki.repository.*; 5 9 import org.springframework.stereotype.Component; 6 10 7 11 import javax.annotation.PostConstruct; 12 import java.util.ArrayList; 13 import java.util.List; 8 14 9 15 @Component … … 11 17 12 18 SkillRepository skillRepository; 19 UserRepository userRepository; 20 CompanyRepository companyRepository; 21 TeamRepository teamRepository; 22 AddressRepository addressRepository; 13 23 14 public DataHolder(SkillRepository skillRepository ) {24 public DataHolder(SkillRepository skillRepository, UserRepository userRepository, CompanyRepository companyRepository, TeamRepository teamRepository, AddressRepository addressRepository) { 15 25 this.skillRepository = skillRepository; 26 this.userRepository = userRepository; 27 this.companyRepository = companyRepository; 28 this.teamRepository = teamRepository; 29 this.addressRepository = addressRepository; 16 30 } 17 31 … … 41 55 skillRepository.save(s0); 42 56 } 57 58 addressRepository.save(new Address("asdf", "asdf", "asdf")); 59 companyRepository.save(new Company("asdf@asdf", "pass", "Co.co", AccountType.COMPANY, addressRepository.findAll().get(0))); 43 60 } 44 61 -
src/main/java/it/finki/tinki/controller/TestController.java
refdb71a r29c0ed0 1 1 package it.finki.tinki.controller; 2 2 3 import it.finki.tinki.helper.Matchmaker; 4 import it.finki.tinki.model.Jobs.Internship; 5 import it.finki.tinki.model.Jobs.Job; 6 import it.finki.tinki.model.Jobs.Work; 7 import it.finki.tinki.model.Skill; 3 import it.finki.tinki.model.Users.Account; 4 import it.finki.tinki.model.Users.Company; 5 import it.finki.tinki.model.Users.Team; 6 import it.finki.tinki.model.Users.User; 7 import it.finki.tinki.model.enumerator.AccountType; 8 import it.finki.tinki.model.pojo.AccountLoginDataPojo; 9 import it.finki.tinki.repository.CompanyRepository; 8 10 import it.finki.tinki.repository.JobRepository; 9 import org.springframework.web.bind.annotation.GetMapping; 10 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RestController; 11 import it.finki.tinki.repository.TeamRepository; 12 import it.finki.tinki.repository.UserRepository; 13 import it.finki.tinki.service.AccountService; 14 import org.springframework.web.bind.annotation.*; 12 15 13 import java.util. ArrayList;14 import java.util. List;16 import java.util.HashMap; 17 import java.util.Map; 15 18 16 19 @RestController 17 @RequestMapping("/ ")20 @RequestMapping("/api") 18 21 public class TestController { 19 22 20 JobRepository jobRepository;23 AccountService accountService; 21 24 22 public TestController( JobRepository jobRepository) {23 this. jobRepository = jobRepository;25 public TestController(AccountService accountService) { 26 this.accountService = accountService; 24 27 } 25 28 26 @GetMapping 27 public String testPage(){ 28 Matchmaker match = new Matchmaker(); 29 List<Skill> skills = new ArrayList<>(); 30 31 skills.add(new Skill("C++")); 32 skills.add(new Skill("Java")); 33 skills.add(new Skill("Python")); 34 35 List<Skill> user = new ArrayList<>(); 36 37 user.add(new Skill("Java")); 38 user.add(new Skill("Python")); 39 40 System.out.println(match.match(skills, user)); 41 42 return "Hello"; 29 @PostMapping(path = "/login") 30 public Account testPage(@RequestBody AccountLoginDataPojo body){ 31 return accountService.findUser(body.getAccount(), body.getPassword(), body.getType()); 43 32 } 44 33 -
src/main/java/it/finki/tinki/model/Users/Account.java
refdb71a r29c0ed0 15 15 Long id; 16 16 17 @Column(unique = true) 17 18 String email; 19 18 20 String password; 19 21 -
src/main/java/it/finki/tinki/repository/CompanyRepository.java
refdb71a r29c0ed0 7 7 @Repository 8 8 public interface CompanyRepository extends JpaRepository<Company, Long> { 9 Company findByEmailAndPassword(String email, String password); 9 10 } -
src/main/java/it/finki/tinki/repository/TeamRepository.java
refdb71a r29c0ed0 7 7 @Repository 8 8 public interface TeamRepository extends JpaRepository<Team, Long> { 9 Team findByEmailAndPassword(String email, String password); 9 10 } -
src/main/java/it/finki/tinki/repository/UserRepository.java
refdb71a r29c0ed0 7 7 @Repository 8 8 public interface UserRepository extends JpaRepository<User, Long> { 9 User findByEmailAndPassword(String email, String password); 9 10 }
Note:
See TracChangeset
for help on using the changeset viewer.