Ignore:
Timestamp:
02/18/24 22:01:54 (9 months ago)
Author:
ppaunovski <paunovskipavel@…>
Branches:
master
Children:
4251327
Parents:
bde8b13
Message:

All 3 main use cases implemented.

  1. Starting a commute
  2. Writing a ticket
  3. Starting an instance of a Bus Line
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/mk/ukim/finki/busngo/service/impl/KaznaServiceImpl.java

    rbde8b13 re272096  
    88import org.springframework.stereotype.Service;
    99
     10import java.sql.Timestamp;
     11import java.time.LocalDateTime;
    1012import java.util.List;
    1113
     
    3032        return kaznaRepository.findAllByKontroliByKontrolaId(kontroli);
    3133    }
     34
     35    @Override
     36    public Kazna pay(Long kaznaId) {
     37        Kazna kazna = this.findById(kaznaId);
     38        kazna.setKzPlateno(true);
     39        kazna.setKzDatumPlateno(Timestamp.valueOf(LocalDateTime.now()));
     40        return kaznaRepository.save(kazna);
     41    }
     42
     43    @Override
     44    public Kazna findById(Long id) {
     45        return kaznaRepository.findById(id).orElseThrow(RuntimeException::new);
     46    }
    3247}
Note: See TracChangeset for help on using the changeset viewer.