Ignore:
Timestamp:
01/06/23 19:17:05 (23 months ago)
Author:
andrejtodorovski <82031894+andrejtodorovski@…>
Branches:
main
Children:
cab5859
Parents:
d4b888e
Message:

Added full functionality for changing delivery status,
added bootstrap for some pages

Location:
src/main/java/com/example/autopartz/service
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/autopartz/service/DeliveryService.java

    rd4b888e r9dcbf44  
    33import com.example.autopartz.model.Delivery;
    44import com.example.autopartz.model.Deliveryman;
     5import com.example.autopartz.model.Order;
    56
    67import java.util.List;
     
    89public interface DeliveryService {
    910    List<Delivery> findAllByDeliverer(Deliveryman dm);
     11    Delivery findById(Integer id);
     12    void update(Delivery d);
     13    Delivery findByOrder(Order o);
    1014}
  • src/main/java/com/example/autopartz/service/impl/DeliveryServiceImpl.java

    rd4b888e r9dcbf44  
    33import com.example.autopartz.model.Delivery;
    44import com.example.autopartz.model.Deliveryman;
     5import com.example.autopartz.model.Order;
    56import com.example.autopartz.repository.DeliveryRepository;
    67import com.example.autopartz.service.DeliveryService;
     
    2122        return deliveryRepository.findAllByDeliveryman(dm);
    2223    }
     24
     25    @Override
     26    public Delivery findById(Integer id) {
     27        return deliveryRepository.findById(id).get();
     28    }
     29
     30    @Override
     31    public void update(Delivery d) {
     32        deliveryRepository.save(d);
     33    }
     34
     35    @Override
     36    public Delivery findByOrder(Order o) {
     37        return deliveryRepository.findAllByOrder(o).stream().findFirst().orElseThrow(RuntimeException::new);
     38    }
    2339}
Note: See TracChangeset for help on using the changeset viewer.