Changeset 6c1d611 for springapp/src


Ignore:
Timestamp:
07/26/22 23:09:04 (2 years ago)
Author:
unknown <mlviktor23@…>
Branches:
main
Children:
b7ec74e
Parents:
9506ca8
Message:

added basic a&a + acc confirmation email sender service

Location:
springapp/src/main
Files:
17 added
8 edited

Legend:

Unmodified
Added
Removed
  • springapp/src/main/java/mk/profesori/springapp/Controller/MainController.java

    r9506ca8 r6c1d611  
    1414import mk.profesori.springapp.Model.Faculty;
    1515import mk.profesori.springapp.Model.Professor;
     16import mk.profesori.springapp.Model.StudyProgramme;
    1617import mk.profesori.springapp.Model.University;
    1718import mk.profesori.springapp.Service.MainService;
     
    3233    @RequestMapping(value = "/professor/{professorId}", method = RequestMethod.GET)
    3334    public Professor getProfessorById(@PathVariable Long professorId) {
    34         return mainService.getProfessorById(professorId);
     35        return mainService.getProfessorById(professorId);   //vrakja profesor spored id
     36    }
     37
     38    @RequestMapping(value = "/study_programmes", method = RequestMethod.GET)
     39    public List<StudyProgramme> getStudyProgrammesByFaculty(@RequestParam Optional<Long> facultyId) {
     40
     41        if(!facultyId.isPresent()) return mainService.getAllStudyProgrammes(); //ako nema parametar facultyId gi vrakja site studiski programi
     42        return mainService.getStudyProgrammesByFacultyId(facultyId.get());
     43    }
     44
     45    @RequestMapping(value = "/study_programme/{studyProgrammeId}", method = RequestMethod.GET)
     46    public StudyProgramme getStudyProgrammeById(@PathVariable Long studyProgrammeId) {
     47        return mainService.getStudyProgrammeById(studyProgrammeId);   //vrakja studiska programa spored id
    3548    }
    3649
     
    4457    @RequestMapping(value = "/faculty/{facultyId}", method = RequestMethod.GET)
    4558    public Faculty getFacultyById(@PathVariable Long facultyId) {
    46         return mainService.getFacultyById(facultyId);
     59        return mainService.getFacultyById(facultyId); //vrakja fakultet spored id
    4760    }
    4861
     
    5669    @RequestMapping(value = "/university/{universityId}", method = RequestMethod.GET)
    5770    public University getUniversityById(@PathVariable Long universityId) {
    58         return mainService.getUniversityById(universityId);
     71        return mainService.getUniversityById(universityId); //vrakja univerzitet spored id
    5972    }
    6073
     
    6679    @RequestMapping(value = "/city/{cityId}", method = RequestMethod.GET)
    6780    public City getCityById(@PathVariable Long cityId) {
    68         return mainService.getCityById(cityId);
     81        return mainService.getCityById(cityId); //vrakja grad spored id
    6982    }
    7083
    71    
    7284}
  • springapp/src/main/java/mk/profesori/springapp/Model/StudyProgramme.java

    r9506ca8 r6c1d611  
    2929    private String studyProgrammeName;
    3030
     31    @Column(name = "cycle")
     32    private int cycle;
     33
    3134    @ManyToOne
    3235    @JoinColumn(name = "faculty_id")
     
    4548    }
    4649
     50    public int getCycle() {
     51        return cycle;
     52    }
     53
    4754    @JsonBackReference
    4855    public Faculty getFaculty() {
  • springapp/src/main/java/mk/profesori/springapp/Repository/CityRepository.java

    r9506ca8 r6c1d611  
    44
    55import org.springframework.data.repository.CrudRepository;
     6import org.springframework.stereotype.Repository;
    67
    78import mk.profesori.springapp.Model.City;
    89
     10@Repository
    911public interface CityRepository extends CrudRepository<City, Long>{
    1012
  • springapp/src/main/java/mk/profesori/springapp/Repository/FacultyRepository.java

    r9506ca8 r6c1d611  
    44
    55import org.springframework.data.repository.CrudRepository;
     6import org.springframework.stereotype.Repository;
    67
    78import mk.profesori.springapp.Model.Faculty;
    89import mk.profesori.springapp.Model.University;
    910
     11@Repository
    1012public interface FacultyRepository extends CrudRepository<Faculty, Long>{
    1113
  • springapp/src/main/java/mk/profesori/springapp/Repository/ProfessorRepository.java

    r9506ca8 r6c1d611  
    44
    55import org.springframework.data.repository.CrudRepository;
     6import org.springframework.stereotype.Repository;
    67
    78import mk.profesori.springapp.Model.Faculty;
    89import mk.profesori.springapp.Model.Professor;
    910
     11@Repository
    1012public interface ProfessorRepository extends CrudRepository<Professor, Long>{
    1113   
  • springapp/src/main/java/mk/profesori/springapp/Repository/UniversityRepository.java

    r9506ca8 r6c1d611  
    44
    55import org.springframework.data.repository.CrudRepository;
     6import org.springframework.stereotype.Repository;
    67
    78import mk.profesori.springapp.Model.City;
     
    910import mk.profesori.springapp.Model.University;
    1011
     12@Repository
    1113public interface UniversityRepository extends CrudRepository<University, Long>{
    1214
  • springapp/src/main/java/mk/profesori/springapp/Service/MainService.java

    r9506ca8 r6c1d611  
    1010import mk.profesori.springapp.Repository.FacultyRepository;
    1111import mk.profesori.springapp.Repository.ProfessorRepository;
     12import mk.profesori.springapp.Repository.StudyProgrammeRepository;
    1213import mk.profesori.springapp.Repository.UniversityRepository;
    1314import mk.profesori.springapp.Model.City;
    1415import mk.profesori.springapp.Model.Faculty;
    1516import mk.profesori.springapp.Model.Professor;
     17import mk.profesori.springapp.Model.StudyProgramme;
    1618import mk.profesori.springapp.Model.University;
    1719
     
    2123    @Autowired
    2224    private ProfessorRepository professorRepository;
     25    @Autowired
     26    private StudyProgrammeRepository studyProgrammeRepository;
    2327    @Autowired
    2428    private FacultyRepository facultyRepository;
     
    4650        List<Professor> list = new ArrayList<>();
    4751        professorRepository.findByFaculty(faculty).forEach(list::add);
     52        return list;
     53    }
     54
     55    public List<StudyProgramme> getAllStudyProgrammes() {
     56
     57        List<StudyProgramme> list = new ArrayList<>();
     58        studyProgrammeRepository.findAll().forEach(list::add);
     59        return list;
     60    }
     61
     62    public StudyProgramme getStudyProgrammeById(Long id) {
     63
     64        return studyProgrammeRepository.findByStudyProgrammeId(id);
     65    }
     66
     67    public List<StudyProgramme> getStudyProgrammesByFacultyId(Long facultyId) {
     68       
     69        Faculty faculty = facultyRepository.findByFacultyId(facultyId);
     70
     71        List<StudyProgramme> list = new ArrayList<>();
     72        studyProgrammeRepository.findByFaculty(faculty).forEach(list::add);
    4873        return list;
    4974    }
  • springapp/src/main/resources/application.properties

    r9506ca8 r6c1d611  
    22spring.datasource.username=postgres
    33spring.datasource.password=1win7337
    4 spring.jpa.hibernate.ddl-auto=none
     4spring.jpa.hibernate.ddl-auto=update
    55spring.jpa.show-sql=false
    66spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
    77spring.jpa.properties.hibernate.format_sql=true
     8server.address=192.168.0.17
     9spring.mail.host=192.168.0.24
     10spring.mail.username=mailuser
     11spring.mail.password=mailpass
     12spring.mail.port=1025
Note: See TracChangeset for help on using the changeset viewer.