Ignore:
Timestamp:
01/08/21 00:35:56 (4 years ago)
Author:
Vzdra <vladko.zdravkovski@…>
Branches:
master
Children:
4cec0a3
Parents:
509cb95
Message:

added dummy data for user skills and fixed bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/it/finki/tinki/bootstrap/DataHolder.java

    r509cb95 ra8e8545  
    22
    33import it.finki.tinki.model.Address;
     4import it.finki.tinki.model.EmbeddedMatchId;
     5import it.finki.tinki.model.Jobs.Job;
     6import it.finki.tinki.model.Jobs.Work;
     7import it.finki.tinki.model.Match;
    48import it.finki.tinki.model.Skill;
     9import it.finki.tinki.model.Users.Account;
    510import it.finki.tinki.model.Users.Company;
    611import it.finki.tinki.model.Users.User;
    712import it.finki.tinki.model.enumerator.AccountType;
     13import it.finki.tinki.model.enumerator.WorkType;
    814import it.finki.tinki.repository.*;
     15import it.finki.tinki.service.AccountService;
     16import it.finki.tinki.service.WorkService;
     17import org.springframework.beans.factory.annotation.Autowired;
    918import org.springframework.stereotype.Component;
    1019
     
    1726
    1827    SkillRepository skillRepository;
    19     UserRepository userRepository;
    20     CompanyRepository companyRepository;
    21     TeamRepository teamRepository;
    22     AddressRepository addressRepository;
     28    AccountService accountService;
     29    WorkService workService;
     30    MatchRepository matchRepository;
    2331
    24     public DataHolder(SkillRepository skillRepository, UserRepository userRepository, CompanyRepository companyRepository, TeamRepository teamRepository, AddressRepository addressRepository) {
     32    public DataHolder(SkillRepository skillRepository,
     33                      AccountService accountService,
     34                      WorkService workService,
     35                      MatchRepository matchRepository) {
    2536        this.skillRepository = skillRepository;
    26         this.userRepository = userRepository;
    27         this.companyRepository = companyRepository;
    28         this.teamRepository = teamRepository;
    29         this.addressRepository = addressRepository;
     37        this.accountService = accountService;
     38        this.workService = workService;
     39        this.matchRepository = matchRepository;
    3040    }
    3141
     
    5969        lista = skillRepository.findAll();
    6070
    61         userRepository.save(new User("asdf", "asdf", "Zoki", AccountType.USER, "Poki", lista, lista));
     71        List<Long> ids = new ArrayList<>();
     72        lista.forEach(item -> {
     73            ids.add(item.getId());
     74        });
    6275
    63         addressRepository.save(new Address("asdf", "asdf", "asdf"));
    64         companyRepository.save(new Company("asdf@asdf", "pass", "Co.co", AccountType.COMPANY, addressRepository.findAll().get(0)));
     76        Account c = this.accountService.registerCompany("asdf@asdf", "pass", "Co.co", "Macedonia", "Skopje", "Pero Nakov");
     77
     78        Job j = this.workService.insertJob("Asdf", "Asdfa", c.getId() ,5000, ids, AccountType.COMPANY);
     79
     80        Account u = this.accountService.registerUser("asdf", "asdf", "Zoki", "Poki", lista, lista);
     81
    6582    }
    6683
Note: See TracChangeset for help on using the changeset viewer.