Ignore:
Timestamp:
01/04/21 19:20:57 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
83a5af4
Parents:
efdb71a
Message:

added initial login functionality

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/tinki/controller/TestController.java

    refdb71a r29c0ed0  
    11package it.finki.tinki.controller;
    22
    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;
     3import it.finki.tinki.model.Users.Account;
     4import it.finki.tinki.model.Users.Company;
     5import it.finki.tinki.model.Users.Team;
     6import it.finki.tinki.model.Users.User;
     7import it.finki.tinki.model.enumerator.AccountType;
     8import it.finki.tinki.model.pojo.AccountLoginDataPojo;
     9import it.finki.tinki.repository.CompanyRepository;
    810import 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;
     11import it.finki.tinki.repository.TeamRepository;
     12import it.finki.tinki.repository.UserRepository;
     13import it.finki.tinki.service.AccountService;
     14import org.springframework.web.bind.annotation.*;
    1215
    13 import java.util.ArrayList;
    14 import java.util.List;
     16import java.util.HashMap;
     17import java.util.Map;
    1518
    1619@RestController
    17 @RequestMapping("/")
     20@RequestMapping("/api")
    1821public class TestController {
    1922
    20     JobRepository jobRepository;
     23    AccountService accountService;
    2124
    22     public TestController(JobRepository jobRepository) {
    23         this.jobRepository = jobRepository;
     25    public TestController(AccountService accountService) {
     26        this.accountService = accountService;
    2427    }
    2528
    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());
    4332    }
    4433
Note: See TracChangeset for help on using the changeset viewer.