Changeset 53765dd for src/main/java/edu
- Timestamp:
- 01/04/24 09:07:47 (11 months ago)
- Branches:
- master
- Children:
- e8999eb
- Parents:
- 1413ee2
- Location:
- src/main/java/edu/gjoko/schedlr
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/edu/gjoko/schedlr/config/AppSecurityConfig.java
r1413ee2 r53765dd 68 68 .antMatchers("/register_customer").permitAll() 69 69 .antMatchers("/register_business").permitAll() 70 .antMatchers("/api/nomenclature s/*").permitAll()70 .antMatchers("/api/nomenclature/*").permitAll() 71 71 .antMatchers("/api/user/me").permitAll() 72 72 .antMatchers("/api/business").permitAll() -
src/main/java/edu/gjoko/schedlr/controllers/LoginController.java
r1413ee2 r53765dd 22 22 @PostMapping(path = "/login") 23 23 public String loginCustomer(@ModelAttribute Stakeholder customer, Model model) { 24 return "redirect: homepage";24 return "redirect:login"; 25 25 } 26 26 } -
src/main/java/edu/gjoko/schedlr/controllers/rest/NomenclatureApi.java
r1413ee2 r53765dd 2 2 3 3 import edu.gjoko.schedlr.entity.BusinessType; 4 import edu.gjoko.schedlr.entity.ServiceType; 4 5 import edu.gjoko.schedlr.services.NomenclaturesService; 5 6 import lombok.AllArgsConstructor; 6 7 import org.springframework.web.bind.annotation.GetMapping; 8 import org.springframework.web.bind.annotation.PathVariable; 7 9 import org.springframework.web.bind.annotation.RequestMapping; 8 10 import org.springframework.web.bind.annotation.RestController; 9 11 12 import javax.servlet.http.HttpServletRequest; 10 13 import java.util.List; 11 14 12 15 @RestController 13 @RequestMapping("api/nomenclature s")16 @RequestMapping("api/nomenclature") 14 17 @AllArgsConstructor 15 18 public class NomenclatureApi { … … 20 23 return nomenclaturesService.getBusinessTypes(); 21 24 } 25 26 @GetMapping( "/serviceTypes/me") 27 public List<ServiceType> getServiceTypesForBusinessType( HttpServletRequest request) { 28 Long ownerId = (long) request.getSession(true).getAttribute("stakeholderId"); 29 return nomenclaturesService.findAppropriateBusinessTypesForBusinessByOwnerId(ownerId); 30 } 22 31 } -
src/main/java/edu/gjoko/schedlr/entity/Service.java
r1413ee2 r53765dd 56 56 @Column(name = "service_status") 57 57 @Enumerated(EnumType.STRING) 58 private ServiceStatus serviceStatus ;58 private ServiceStatus serviceStatus = ServiceStatus.ACTIVE; 59 59 60 60 @Column(name = "created") -
src/main/java/edu/gjoko/schedlr/repositories/ServiceTypeRepository.java
r1413ee2 r53765dd 1 1 package edu.gjoko.schedlr.repositories; 2 2 3 import edu.gjoko.schedlr.entity. BusinessType;3 import edu.gjoko.schedlr.entity.Service; 4 4 import edu.gjoko.schedlr.entity.ServiceType; 5 5 import org.springframework.data.jpa.repository.JpaRepository; 6 import org.springframework.data.jpa.repository.Modifying;7 6 import org.springframework.data.jpa.repository.Query; 8 7 import org.springframework.stereotype.Repository; 9 8 9 import java.util.List; 10 10 11 @Repository 11 12 public interface ServiceTypeRepository extends JpaRepository<ServiceType, Long> { 13 14 List<ServiceType> findAllByBusinessType_Id(Long businessTypeId); 15 16 @Query(value = "select b.businessType.serviceTypes from Business as b " + 17 " where b.owner.id = :ownerId") 18 List<ServiceType> findAppropriateBusinessTypesForBusinessByOwnerId(Long ownerId); 12 19 } -
src/main/java/edu/gjoko/schedlr/services/NomenclaturesService.java
r1413ee2 r53765dd 2 2 3 3 import edu.gjoko.schedlr.entity.BusinessType; 4 import edu.gjoko.schedlr.entity.ServiceType; 4 5 import edu.gjoko.schedlr.repositories.BusinessTypeRepository; 5 6 import edu.gjoko.schedlr.repositories.ServiceTypeRepository; … … 20 21 return businessTypeRepository.findAll(); 21 22 } 23 24 public List<ServiceType> findAppropriateBusinessTypesForBusinessByOwnerId(Long ownerId) { 25 return serviceTypeRepository.findAppropriateBusinessTypesForBusinessByOwnerId(ownerId); 26 } 22 27 }
Note:
See TracChangeset
for help on using the changeset viewer.