Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/BusNGoApplication.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/BusNGoApplication.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/BusNGoApplication.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,22 @@
+package mk.ukim.finki.busngo;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+@SpringBootApplication
+public class BusNGoApplication {
+
+    public static void main(String[] args) {
+
+
+        SpringApplication.run(BusNGoApplication.class, args);
+    }
+    @Bean
+    PasswordEncoder passwordEncoder(){
+        return new BCryptPasswordEncoder(10);
+    }
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/config/CustomUsernamePasswordAuthenticationProvider.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/config/CustomUsernamePasswordAuthenticationProvider.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/config/CustomUsernamePasswordAuthenticationProvider.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,46 @@
+package mk.ukim.finki.busngo.config;
+
+import mk.ukim.finki.busngo.service.KorisnikService;
+import org.springframework.security.authentication.AuthenticationProvider;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CustomUsernamePasswordAuthenticationProvider implements AuthenticationProvider {
+
+    private final KorisnikService userService;
+    private final PasswordEncoder passwordEncoder;
+
+    public CustomUsernamePasswordAuthenticationProvider(KorisnikService userService, PasswordEncoder passwordEncoder) {
+        this.userService = userService;
+        this.passwordEncoder = passwordEncoder;
+    }
+
+    @Override
+    public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+        String username = authentication.getName();
+        String password = authentication.getCredentials().toString();
+
+        if (username.isEmpty() || password.isEmpty()) {
+            throw new BadCredentialsException("Empty credentials!");
+        }
+
+        UserDetails userDetails = this.userService.loadUserByEmail(username);
+
+        if (!passwordEncoder.matches(password, userDetails.getPassword())) {
+            throw new BadCredentialsException("Password is incorrect!");
+        }
+        return new UsernamePasswordAuthenticationToken(userDetails, userDetails.getPassword(), userDetails.getAuthorities());
+    }
+
+    @Override
+    public boolean supports(Class<?> aClass) {
+        return aClass.equals(UsernamePasswordAuthenticationToken.class);
+    }
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/config/WebSecurityConfig.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/config/WebSecurityConfig.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/config/WebSecurityConfig.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,73 @@
+package mk.ukim.finki.busngo.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.UserDetailsService;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.web.SecurityFilterChain;
+
+
+@Configuration
+@EnableWebSecurity
+@EnableMethodSecurity
+public class WebSecurityConfig {
+
+    private final PasswordEncoder passwordEncoder;
+    private final CustomUsernamePasswordAuthenticationProvider authProvider;
+
+    public WebSecurityConfig(PasswordEncoder passwordEncoder, CustomUsernamePasswordAuthenticationProvider authProvider) {
+        this.passwordEncoder = passwordEncoder;
+        this.authProvider = authProvider;
+    }
+
+    @Bean
+    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception  {
+
+        http
+                .csrf(AbstractHttpConfigurer::disable)
+                .authorizeHttpRequests( (requests) -> requests
+                        .requestMatchers("/", "/home", "/assets/**", "/register")
+                        .permitAll()
+                        .requestMatchers("/admin/**").hasRole("ADMIN")
+                        .anyRequest()
+                        .authenticated()
+                )
+                .formLogin((form) -> form
+                        .loginPage("/login")
+                        .permitAll()
+                        .failureUrl("/login?error=BadCredentials")
+                        .defaultSuccessUrl("/bilet", true)
+                )
+                .logout((logout) -> logout
+                        .logoutUrl("/logout")
+                        .clearAuthentication(true)
+                        .invalidateHttpSession(true)
+                        .deleteCookies("JSESSIONID")
+                        .logoutSuccessUrl("/login")
+                )
+                .exceptionHandling((ex) -> ex
+                        .accessDeniedPage("/access_denied")
+                );
+
+        return http.build();
+    }
+
+
+
+    @Bean
+    public AuthenticationManager authManager(HttpSecurity http) throws Exception {
+        AuthenticationManagerBuilder authenticationManagerBuilder =
+                http.getSharedObject(AuthenticationManagerBuilder.class);
+        authenticationManagerBuilder.authenticationProvider(authProvider);
+        return authenticationManagerBuilder.build();
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Avtobus.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Avtobus.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Avtobus.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,24 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Avtobus {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "a_registracija")
+    private String aRegistracija;
+    @Basic
+    @Column(name = "a_seriski_broj")
+    private String aSeriskiBroj;
+    @Basic
+    @Column(name = "a_broj_sedista")
+    private Short aBrojSedista;
+    @OneToMany(mappedBy = "avtobusByARegistracija")
+    private List<Instancanalinija> instancanalinijaList;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Bilet.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Bilet.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Bilet.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,39 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+import mk.ukim.finki.busngo.model.enums.BILET_STATUS;
+import org.hibernate.annotations.Type;
+
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Bilet {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "b_id")
+    private Long BId;
+
+    @Basic
+    @Column(name = "b_datum_na_kupuvanje")
+    private Timestamp bDatumNaKupuvanje;
+
+    @Basic
+    @Column(name = "b_status", columnDefinition = "string_kratok")
+    @Enumerated(EnumType.STRING)
+    private BILET_STATUS bStatus;
+
+    @ManyToOne
+    @JoinColumn(name = "patnik_k_id", referencedColumnName = "k_id")
+    private Patnik korisnikByPatnikKId;
+
+    @ManyToOne
+    @JoinColumn(name = "tb_id", referencedColumnName = "tb_id")
+    private Tipbilet tipbiletByTbId;
+//    @OneToMany(mappedBy = "biletByBId")
+//    private List<Vozenje> vozenjesByBId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Instancanalinija.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Instancanalinija.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Instancanalinija.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,37 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Instancanalinija {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "inl_id")
+    private Long inlId;
+    @Basic
+    @Column(name = "inl_datum_start")
+    private Timestamp inlDatumStart;
+    @Basic
+    @Column(name = "inl_datum_end")
+    private Timestamp inlDatumEnd;
+    @ManyToOne
+    @JoinColumn(name = "vozac_k_id", referencedColumnName = "k_id", nullable = false)
+    private Vozac korisnikByVozacKId;
+    @ManyToOne
+    @JoinColumn(name = "a_registracija", referencedColumnName = "a_registracija")
+    private Avtobus avtobusByARegistracija;
+    @ManyToOne
+    @JoinColumn(name = "li_id", referencedColumnName = "li_id", nullable = false)
+    private Linija linijaByLiId;
+    @OneToMany(mappedBy = "instancanalinijaByInlId")
+    private List<Kontroli> kontrolisByInlId;
+    @OneToMany(mappedBy = "instancanalinijaByInlId")
+    private List<Vozenje> vozenjesByInlId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kazna.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kazna.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kazna.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,51 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.sql.Timestamp;
+import java.util.Objects;
+
+@Data
+@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
+public class Kazna {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "kz_id")
+    private Long kzId;
+
+    @Basic
+    @Column(name = "kz_iznos")
+    private Double kzIznos;
+
+    @Basic
+    @Column(name = "kz_plateno")
+    private Boolean kzPlateno;
+
+    @Basic
+    @Column(name = "kz_datum")
+    private Timestamp kzDatum;
+
+    @Basic
+    @Column(name = "kz_datum_plateno")
+    private Timestamp kzDatumPlateno;
+
+    @Basic
+    @Column(name = "kz_dokument")
+    private String kzDokument;
+
+    @ManyToOne
+    @JoinColumn(name = "kondukter_k_id", referencedColumnName = "k_id")
+    private Kondukter korisnikByKondukterKId;
+
+    @ManyToOne
+    @JoinColumn(name = "kontrola_id", referencedColumnName = "kontrola_id")
+    private Kontroli kontroliByKontrolaId;
+
+//    @OneToOne(mappedBy = "kaznaByKzId")
+//    private Kaznazaneregistriran kaznazaneregistriranByKzId;
+//
+//    @OneToOne(mappedBy = "kaznaByKzId")
+//    private Kaznazaregistriran kaznazaregistriranByKzId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kaznazaneregistriran.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kaznazaneregistriran.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kaznazaneregistriran.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,22 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.util.Objects;
+
+@Data
+@Entity
+public class Kaznazaneregistriran extends Kazna {
+    @Basic
+    @Column(name = "kzn_telefon")
+    private String kznTelefon;
+
+    @Basic
+    @Column(name = "kzn_ime")
+    private String kznIme;
+
+    @Basic
+    @Column(name = "kzn_adresa")
+    private String kznAdresa;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kaznazaregistriran.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kaznazaregistriran.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kaznazaregistriran.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,14 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.util.Objects;
+
+@Data
+@Entity
+public class Kaznazaregistriran extends Kazna{
+    @ManyToOne
+    @JoinColumn(name = "patnik_k_id", referencedColumnName = "k_id")
+    private Patnik korisnikByPatnikKId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kondukter.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kondukter.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kondukter.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,19 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+import java.util.Objects;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Entity
+public class Kondukter extends Vraboten{
+    @OneToMany(mappedBy = "korisnikByKondukterKId")
+    private List<Kazna> kaznasByKId;
+    @OneToMany(mappedBy = "korisnikByKondukterKId")
+    private List<Kontroli> kontrolisByKId;
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kontroli.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kontroli.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Kontroli.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,30 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.sql.Timestamp;
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Kontroli {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "kontrola_id")
+    private Long kontrolaId;
+    @Basic
+    @Column(name = "kontrola_datum")
+    private Timestamp kontrolaDatum;
+    @OneToMany(mappedBy = "kontroliByKontrolaId")
+    private List<Kazna> kaznasByKontrolaId;
+    @ManyToOne
+    @JoinColumn(name = "kondukter_k_id", referencedColumnName = "k_id")
+    private Kondukter korisnikByKondukterKId;
+    @ManyToOne
+    @JoinColumn(name = "inl_id", referencedColumnName = "inl_id")
+    private Instancanalinija instancanalinijaByInlId;
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Korisnik.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Korisnik.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Korisnik.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,119 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+import mk.ukim.finki.busngo.model.enums.Role;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.userdetails.UserDetails;
+
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+@Inheritance(strategy = InheritanceType.JOINED)
+public class Korisnik implements UserDetails {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "k_id")
+    private Long kId;
+
+    @Basic
+    @Column(name = "k_ime")
+    private String kIme;
+
+    @Basic
+    @Column(name = "k_adresa")
+    private String kAdresa;
+
+    @Basic
+    @Column(name = "k_telefon")
+    private String kTelefon;
+
+    @Basic
+    @Column(name = "k_email")
+    private String kEmail;
+
+    @Basic
+    @Column(name = "k_embg")
+    private String kEmbg;
+
+    @Basic
+    @Column(name = "k_is_admin")
+    private Boolean kIsAdmin;
+
+    @Basic
+    @Column(name = "k_lozinka")
+    private String kLozinka;
+
+    @Basic
+    @Column(name = "k_role")
+    @Enumerated(EnumType.STRING)
+    private Role kRole;
+
+//    @OneToMany(mappedBy = "korisnikByPatnikKId")
+//    private List<Bilet> biletsByKId;
+//    private boolean isAccountNonExpired = true;
+//    private boolean isAccountNonLocked = true;
+//    private boolean isCredentialsNonExpired =  true;
+//    private boolean isEnabled = true;
+
+
+    @Override
+    public Collection<? extends GrantedAuthority> getAuthorities() {
+        return Collections.singletonList(kRole);
+    }
+
+    @Override
+    public String getPassword() {
+        return kLozinka;
+    }
+
+    @Override
+    public String getUsername() {
+        return kEmail;
+    }
+
+    @Override
+    public boolean isAccountNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isAccountNonLocked() {
+        return true;
+    }
+
+    @Override
+    public boolean isCredentialsNonExpired() {
+        return true;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return true;
+    }
+
+
+//    @OneToMany(mappedBy = "korisnikByVozacKId")
+//    private List<Instancanalinija> instancanalinijasByKId;
+//    @OneToMany(mappedBy = "korisnikByKondukterKId")
+//    private List<Kazna> kaznasByKId;
+//    @OneToMany(mappedBy = "korisnikByPatnikKId")
+//    private List<Kaznazaregistriran> kaznazaregistriransByKId;
+//    @OneToOne(mappedBy = "korisnikByKId")
+//    private Kondukter kondukterByKId;
+//    @OneToMany(mappedBy = "korisnikByKondukterKId")
+//    private List<Kontroli> kontrolisByKId;
+//    @OneToOne(mappedBy = "korisnikByKId")
+//    private Patnik patnikByKId;
+//    @OneToOne(mappedBy = "korisnikByKId")
+//    private Vozac vozacByKId;
+//    @OneToMany(mappedBy = "korisnikByPatnikKId")
+//    private List<Vozenje> vozenjesByKId;
+//    @OneToOne(mappedBy = "korisnikByKId")
+//    private Vraboten vrabotenByKId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Linija.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Linija.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Linija.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,29 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.lang.invoke.CallSite;
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Linija {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "li_id")
+    private Integer liId;
+    @Basic
+    @Column(name = "li_ime")
+    private String liIme;
+    @Basic
+    @Column(name = "li_pravec")
+    private String liPravec;
+    @OneToMany(mappedBy = "linijaByLiId")
+    private List<Instancanalinija> instancanalinijasByLiId;
+    @OneToMany(mappedBy = "linijaByLiId")
+    private List<Postojkanalinija> postojkanalinijasByLiId;
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Mesto.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Mesto.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Mesto.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,28 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Mesto {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "m_id")
+    private Integer mId;
+    @Basic
+    @Column(name = "m_grad")
+    private String mGrad;
+    @Basic
+    @Column(name = "m_opstina")
+    private String mOpstina;
+    @Basic
+    @Column(name = "m_ulica")
+    private String mUlica;
+    @OneToMany(mappedBy = "mestoByMId")
+    private List<Postojka> postojkasByMId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Patnik.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Patnik.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Patnik.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,22 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+import java.util.Objects;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Entity
+public class Patnik extends Korisnik {
+    @OneToMany(mappedBy = "korisnikByPatnikKId")
+    private List<Bilet> biletsByKId;
+
+    @OneToMany(mappedBy = "korisnikByPatnikKId")
+    private List<Kaznazaregistriran> kaznazaregistriransByKId;
+
+    @OneToMany(mappedBy = "korisnikByPatnikKId")
+    private List<Vozenje> vozenjesByKId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Postojka.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Postojka.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Postojka.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,26 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Postojka {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "p_id")
+    private Integer pId;
+    @Basic
+    @Column(name = "p_ime")
+    private String pIme;
+    @ManyToOne
+    @JoinColumn(name = "m_id", referencedColumnName = "m_id")
+    private Mesto mestoByMId;
+    @OneToMany(mappedBy = "postojkaByPId")
+    private List<Postojkanalinija> postojkanalinijasByPId;
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Postojkanalinija.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Postojkanalinija.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Postojkanalinija.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,28 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Postojkanalinija {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "pnl_id")
+    private Long pnlId;
+    @Basic
+    @Column(name = "pnl_reden_broj")
+    private Short pnlRedenBroj;
+    @ManyToOne
+    @JoinColumn(name = "li_id", referencedColumnName = "li_id", nullable = false)
+    private Linija linijaByLiId;
+    @ManyToOne
+    @JoinColumn(name = "p_id", referencedColumnName = "p_id", nullable = false)
+    private Postojka postojkaByPId;
+    @OneToMany(mappedBy = "postojkanalinijaByKacuvaPnlId")
+    private List<Vozenje> vozenjesByPnlId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/SeSimnuvaNa.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/SeSimnuvaNa.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/SeSimnuvaNa.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,17 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.util.Objects;
+
+@Data
+@Entity
+//@jakarta.persistence.Table(name = "se_simnuva_na", schema = "project", catalog = "db_202324z_va_prj_busngo")
+//@jakarta.persistence.IdClass(mk.ukim.finki.busngo.model.entities.SeSimnuvaNaPK.class)
+public class SeSimnuvaNa {
+    @EmbeddedId
+    private SeSimnuvaNaPK id;
+
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/SeSimnuvaNaPK.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/SeSimnuvaNaPK.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/SeSimnuvaNaPK.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,13 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.Embeddable;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@Embeddable
+public class SeSimnuvaNaPK implements Serializable {
+    private Long vozenjeId;
+    private Long pnlId;
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Tipbilet.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Tipbilet.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Tipbilet.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,30 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Tipbilet {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "tb_id", columnDefinition = "serial")
+    private Long tbId;
+    @Basic
+    @Column(name = "tb_trajnost")
+    private Long tbTrajnost;
+    @Basic
+    @Column(name = "tb_cena")
+    private Float tbCena;
+    @Basic
+    @Column(name = "tb_ime")
+    private String tbIme;
+    @OneToMany(mappedBy = "tipbiletByTbId")
+    private List<Bilet> biletsByTbId;
+
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vozac.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vozac.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vozac.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,17 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+import java.util.Objects;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Entity
+public class Vozac extends Vraboten {
+    @OneToMany(mappedBy = "korisnikByVozacKId")
+    private List<Instancanalinija> instancanalinijasByKId;
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vozenje.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vozenje.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vozenje.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,40 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+import mk.ukim.finki.busngo.model.enums.VOZENJE_STATUS;
+
+import java.sql.Timestamp;
+import java.util.Objects;
+
+@Data
+@Entity
+public class Vozenje {
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Id
+    @Column(name = "vozenje_id")
+    private Long vozenjeId;
+    @Basic
+    @Column(name = "vozenje_start")
+    private Timestamp vozenjeStart;
+    @Basic
+    @Column(name = "vozenje_end")
+    private Timestamp vozenjeEnd;
+    @Basic
+    @Column(name = "vozenje_status")
+    @Enumerated(EnumType.STRING)
+    private VOZENJE_STATUS vozenjeStatus;
+    @ManyToOne
+    @JoinColumn(name = "patnik_k_id", referencedColumnName = "k_id")
+    private Patnik korisnikByPatnikKId;
+    @ManyToOne
+    @JoinColumn(name = "kacuva_pnl_id", referencedColumnName = "pnl_id", nullable = false)
+    private Postojkanalinija postojkanalinijaByKacuvaPnlId;
+    @ManyToOne
+    @JoinColumn(name = "inl_id", referencedColumnName = "inl_id", nullable = false)
+    private Instancanalinija instancanalinijaByInlId;
+    @ManyToOne
+    @JoinColumn(name = "b_id", referencedColumnName = "b_id", nullable = false)
+    private Bilet biletByBId;
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vraboten.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vraboten.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/entities/Vraboten.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,27 @@
+package mk.ukim.finki.busngo.model.entities;
+
+import jakarta.persistence.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+
+import java.sql.Date;
+import java.util.Objects;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Entity
+public class Vraboten extends Korisnik {
+    @Basic
+    @Column(name = "v_plata")
+    private Double vPlata;
+
+    @Basic
+    @Column(name = "v_datum_na_vrabotuvanje")
+    private Date vDatumNaVrabotuvanje;
+
+    @Basic
+    @Column(name = "v_datum_prekin_vrabotuvanje")
+    private Date vDatumPrekinVrabotuvanje;
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/BILET_STATUS.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/BILET_STATUS.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/BILET_STATUS.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.enums;
+
+public enum BILET_STATUS {
+    INACTIVE,
+    ACTIVE,
+    EXPIRED
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/Role.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/Role.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/Role.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,18 @@
+package mk.ukim.finki.busngo.model.enums;
+
+
+import org.springframework.security.core.GrantedAuthority;
+
+public enum Role implements GrantedAuthority {
+    ROLE_USER,
+    ROLE_PASSENGER,
+    ROLE_DRIVER,
+    ROLE_CONDUCTOR,
+    ROLE_ADMIN;
+
+
+    @Override
+    public String getAuthority() {
+        return name();
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/VOZENJE_STATUS.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/VOZENJE_STATUS.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/VOZENJE_STATUS.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,6 @@
+package mk.ukim.finki.busngo.model.enums;
+
+public enum VOZENJE_STATUS {
+    ACTIVE,
+    FINISHED
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/VrabotenType.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/VrabotenType.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/enums/VrabotenType.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.enums;
+
+public enum VrabotenType {
+    KONDUKTER,
+    VOZAC,
+    ADMIN
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidAvtobusRegistracijaException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidAvtobusRegistracijaException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidAvtobusRegistracijaException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidAvtobusRegistracijaException extends RuntimeException{
+    public InvalidAvtobusRegistracijaException() {
+        super("Invalid avtobus registracija!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidBiletIdException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidBiletIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidBiletIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidBiletIdException extends RuntimeException{
+    public InvalidBiletIdException() {
+        super("Invalid bilet id!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidCredentialsException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidCredentialsException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidCredentialsException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidCredentialsException extends RuntimeException{
+    public InvalidCredentialsException() {
+        super("The credentials entered are invalid!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidInstancaNaLinijaIdException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidInstancaNaLinijaIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidInstancaNaLinijaIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidInstancaNaLinijaIdException extends RuntimeException{
+    public InvalidInstancaNaLinijaIdException() {
+        super("Invalid instanca na linija id!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidLinijaIdException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidLinijaIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidLinijaIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidLinijaIdException extends RuntimeException{
+    public InvalidLinijaIdException() {
+        super("Invalid linija id!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidPatnikIdException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidPatnikIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidPatnikIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidPatnikIdException extends RuntimeException{
+    public InvalidPatnikIdException() {
+        super("The given patnik id does not exist!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidPostojkaNaLinijaIdException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidPostojkaNaLinijaIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidPostojkaNaLinijaIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidPostojkaNaLinijaIdException extends RuntimeException {
+    public InvalidPostojkaNaLinijaIdException() {
+        super("Invalid postoja na linija id!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidTipBiletIdException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidTipBiletIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidTipBiletIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidTipBiletIdException extends RuntimeException{
+    public InvalidTipBiletIdException() {
+        super("Invalid tipbilet id!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidUserId.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidUserId.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidUserId.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidUserId extends RuntimeException{
+    public InvalidUserId() {
+        super("The iven user id does not exist!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidVozacIdException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidVozacIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidVozacIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidVozacIdException extends RuntimeException{
+    public InvalidVozacIdException() {
+        super("Invalid vozac id!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidVozenjeIdException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidVozenjeIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/InvalidVozenjeIdException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class InvalidVozenjeIdException extends RuntimeException{
+    public InvalidVozenjeIdException() {
+        super("Inavlid vozenje id!");
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UnauthorizedAccess.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UnauthorizedAccess.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UnauthorizedAccess.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class UnauthorizedAccess extends RuntimeException {
+    public UnauthorizedAccess(String message) {
+        super(message);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UserAlreadyExistsException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UserAlreadyExistsException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UserAlreadyExistsException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class UserAlreadyExistsException extends RuntimeException{
+    public UserAlreadyExistsException(String message) {
+        super(message);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UserShouldNotBeTicketedException.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UserShouldNotBeTicketedException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/model/exceptions/UserShouldNotBeTicketedException.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.model.exceptions;
+
+public class UserShouldNotBeTicketedException extends RuntimeException{
+    public UserShouldNotBeTicketedException(String message) {
+        super(message);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/AvtobusRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/AvtobusRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/AvtobusRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,12 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Avtobus;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.Optional;
+
+public interface AvtobusRepository extends JpaRepository<Avtobus, Long> {
+    @Query("select a from Avtobus a where a.aRegistracija = ?1")
+    Optional<Avtobus> findByARegistracija(String registracija);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/BiletRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/BiletRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/BiletRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,18 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Bilet;
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.enums.BILET_STATUS;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+import java.util.Optional;
+
+
+public interface BiletRepository extends JpaRepository<Bilet, Long> {
+//    List<Bilet> findAllByKorisnikByPatnikKIdAndBStatus(Korisnik korisnik, BILET_STATUS status);
+//    List<Bilet> findAllByKorisnikByPatnikKId(Korisnik korisnik);
+    Optional<Bilet> findByBIdAndAndKorisnikByPatnikKId(Long bid, Patnik patnik);
+//    List<Bilet> findAllByKorisnikByPatnikKIdAndBStatus(Patnik patnik, BILET_STATUS status);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/InstancaNaLinijaRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/InstancaNaLinijaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/InstancaNaLinijaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,13 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Instancanalinija;
+import mk.ukim.finki.busngo.model.entities.Linija;
+import mk.ukim.finki.busngo.service.LinijaService;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+
+public interface InstancaNaLinijaRepository extends JpaRepository<Instancanalinija, Long> {
+    List<Instancanalinija> findAllByLinijaByLiIdAndInlDatumEndIsNull(Linija linija);
+    List<Instancanalinija> findAllByInlDatumEndIsNull();
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,13 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Kazna;
+import mk.ukim.finki.busngo.model.entities.Kontroli;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.NoRepositoryBean;
+
+import java.util.List;
+
+
+public interface KaznaRepository extends JpaRepository<Kazna, Long> {
+    List<Kazna> findAllByKontroliByKontrolaId(Kontroli kontroli);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaZaNeregistriranRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaZaNeregistriranRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaZaNeregistriranRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Kaznazaneregistriran;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface KaznaZaNeregistriranRepository extends JpaRepository<Kaznazaneregistriran, Long> {
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaZaRegistriranRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaZaRegistriranRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KaznaZaRegistriranRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,11 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Kaznazaregistriran;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+
+public interface KaznaZaRegistriranRepository extends JpaRepository<Kaznazaregistriran, Long> {
+    List<Kaznazaregistriran> findAllByKorisnikByPatnikKId(Patnik patnik);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KondukterRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KondukterRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KondukterRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,13 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Kondukter;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.Optional;
+
+public interface KondukterRepository extends JpaRepository<Kondukter, Long> {
+    @Query("SELECT p from Kondukter p where p.kEmail = ?1")
+    Optional<Kondukter> findByKEmail(String email);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KontrolaRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KontrolaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KontrolaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,11 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Instancanalinija;
+import mk.ukim.finki.busngo.model.entities.Kontroli;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+
+public interface KontrolaRepository extends JpaRepository<Kontroli, Long> {
+    List<Kontroli> findAllByInstancanalinijaByInlId(Instancanalinija inl);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KorisnikRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KorisnikRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/KorisnikRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,17 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import org.aspectj.apache.bcel.classfile.Module;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.NoRepositoryBean;
+
+import java.util.Optional;
+
+
+public interface KorisnikRepository extends JpaRepository<Korisnik, Long> {
+    @Query("SELECT k FROM Korisnik k WHERE k.kEmail = ?1 and k.kLozinka = ?2")
+    Optional<Korisnik> findByKEmailAndKLozinka(String kEmail, String kLozinka);
+    @Query("SELECT k FROM Korisnik k WHERE k.kEmail = ?1")
+    Optional<Korisnik> findByKEmail(String kEmail);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/LinijaRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/LinijaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/LinijaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,7 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Linija;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface LinijaRepository extends JpaRepository<Linija, Long> {
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/PatnikRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/PatnikRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/PatnikRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,14 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Optional;
+
+public interface PatnikRepository extends JpaRepository<Patnik, Long> {
+    @Query("SELECT p from Patnik p where p.kEmail = ?1")
+    Optional<Patnik> findByKEmail(String email);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/PostojkaNaLinijaRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/PostojkaNaLinijaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/PostojkaNaLinijaRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,14 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Linija;
+import mk.ukim.finki.busngo.model.entities.Postojkanalinija;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.query.Jpa21Utils;
+
+import java.util.List;
+import java.util.Optional;
+
+public interface PostojkaNaLinijaRepository extends JpaRepository<Postojkanalinija, Long> {
+    List<Postojkanalinija> findAllByLinijaByLiId(Linija linija);
+    List<Postojkanalinija> findAllByLinijaByLiIdAndPnlRedenBrojGreaterThan(Linija linija, Short redenBroj);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/TipBIletRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/TipBIletRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/TipBIletRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,8 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Tipbilet;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface TipBIletRepository extends JpaRepository<Tipbilet, Long> {
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VozacRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VozacRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VozacRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,14 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.entities.Vozac;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.Optional;
+
+public interface VozacRepository extends JpaRepository<Vozac, Long> {
+
+    @Query("SELECT v from Vozac v where v.kEmail = ?1")
+    Optional<Vozac> findByKEmail(String email);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VozenjeRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VozenjeRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VozenjeRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,13 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.entities.Vozenje;
+import mk.ukim.finki.busngo.model.enums.VOZENJE_STATUS;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+import java.util.List;
+
+public interface VozenjeRepository extends JpaRepository<Vozenje, Long> {
+    List<Vozenje> findAllByKorisnikByPatnikKId(Patnik patnik);
+    List<Vozenje> findAllByKorisnikByPatnikKIdAndAndVozenjeStatus(Patnik patnik, VOZENJE_STATUS vozenjeStatus);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VrabotrenRepository.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VrabotrenRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/repository/VrabotrenRepository.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,8 @@
+package mk.ukim.finki.busngo.repository;
+
+import mk.ukim.finki.busngo.model.entities.Vraboten;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface VrabotrenRepository extends JpaRepository<Vraboten, Long> {
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/AuthService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/AuthService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/AuthService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,13 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.enums.Role;
+import mk.ukim.finki.busngo.model.enums.VrabotenType;
+
+public interface AuthService {
+    Korisnik login(String email, String password);
+    Korisnik registerPatnik(String ime, String email, String password, String confirmPassword, String address, String telefon);
+    Korisnik registerVraboten(String ime, String email, String password, String confirmPassword, String address, String telefon, VrabotenType type, Double salary);
+
+    Korisnik register(String name, String email, String password, String confirmPassword, String address, String phone, Role role, Double salary);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/AvtobusService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/AvtobusService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/AvtobusService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,12 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Avtobus;
+import mk.ukim.finki.busngo.repository.AvtobusRepository;
+
+import java.util.List;
+
+public interface AvtobusService {
+    List<Avtobus> findAll();
+
+    Avtobus findById(String aRegistracija);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/BiletService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/BiletService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/BiletService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,27 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Bilet;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.enums.BILET_STATUS;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+public interface BiletService {
+    List<Bilet> listAll();
+    List<Bilet> findAllByPatnikId(Long id);
+    List<Bilet> findAllByPatnikIdAndStatus(Long id, BILET_STATUS status);
+
+    Bilet buy(Long tipbilet, LocalDateTime now, BILET_STATUS biletStatus, String name);
+
+    List<Bilet> findAllByPatnikEmail(String email);
+//    List<Bilet> findAllByPatnikEmailACTIVE(String email);
+    Bilet findBybIdAndPatnikEmail(Long bId, String email);
+
+    Bilet activate(Long bId);
+    Bilet findById(Long bId);
+    Bilet finish(Long bId);
+
+    boolean checkExpiration(Long bId);
+//    void encode();
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/InstancaNaLinijaService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/InstancaNaLinijaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/InstancaNaLinijaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,17 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Instancanalinija;
+
+import javax.swing.event.ListDataEvent;
+import java.time.LocalDateTime;
+import java.util.List;
+
+public interface InstancaNaLinijaService {
+    List<Instancanalinija> findAll();
+    Instancanalinija findById(Long inlId);
+    Instancanalinija start(Long liId, String a_registracija, String email);
+    Instancanalinija end(Long inlId, String email);
+    List<Instancanalinija> findAllActive();
+
+    List<Instancanalinija> findByPnlId(Long pnlId);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,12 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Kazna;
+
+import java.util.List;
+
+public interface KaznaService {
+    List<Kazna> findAll();
+    List<Kazna> findAllByKontrolaId(Long kontrolaId);
+    Kazna pay(Long kaznaId);
+    Kazna findById(Long id);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaZaNeregistriranService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaZaNeregistriranService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaZaNeregistriranService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,20 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Kaznazaneregistriran;
+import mk.ukim.finki.busngo.model.entities.Kaznazaregistriran;
+import org.springframework.security.core.Authentication;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+public interface KaznaZaNeregistriranService {
+    List<Kaznazaneregistriran> findAll();
+    Kaznazaneregistriran findById(Long id);
+    Kaznazaneregistriran create(Long kontrolaId,
+                                 String dokument,
+                                Double iznos,
+                                 String telefon,
+                                 String ime,
+                                 String adresa,
+                                String email);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaZaRegistriranService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaZaRegistriranService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KaznaZaRegistriranService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,15 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Kazna;
+import mk.ukim.finki.busngo.model.entities.Kaznazaregistriran;
+import mk.ukim.finki.busngo.model.exceptions.UserShouldNotBeTicketedException;
+
+import java.util.List;
+
+public interface KaznaZaRegistriranService {
+    List<Kaznazaregistriran> findAllByPatnik(String email);
+
+    Kaznazaregistriran create(Long kontrolaId, String dokument, Double iznos, Long patnik, String email) throws UserShouldNotBeTicketedException;
+    Kaznazaregistriran pay(Long kaznaId);
+    Kaznazaregistriran findById(Long id);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KondukterService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KondukterService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KondukterService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,10 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Kondukter;
+
+import java.util.List;
+
+public interface KondukterService {
+    List<Kondukter> findAll();
+    Kondukter findByEmail(String email);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KontrolaService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KontrolaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KontrolaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,14 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Kontroli;
+
+import java.util.List;
+
+public interface KontrolaService {
+    List<Kontroli> findAll();
+    Kontroli create(Long inlId, String email);
+
+    Kontroli findById(Long kontrolaId);
+
+    List<Kontroli> findAllByInl(Long inlId);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KorisnikService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KorisnikService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/KorisnikService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,14 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.enums.Role;
+
+
+import java.util.List;
+
+public interface KorisnikService {
+    List<Korisnik> listAll();
+    Korisnik findById(Long id);
+    Korisnik loadUserByEmail(String email);
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/LinijaService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/LinijaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/LinijaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,11 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Linija;
+
+import java.util.List;
+
+public interface LinijaService {
+    List<Linija> findAll();
+
+    Linija findById(Long liId);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/PatnikService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/PatnikService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/PatnikService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,16 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Bilet;
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+
+import java.util.List;
+
+public interface PatnikService {
+    List<Patnik> listAll();
+    Patnik findById(Long id);
+    Patnik loadUserByEmail(String email);
+
+    Patnik save(Korisnik korisnik);
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/PostojkaNaLinijaService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/PostojkaNaLinijaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/PostojkaNaLinijaService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,12 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Postojkanalinija;
+
+import java.util.List;
+
+public interface PostojkaNaLinijaService {
+    List<Postojkanalinija> findAll();
+    Postojkanalinija findById(Long id);
+    List<Postojkanalinija> findByLinija(Long liId);
+    List<Postojkanalinija> findByLinijaAfterRedenBroj(Long liId, Short redenBroj);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/TipBiletService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/TipBiletService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/TipBiletService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,9 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Tipbilet;
+
+import java.util.List;
+
+public interface TipBiletService {
+    List<Tipbilet> listAll();
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/VozacService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/VozacService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/VozacService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,11 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Vozac;
+import mk.ukim.finki.busngo.repository.VozacRepository;
+
+import java.util.List;
+
+public interface VozacService {
+    List<Vozac> findAll();
+    Vozac findByEmail(String email);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/VozenjeService.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/VozenjeService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/VozenjeService.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,14 @@
+package mk.ukim.finki.busngo.service;
+
+import mk.ukim.finki.busngo.model.entities.Vozenje;
+import mk.ukim.finki.busngo.model.enums.VOZENJE_STATUS;
+
+import java.util.List;
+
+public interface VozenjeService {
+    List<Vozenje> findVozenjaByPatnik(String email);
+    List<Vozenje> findVozenjaByPatnikAndStatus(String email, VOZENJE_STATUS status);
+    Vozenje start(String email, Long bId, Long pnlId, Long inlId);
+    Vozenje end(Long vozenjeId, Long pnlId);
+    Vozenje findById(Long id);
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/AuthServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/AuthServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/AuthServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,182 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Kondukter;
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.entities.Vozac;
+import mk.ukim.finki.busngo.model.enums.Role;
+import mk.ukim.finki.busngo.model.enums.VrabotenType;
+import mk.ukim.finki.busngo.model.exceptions.InvalidCredentialsException;
+import mk.ukim.finki.busngo.model.exceptions.UserAlreadyExistsException;
+import mk.ukim.finki.busngo.repository.KondukterRepository;
+import mk.ukim.finki.busngo.repository.KorisnikRepository;
+import mk.ukim.finki.busngo.repository.PatnikRepository;
+import mk.ukim.finki.busngo.repository.VozacRepository;
+import mk.ukim.finki.busngo.service.*;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Service;
+
+import java.sql.Date;
+import java.time.LocalDate;
+
+@Service
+public class AuthServiceImpl implements AuthService {
+    private final KorisnikRepository korisnikRepository;
+    private final PatnikRepository patnikRepository;
+    private final VozacRepository vozacRepository;
+    private final KondukterRepository kondukterRepository;
+    private final PasswordEncoder passwordEncoder;
+    private final PatnikService patnikService;
+    private final KondukterService kondukterService;
+    private final VozacService vozacService;
+
+    public AuthServiceImpl(KorisnikRepository korisnikRepository, PatnikRepository patnikRepository, VozacRepository vozacRepository, KondukterRepository kondukterRepository, PasswordEncoder passwordEncoder, PatnikService patnikService, KondukterService kondukterService, VozacService vozacService) {
+        this.korisnikRepository = korisnikRepository;
+        this.patnikRepository = patnikRepository;
+        this.vozacRepository = vozacRepository;
+        this.kondukterRepository = kondukterRepository;
+        this.passwordEncoder = passwordEncoder;
+        this.patnikService = patnikService;
+        this.kondukterService = kondukterService;
+        this.vozacService = vozacService;
+    }
+
+    @Override
+    public Korisnik login(String email, String password) {
+        if(email == null || password == null || email.isEmpty() || password.isEmpty())
+            throw new InvalidCredentialsException();
+        return korisnikRepository.findByKEmailAndKLozinka(email, password).orElseThrow(InvalidCredentialsException::new);
+    }
+
+    @Override
+    public Korisnik registerPatnik(String ime, String email, String password, String confirmPassword, String address, String telefon) {
+        if (email == null || password == null || email.isEmpty() || password.isEmpty()) {
+            throw new InvalidCredentialsException();
+        }
+
+        if (!password.equals(confirmPassword)) {
+            throw new InvalidCredentialsException();
+        }
+
+        if(this.korisnikRepository.findByKEmail(email).isPresent()) {
+            throw new UserAlreadyExistsException(email);
+        }
+
+        Patnik korisnik = new Patnik();
+        korisnik.setKIme(ime);
+        korisnik.setKAdresa(address);
+        korisnik.setKLozinka(passwordEncoder.encode(password));
+        korisnik.setKEmail(email);
+        korisnik.setKTelefon(telefon);
+        korisnik.setKIsAdmin(false);
+
+        return patnikRepository.save(korisnik);
+    }
+
+    @Override
+    public Korisnik registerVraboten(String ime, String email, String password, String confirmPassword, String address, String telefon, VrabotenType type, Double salary) {
+        if (email == null || password == null || email.isEmpty() || password.isEmpty()) {
+            throw new InvalidCredentialsException();
+        }
+
+        if (!password.equals(confirmPassword)) {
+            throw new InvalidCredentialsException();
+        }
+
+        if(this.korisnikRepository.findByKEmail(email).isPresent()) {
+            throw new UserAlreadyExistsException(email);
+        }
+
+
+        switch (type){
+            case ADMIN:
+                Korisnik korisnik = new Korisnik();
+                korisnik.setKIme(ime);
+                korisnik.setKAdresa(address);
+                korisnik.setKLozinka(passwordEncoder.encode(password));
+                korisnik.setKEmail(email);
+                korisnik.setKTelefon(telefon);
+                korisnik.setKIsAdmin(true);
+                return korisnikRepository.save(korisnik);
+            case VOZAC:
+                Vozac vozac = new Vozac();
+                vozac.setKIme(ime);
+                vozac.setKAdresa(address);
+                vozac.setKLozinka(passwordEncoder.encode(password));
+                vozac.setKEmail(email);
+                vozac.setKTelefon(telefon);
+                vozac.setKIsAdmin(false);
+                vozac.setVPlata(salary);
+                vozac.setVDatumNaVrabotuvanje(Date.valueOf(LocalDate.now()));
+                this.korisnikRepository.save(vozac);
+
+                return vozacRepository.save(vozac);
+            case KONDUKTER:
+                Kondukter kondukter = new Kondukter();
+                kondukter.setKIme(ime);
+                kondukter.setKAdresa(address);
+                kondukter.setKLozinka(passwordEncoder.encode(password));
+                kondukter.setKEmail(email);
+                kondukter.setKTelefon(telefon);
+                kondukter.setKIsAdmin(false);
+                kondukter.setVPlata(salary);
+                kondukter.setVDatumNaVrabotuvanje(Date.valueOf(LocalDate.now()));
+                this.korisnikRepository.save(kondukter);
+
+                return kondukterRepository.save(kondukter);
+        }
+        return null;
+    }
+
+    @Override
+    public Korisnik register(String name, String email, String password, String confirmPassword, String address, String phone, Role role, Double salary) {
+        if (email == null || password == null || email.isEmpty() || password.isEmpty()) {
+            throw new InvalidCredentialsException();
+        }
+
+        if(!password.equals(confirmPassword)){
+            throw new InvalidCredentialsException();
+        }
+
+        if(role.equals(Role.ROLE_DRIVER)){
+            Vozac vozac = new Vozac();
+            vozac.setKIme(name);
+            vozac.setKAdresa(address);
+            vozac.setKLozinka(passwordEncoder.encode(password));
+            vozac.setKEmail(email);
+            vozac.setKTelefon(phone);
+            vozac.setKIsAdmin(role.equals(Role.ROLE_ADMIN));
+            vozac.setKRole(role);
+            vozac.setVPlata(salary != null ? salary : 0.0);
+            vozac.setVDatumNaVrabotuvanje(Date.valueOf(LocalDate.now()));
+            this.korisnikRepository.save(vozac);
+            return vozacRepository.save(vozac);
+        } else if(role.equals(Role.ROLE_CONDUCTOR)){
+            Kondukter kondukter = new Kondukter();
+            kondukter.setKIme(name);
+            kondukter.setKAdresa(address);
+            kondukter.setKLozinka(passwordEncoder.encode(password));
+            kondukter.setKEmail(email);
+            kondukter.setKTelefon(phone);
+            kondukter.setKIsAdmin(role.equals(Role.ROLE_ADMIN));
+            kondukter.setKRole(role);
+            kondukter.setVPlata(salary != null ? salary : 0.0);
+            kondukter.setVDatumNaVrabotuvanje(Date.valueOf(LocalDate.now()));
+            this.korisnikRepository.save(kondukter);
+            return kondukterRepository.save(kondukter);
+        } else {
+            Patnik patnik = new Patnik();
+            patnik.setKIme(name);
+            patnik.setKAdresa(address);
+            patnik.setKLozinka(passwordEncoder.encode(password));
+            patnik.setKEmail(email);
+            patnik.setKTelefon(phone);
+            patnik.setKIsAdmin(role.equals(Role.ROLE_ADMIN));
+            patnik.setKRole(role);
+            this.korisnikRepository.save(patnik);
+            return patnikRepository.save(patnik);
+        }
+    }
+
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/AvtobusServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/AvtobusServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/AvtobusServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,28 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Avtobus;
+import mk.ukim.finki.busngo.model.exceptions.InvalidAvtobusRegistracijaException;
+import mk.ukim.finki.busngo.repository.AvtobusRepository;
+import mk.ukim.finki.busngo.service.AvtobusService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class AvtobusServiceImpl implements AvtobusService {
+    private final AvtobusRepository avtobusRepository;
+
+    public AvtobusServiceImpl(AvtobusRepository avtobusRepository) {
+        this.avtobusRepository = avtobusRepository;
+    }
+
+    @Override
+    public List<Avtobus> findAll() {
+        return avtobusRepository.findAll();
+    }
+
+    @Override
+    public Avtobus findById(String aRegistracija) {
+        return avtobusRepository.findByARegistracija(aRegistracija).orElseThrow(InvalidAvtobusRegistracijaException::new);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/BiletServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/BiletServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/BiletServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,135 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Bilet;
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.entities.Tipbilet;
+import mk.ukim.finki.busngo.model.enums.BILET_STATUS;
+import mk.ukim.finki.busngo.model.exceptions.InvalidBiletIdException;
+import mk.ukim.finki.busngo.model.exceptions.InvalidTipBiletIdException;
+import mk.ukim.finki.busngo.repository.BiletRepository;
+import mk.ukim.finki.busngo.repository.KorisnikRepository;
+import mk.ukim.finki.busngo.repository.TipBIletRepository;
+import mk.ukim.finki.busngo.service.BiletService;
+import mk.ukim.finki.busngo.service.KorisnikService;
+import mk.ukim.finki.busngo.service.PatnikService;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.stereotype.Service;
+import org.thymeleaf.expression.Lists;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class BiletServiceImpl implements BiletService {
+    private final BiletRepository biletRepository;
+    private final KorisnikService korisnikService;
+    private final TipBIletRepository tipBIletRepository;
+    private final PatnikService patnikService;
+    private final PasswordEncoder passwordEncoder;
+    private final KorisnikRepository korisnikRepository;
+
+    public BiletServiceImpl(BiletRepository biletRepository, KorisnikService korisnikService, TipBIletRepository tipBIletRepository, PatnikService patnikService, PasswordEncoder passwordEncoder, KorisnikRepository korisnikRepository) {
+        this.biletRepository = biletRepository;
+        this.korisnikService = korisnikService;
+        this.tipBIletRepository = tipBIletRepository;
+        this.patnikService = patnikService;
+        this.passwordEncoder = passwordEncoder;
+        this.korisnikRepository = korisnikRepository;
+    }
+
+    @Override
+    public List<Bilet> listAll() {
+        return biletRepository.findAll();
+    }
+
+    @Override
+    public List<Bilet> findAllByPatnikId(Long id) {
+        Patnik patnik = patnikService.findById(id);
+        return patnik.getBiletsByKId();
+    }
+
+    @Override
+    public List<Bilet> findAllByPatnikIdAndStatus(Long id, BILET_STATUS status) {
+        Korisnik korisnik = korisnikService.findById(id);
+        return new ArrayList<>();
+    }
+
+    @Override
+    public Bilet buy(Long tipbilet, LocalDateTime now, BILET_STATUS biletStatus, String name) {
+        Tipbilet tipbilet1 = tipBIletRepository.findById(tipbilet).orElseThrow(InvalidTipBiletIdException::new);
+        Patnik korisnik = patnikService.loadUserByEmail(name);
+        Bilet bilet = new Bilet();
+        bilet.setBStatus(biletStatus);
+        bilet.setTipbiletByTbId(tipbilet1);
+        bilet.setBDatumNaKupuvanje(Timestamp.valueOf(now));
+        bilet.setKorisnikByPatnikKId(korisnik);
+        return biletRepository.save(bilet);
+    }
+
+    @Override
+    public List<Bilet> findAllByPatnikEmail(String email) {
+        Patnik patnik = patnikService.loadUserByEmail(email);
+        return patnik.getBiletsByKId();
+    }
+
+//    @Override
+//    public List<Bilet> findAllByPatnikEmailACTIVE(String email) {
+//        Patnik patnik = patnikService.loadUserByEmail(email);
+//        List<Bilet> allByKorisnikByPatnikKIdAndBStatus = biletRepository.findAllByKorisnikByPatnikKIdAndBStatus(patnik, BILET_STATUS.ACTIVE);
+//        List<Bilet> allByKorisnikByPatnikKIdAndBStatus1 = biletRepository.findAllByKorisnikByPatnikKIdAndBStatus(patnik, BILET_STATUS.INACTIVE);
+//        allByKorisnikByPatnikKIdAndBStatus1.addAll(allByKorisnikByPatnikKIdAndBStatus);
+//        return allByKorisnikByPatnikKIdAndBStatus1;
+//    }
+
+    @Override
+    public Bilet findBybIdAndPatnikEmail(Long bId, String email) {
+        Patnik patnik = patnikService.loadUserByEmail(email);
+        return biletRepository.findByBIdAndAndKorisnikByPatnikKId(bId, patnik).orElseThrow(InvalidBiletIdException::new);
+    }
+
+    @Override
+    public Bilet activate(Long bId) {
+        Bilet bilet = this.findById(bId);
+        bilet.setBStatus(BILET_STATUS.ACTIVE);
+        return biletRepository.save(bilet);
+    }
+
+    @Override
+    public Bilet findById(Long bId) {
+        return biletRepository.findById(bId).orElseThrow(RuntimeException::new);
+    }
+
+    @Override
+    public Bilet finish(Long bId) {
+        Bilet bilet = this.findById(bId);
+        bilet.setBStatus(BILET_STATUS.EXPIRED);
+        return biletRepository.save(bilet);
+    }
+
+    @Override
+    public boolean checkExpiration(Long bId) {
+        Bilet bilet = this.findById(bId);
+        LocalDateTime timeBought = bilet.getBDatumNaKupuvanje().toLocalDateTime();
+
+        if(timeBought.plusSeconds(bilet.getTipbiletByTbId().getTbTrajnost()).isBefore(LocalDateTime.now())){
+            bilet.setBStatus(BILET_STATUS.EXPIRED);
+            biletRepository.save(bilet);
+            return true;
+        }
+
+        return false;
+    }
+
+//    @Override
+//    public void encode(){
+//        List<Korisnik> all = korisnikRepository.findAll();
+//        all.forEach(p -> p.setKLozinka(passwordEncoder.encode(p.getKLozinka())));
+//        korisnikRepository.saveAll(all);
+//        System.out.println("DONE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+//    }
+
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/InstancaNaLinijaServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/InstancaNaLinijaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/InstancaNaLinijaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,72 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.*;
+import mk.ukim.finki.busngo.model.exceptions.InvalidInstancaNaLinijaIdException;
+import mk.ukim.finki.busngo.repository.InstancaNaLinijaRepository;
+import mk.ukim.finki.busngo.service.*;
+import org.springframework.stereotype.Service;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Service
+public class InstancaNaLinijaServiceImpl implements InstancaNaLinijaService{
+    private final InstancaNaLinijaRepository instancaNaLinijaRepository;
+    private final VozacService vozacService;
+    private final AvtobusService avtobusService;
+    private final LinijaService linijaService;
+    private final PostojkaNaLinijaService postojkaNaLinijaService;
+
+    public InstancaNaLinijaServiceImpl(InstancaNaLinijaRepository instancaNaLinijaRepository, VozacService vozacService, AvtobusService avtobusService, LinijaService linijaService, PostojkaNaLinijaService postojkaNaLinijaService) {
+        this.instancaNaLinijaRepository = instancaNaLinijaRepository;
+        this.vozacService = vozacService;
+        this.avtobusService = avtobusService;
+        this.linijaService = linijaService;
+        this.postojkaNaLinijaService = postojkaNaLinijaService;
+    }
+
+    @Override
+    public List<Instancanalinija> findAll() {
+        return instancaNaLinijaRepository.findAll();
+    }
+
+    @Override
+    public Instancanalinija findById(Long inlId) {
+        return instancaNaLinijaRepository.findById(inlId).orElseThrow(InvalidInstancaNaLinijaIdException::new);
+    }
+
+    @Override
+    public Instancanalinija start(Long liId, String a_registracija, String email) {
+        Linija linija = linijaService.findById(liId);
+        Avtobus avtobus = avtobusService.findById(a_registracija);
+        Vozac vozac = vozacService.findByEmail(email);
+        Instancanalinija instancanalinija = new Instancanalinija();
+        instancanalinija.setLinijaByLiId(linija);
+        instancanalinija.setAvtobusByARegistracija(avtobus);
+        instancanalinija.setKorisnikByVozacKId(vozac);
+        instancanalinija.setInlDatumStart(Timestamp.valueOf(LocalDateTime.now()));
+
+        return instancaNaLinijaRepository.save(instancanalinija);
+    }
+
+    @Override
+    public Instancanalinija end(Long inlId, String email) {
+        Vozac vozac = vozacService.findByEmail(email);
+        Instancanalinija instancanalinija = this.findById(inlId);
+        instancanalinija.setInlDatumEnd(Timestamp.valueOf(LocalDateTime.now()));
+        return instancaNaLinijaRepository.save(instancanalinija);
+    }
+
+    @Override
+    public List<Instancanalinija> findAllActive() {
+        return instancaNaLinijaRepository.findAllByInlDatumEndIsNull();
+    }
+
+    @Override
+    public List<Instancanalinija> findByPnlId(Long pnlId) {
+        Postojkanalinija postojkanalinija = postojkaNaLinijaService.findById(pnlId);
+        Linija linijaByLiId = postojkanalinija.getLinijaByLiId();
+        return instancaNaLinijaRepository.findAllByLinijaByLiIdAndInlDatumEndIsNull(linijaByLiId);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,47 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Kazna;
+import mk.ukim.finki.busngo.model.entities.Kontroli;
+import mk.ukim.finki.busngo.repository.KaznaRepository;
+import mk.ukim.finki.busngo.service.KaznaService;
+import mk.ukim.finki.busngo.service.KontrolaService;
+import org.springframework.stereotype.Service;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Service
+public class KaznaServiceImpl implements KaznaService {
+    private final KaznaRepository kaznaRepository;
+    private final KontrolaService kontrolaService;
+
+    public KaznaServiceImpl(KaznaRepository kaznaRepository, KontrolaService kontrolaService) {
+        this.kaznaRepository = kaznaRepository;
+        this.kontrolaService = kontrolaService;
+    }
+
+    @Override
+    public List<Kazna> findAll() {
+        return kaznaRepository.findAll();
+    }
+
+    @Override
+    public List<Kazna> findAllByKontrolaId(Long kontrolaId) {
+        Kontroli kontroli = kontrolaService.findById(kontrolaId);
+        return kaznaRepository.findAllByKontroliByKontrolaId(kontroli);
+    }
+
+    @Override
+    public Kazna pay(Long kaznaId) {
+        Kazna kazna = this.findById(kaznaId);
+        kazna.setKzPlateno(true);
+        kazna.setKzDatumPlateno(Timestamp.valueOf(LocalDateTime.now()));
+        return kaznaRepository.save(kazna);
+    }
+
+    @Override
+    public Kazna findById(Long id) {
+        return kaznaRepository.findById(id).orElseThrow(RuntimeException::new);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaZaNeregistriranServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaZaNeregistriranServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaZaNeregistriranServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,53 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Kaznazaneregistriran;
+import mk.ukim.finki.busngo.model.entities.Kondukter;
+import mk.ukim.finki.busngo.model.entities.Kontroli;
+import mk.ukim.finki.busngo.repository.KaznaZaNeregistriranRepository;
+import mk.ukim.finki.busngo.service.KaznaZaNeregistriranService;
+import mk.ukim.finki.busngo.service.KondukterService;
+import mk.ukim.finki.busngo.service.KontrolaService;
+import org.springframework.stereotype.Service;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.List;
+@Service
+public class KaznaZaNeregistriranServiceImpl implements KaznaZaNeregistriranService {
+    private final KaznaZaNeregistriranRepository kaznaZaNeregistriranRepository;
+    private final KontrolaService kontrolaService;
+    private final KondukterService kondukterService;
+
+    public KaznaZaNeregistriranServiceImpl(KaznaZaNeregistriranRepository kaznaZaNeregistriranRepository, KontrolaService kontrolaService, KondukterService kondukterService) {
+        this.kaznaZaNeregistriranRepository = kaznaZaNeregistriranRepository;
+        this.kontrolaService = kontrolaService;
+        this.kondukterService = kondukterService;
+    }
+
+    @Override
+    public List<Kaznazaneregistriran> findAll() {
+        return kaznaZaNeregistriranRepository.findAll();
+    }
+
+    @Override
+    public Kaznazaneregistriran findById(Long id) {
+        return kaznaZaNeregistriranRepository.findById(id).orElseThrow(RuntimeException::new);
+    }
+
+    @Override
+    public Kaznazaneregistriran create(Long kontrolaId, String dokument, Double iznos, String telefon, String ime, String adresa, String email) {
+        Kondukter byEmail = kondukterService.findByEmail(email);
+        Kontroli kontroli = kontrolaService.findById(kontrolaId);
+        Kaznazaneregistriran kaznazaneregistriran = new Kaznazaneregistriran();
+        kaznazaneregistriran.setKznAdresa(adresa);
+        kaznazaneregistriran.setKznIme(ime);
+        kaznazaneregistriran.setKznTelefon(telefon);
+        kaznazaneregistriran.setKzDatum(Timestamp.valueOf(LocalDateTime.now()));
+        kaznazaneregistriran.setKontroliByKontrolaId(kontroli);
+        kaznazaneregistriran.setKorisnikByKondukterKId(byEmail);
+        kaznazaneregistriran.setKzIznos(iznos);
+        kaznazaneregistriran.setKzDokument(dokument);
+        kaznazaneregistriran.setKzPlateno(false);
+        return kaznaZaNeregistriranRepository.save(kaznazaneregistriran);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaZaRegistriranServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaZaRegistriranServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KaznaZaRegistriranServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,76 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.*;
+import mk.ukim.finki.busngo.model.exceptions.UserShouldNotBeTicketedException;
+import mk.ukim.finki.busngo.repository.KaznaZaRegistriranRepository;
+import mk.ukim.finki.busngo.service.KaznaZaRegistriranService;
+import mk.ukim.finki.busngo.service.KondukterService;
+import mk.ukim.finki.busngo.service.KontrolaService;
+import mk.ukim.finki.busngo.service.PatnikService;
+import org.springframework.stereotype.Service;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+public class KaznaZaRegistriranServiceImpl implements KaznaZaRegistriranService {
+    private final PatnikService patnikService;
+    private final KaznaZaRegistriranRepository kaznaZaRegistriranRepository;
+    private final KontrolaService kontrolaService;
+    private final KondukterService kondukterService;
+
+    public KaznaZaRegistriranServiceImpl(PatnikService patnikService, KaznaZaRegistriranRepository kaznaZaRegistriranRepository, KontrolaService kontrolaService, KondukterService kondukterService) {
+        this.patnikService = patnikService;
+        this.kaznaZaRegistriranRepository = kaznaZaRegistriranRepository;
+        this.kontrolaService = kontrolaService;
+        this.kondukterService = kondukterService;
+    }
+
+    @Override
+    public List<Kaznazaregistriran> findAllByPatnik(String email) {
+        Patnik patnik = patnikService.loadUserByEmail(email);
+        return kaznaZaRegistriranRepository.findAllByKorisnikByPatnikKId(patnik);
+    }
+
+    @Override
+    public Kaznazaregistriran create(Long kontrolaId, String dokument, Double iznos, Long patnik, String email) {
+        Kontroli kontroli = kontrolaService.findById(kontrolaId);
+        Kondukter kondukter = kondukterService.findByEmail(email);
+        Patnik patnik1 = patnikService.findById(patnik);
+        Kaznazaregistriran kaznazaregistriran = new Kaznazaregistriran();
+        kaznazaregistriran.setKzDatum(Timestamp.valueOf(LocalDateTime.now()));
+        kaznazaregistriran.setKzDokument(dokument);
+        kaznazaregistriran.setKzIznos(iznos);
+        kaznazaregistriran.setKzPlateno(false);
+        kaznazaregistriran.setKontroliByKontrolaId(kontroli);
+        kaznazaregistriran.setKorisnikByPatnikKId(patnik1);
+        kaznazaregistriran.setKorisnikByKondukterKId(kondukter);
+        List<Vozenje> vozenjeList = patnik1.getVozenjesByKId().stream()
+                .filter(v -> v.getInstancanalinijaByInlId().getInlId().equals(kontroli.getInstancanalinijaByInlId().getInlId()))
+                .toList();
+        if(vozenjeList.isEmpty())
+            return kaznaZaRegistriranRepository.save(kaznazaregistriran);
+
+        throw new UserShouldNotBeTicketedException(String.format("Patnik with id: %d and email: %s has valid vozenje for the %d instance!",
+                patnik1.getKId(),
+                patnik1.getKEmail(),
+                kontroli.getInstancanalinijaByInlId().getInlId()));
+    }
+
+    @Override
+    public Kaznazaregistriran pay(Long kaznaId) {
+        Kaznazaregistriran kazna = this.findById(kaznaId);
+        if(!kazna.getKzPlateno()){
+            kazna.setKzPlateno(true);
+            kazna.setKzDatumPlateno(Timestamp.valueOf(LocalDateTime.now()));
+        }
+        return kaznaZaRegistriranRepository.save(kazna);
+    }
+
+    @Override
+    public Kaznazaregistriran findById(Long id) {
+        return kaznaZaRegistriranRepository.findById(id).orElseThrow(RuntimeException::new);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KondukterServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KondukterServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KondukterServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,28 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Kondukter;
+import mk.ukim.finki.busngo.model.exceptions.InvalidUserId;
+import mk.ukim.finki.busngo.repository.KondukterRepository;
+import mk.ukim.finki.busngo.service.KondukterService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class KondukterServiceImpl implements KondukterService {
+    private final KondukterRepository kondukterRepository;
+
+    public KondukterServiceImpl(KondukterRepository kondukterRepository) {
+        this.kondukterRepository = kondukterRepository;
+    }
+
+    @Override
+    public List<Kondukter> findAll() {
+        return kondukterRepository.findAll();
+    }
+
+    @Override
+    public Kondukter findByEmail(String email) {
+        return kondukterRepository.findByKEmail(email).orElseThrow(InvalidUserId::new);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KontrolaServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KontrolaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KontrolaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,55 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Instancanalinija;
+import mk.ukim.finki.busngo.model.entities.Kondukter;
+import mk.ukim.finki.busngo.model.entities.Kontroli;
+import mk.ukim.finki.busngo.repository.KontrolaRepository;
+import mk.ukim.finki.busngo.service.InstancaNaLinijaService;
+import mk.ukim.finki.busngo.service.KondukterService;
+import mk.ukim.finki.busngo.service.KontrolaService;
+import org.springframework.stereotype.Service;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Service
+public class KontrolaServiceImpl implements KontrolaService {
+    private final KontrolaRepository kontrolaRepository;
+    private final KondukterService kondukterService;
+    private final InstancaNaLinijaService instancaNaLinijaService;
+
+    public KontrolaServiceImpl(KontrolaRepository kontrolaRepository, KondukterService kondukterService, InstancaNaLinijaService instancaNaLinijaService) {
+        this.kontrolaRepository = kontrolaRepository;
+        this.kondukterService = kondukterService;
+        this.instancaNaLinijaService = instancaNaLinijaService;
+    }
+
+    @Override
+    public List<Kontroli> findAll() {
+        return kontrolaRepository.findAll();
+    }
+
+    @Override
+    public Kontroli create(Long inlId, String email) {
+        Kondukter kondukter = kondukterService.findByEmail(email);
+        Instancanalinija instancanalinija = instancaNaLinijaService.findById(inlId);
+        Kontroli kontroli = new Kontroli();
+        kontroli.setKontrolaDatum(Timestamp.valueOf(LocalDateTime.now()));
+        kontroli.setKorisnikByKondukterKId(kondukter);
+        kontroli.setInstancanalinijaByInlId(instancanalinija);
+
+        return kontrolaRepository.save(kontroli);
+    }
+
+    @Override
+    public Kontroli findById(Long kontrolaId) {
+        return kontrolaRepository.findById(kontrolaId).orElseThrow(RuntimeException::new);
+    }
+
+    @Override
+    public List<Kontroli> findAllByInl(Long inlId) {
+        Instancanalinija instancanalinija = instancaNaLinijaService.findById(inlId);
+        return kontrolaRepository.findAllByInstancanalinijaByInlId(instancanalinija);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KorisnikServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KorisnikServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/KorisnikServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,35 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.enums.Role;
+import mk.ukim.finki.busngo.model.exceptions.InvalidUserId;
+import mk.ukim.finki.busngo.repository.KorisnikRepository;
+import mk.ukim.finki.busngo.service.KorisnikService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class KorisnikServiceImpl implements KorisnikService {
+    private final KorisnikRepository korisnikRepository;
+
+    public KorisnikServiceImpl(KorisnikRepository korisnikRepository) {
+        this.korisnikRepository = korisnikRepository;
+    }
+
+
+    @Override
+    public List<Korisnik> listAll() {
+        return korisnikRepository.findAll();
+    }
+
+    @Override
+    public Korisnik findById(Long id) {
+        return korisnikRepository.findById(id).orElseThrow(InvalidUserId::new);
+    }
+
+    @Override
+    public Korisnik loadUserByEmail(String email) {
+        return korisnikRepository.findByKEmail(email).orElseThrow(InvalidUserId::new);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/LinijaServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/LinijaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/LinijaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,29 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Linija;
+import mk.ukim.finki.busngo.model.exceptions.InvalidLinijaIdException;
+import mk.ukim.finki.busngo.repository.LinijaRepository;
+import mk.ukim.finki.busngo.service.LinijaService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class LinijaServiceImpl implements LinijaService {
+
+    private final LinijaRepository linijaRepository;
+
+    public LinijaServiceImpl(LinijaRepository linijaRepository) {
+        this.linijaRepository = linijaRepository;
+    }
+
+    @Override
+    public List<Linija> findAll() {
+        return linijaRepository.findAll();
+    }
+
+    @Override
+    public Linija findById(Long liId) {
+        return linijaRepository.findById(liId).orElseThrow(InvalidLinijaIdException::new);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/PatnikServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/PatnikServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/PatnikServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,55 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Instancanalinija;
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.exceptions.InvalidPatnikIdException;
+import mk.ukim.finki.busngo.repository.PatnikRepository;
+import mk.ukim.finki.busngo.service.InstancaNaLinijaService;
+import mk.ukim.finki.busngo.service.PatnikService;
+import org.springframework.stereotype.Service;
+
+import java.util.Collections;
+import java.util.List;
+
+@Service
+public class PatnikServiceImpl implements PatnikService {
+    private final PatnikRepository patnikRepository;
+    private final InstancaNaLinijaService instancaNaLinijaService;
+
+    public PatnikServiceImpl(PatnikRepository patnikRepository, InstancaNaLinijaService instancaNaLinijaService) {
+        this.patnikRepository = patnikRepository;
+        this.instancaNaLinijaService = instancaNaLinijaService;
+    }
+
+    @Override
+    public List<Patnik> listAll() {
+        return  patnikRepository.findAll();
+    }
+
+    @Override
+    public Patnik findById(Long id) {
+        return patnikRepository.findById(id).orElseThrow(InvalidPatnikIdException::new);
+    }
+
+    @Override
+    public Patnik loadUserByEmail(String email) {
+        return patnikRepository.findByKEmail(email).orElseThrow(InvalidPatnikIdException::new);
+    }
+
+    @Override
+    public Patnik save(Korisnik korisnik) {
+        Patnik patnik = new Patnik();
+        patnik.setKId(korisnik.getKId());
+        patnik.setKEmail(korisnik.getKEmail());
+        patnik.setKAdresa(korisnik.getKAdresa());
+        patnik.setKIme(korisnik.getKIme());
+        patnik.setKTelefon(korisnik.getKTelefon());
+        patnik.setKIsAdmin(korisnik.getKIsAdmin());
+        patnik.setKLozinka(korisnik.getKLozinka());
+
+        return patnikRepository.save((Patnik) korisnik);
+    }
+
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/PostojkaNaLinijaServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/PostojkaNaLinijaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/PostojkaNaLinijaServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,44 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Linija;
+import mk.ukim.finki.busngo.model.entities.Postojkanalinija;
+import mk.ukim.finki.busngo.model.exceptions.InvalidPostojkaNaLinijaIdException;
+import mk.ukim.finki.busngo.repository.PostojkaNaLinijaRepository;
+import mk.ukim.finki.busngo.service.LinijaService;
+import mk.ukim.finki.busngo.service.PostojkaNaLinijaService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class PostojkaNaLinijaServiceImpl implements PostojkaNaLinijaService {
+    private final PostojkaNaLinijaRepository postojkaNaLinijaRepository;
+    private final LinijaService linijaService;
+
+    public PostojkaNaLinijaServiceImpl(PostojkaNaLinijaRepository postojkaNaLinijaRepository, LinijaService linijaService) {
+        this.postojkaNaLinijaRepository = postojkaNaLinijaRepository;
+        this.linijaService = linijaService;
+    }
+
+    @Override
+    public List<Postojkanalinija> findAll() {
+        return postojkaNaLinijaRepository.findAll();
+    }
+
+    @Override
+    public Postojkanalinija findById(Long id) {
+        return postojkaNaLinijaRepository.findById(id).orElseThrow(InvalidPostojkaNaLinijaIdException::new);
+    }
+
+    @Override
+    public List<Postojkanalinija> findByLinija(Long liId) {
+        Linija linija = linijaService.findById(liId);
+        return postojkaNaLinijaRepository.findAllByLinijaByLiId(linija);
+    }
+
+    @Override
+    public List<Postojkanalinija> findByLinijaAfterRedenBroj(Long liId, Short redenBroj) {
+        Linija linija = linijaService.findById(liId);
+        return postojkaNaLinijaRepository.findAllByLinijaByLiIdAndPnlRedenBrojGreaterThan(linija, redenBroj);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/TipBiletServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/TipBiletServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/TipBiletServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,22 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Tipbilet;
+import mk.ukim.finki.busngo.repository.TipBIletRepository;
+import mk.ukim.finki.busngo.service.TipBiletService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class TipBiletServiceImpl implements TipBiletService {
+    private final TipBIletRepository tipBIletRepository;
+
+    public TipBiletServiceImpl(TipBIletRepository tipBIletRepository) {
+        this.tipBIletRepository = tipBIletRepository;
+    }
+
+    @Override
+    public List<Tipbilet> listAll() {
+        return tipBIletRepository.findAll();
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/VozacServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/VozacServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/VozacServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,28 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.Vozac;
+import mk.ukim.finki.busngo.model.exceptions.InvalidVozacIdException;
+import mk.ukim.finki.busngo.repository.VozacRepository;
+import mk.ukim.finki.busngo.service.VozacService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class VozacServiceImpl implements VozacService {
+    private final VozacRepository vozacRepository;
+
+    public VozacServiceImpl(VozacRepository vozacRepository) {
+        this.vozacRepository = vozacRepository;
+    }
+
+    @Override
+    public List<Vozac> findAll() {
+        return vozacRepository.findAll();
+    }
+
+    @Override
+    public Vozac findByEmail(String email) {
+        return vozacRepository.findByKEmail(email).orElseThrow(InvalidVozacIdException::new);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/VozenjeServiceImpl.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/VozenjeServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/service/impl/VozenjeServiceImpl.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,81 @@
+package mk.ukim.finki.busngo.service.impl;
+
+import mk.ukim.finki.busngo.model.entities.*;
+import mk.ukim.finki.busngo.model.enums.BILET_STATUS;
+import mk.ukim.finki.busngo.model.enums.VOZENJE_STATUS;
+import mk.ukim.finki.busngo.model.exceptions.InvalidVozenjeIdException;
+import mk.ukim.finki.busngo.repository.VozenjeRepository;
+import mk.ukim.finki.busngo.service.*;
+import org.springframework.stereotype.Service;
+
+import java.sql.Timestamp;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Service
+public class VozenjeServiceImpl  implements VozenjeService {
+    private final VozenjeRepository vozenjeRepository;
+    private final PatnikService patnikService;
+    private final BiletService biletService;
+    private final PostojkaNaLinijaService postojkaNaLinijaService;
+    private final InstancaNaLinijaService instancaNaLinijaService;
+
+    public VozenjeServiceImpl(VozenjeRepository vozenjeRepository, PatnikService patnikService, BiletService biletService, PostojkaNaLinijaService postojkaNaLinijaService, InstancaNaLinijaService instancaNaLinijaService) {
+        this.vozenjeRepository = vozenjeRepository;
+        this.patnikService = patnikService;
+        this.biletService = biletService;
+        this.postojkaNaLinijaService = postojkaNaLinijaService;
+        this.instancaNaLinijaService = instancaNaLinijaService;
+    }
+
+    @Override
+    public List<Vozenje> findVozenjaByPatnik(String email) {
+        Patnik patnik = patnikService.loadUserByEmail(email);
+        return vozenjeRepository.findAllByKorisnikByPatnikKId(patnik);
+    }
+
+    @Override
+    public List<Vozenje> findVozenjaByPatnikAndStatus(String email, VOZENJE_STATUS status) {
+        Patnik patnik = patnikService.loadUserByEmail(email);
+        return vozenjeRepository.findAllByKorisnikByPatnikKIdAndAndVozenjeStatus(patnik, status);
+    }
+
+    @Override
+    public Vozenje start(String email, Long bId, Long pnlId, Long inlId) {
+        Patnik patnik = patnikService.loadUserByEmail(email);
+        Bilet bilet = biletService.findBybIdAndPatnikEmail(bId, email);
+        Postojkanalinija postojkanalinija = postojkaNaLinijaService.findById(pnlId);
+        Instancanalinija instancanalinija = instancaNaLinijaService.findById(inlId);
+
+        Vozenje vozenje = new Vozenje();
+        vozenje.setVozenjeStart(Timestamp.valueOf(LocalDateTime.now()));
+        vozenje.setVozenjeStatus(VOZENJE_STATUS.ACTIVE);
+        vozenje.setInstancanalinijaByInlId(instancanalinija);
+        vozenje.setKorisnikByPatnikKId(patnik);
+        vozenje.setPostojkanalinijaByKacuvaPnlId(postojkanalinija);
+
+        if(bilet.getBStatus().equals(BILET_STATUS.INACTIVE))
+            bilet = biletService.activate(bId);
+        else if(biletService.checkExpiration(bId))
+            throw new RuntimeException("Bilet is expired!");
+        else if(bilet.getBStatus().equals(BILET_STATUS.EXPIRED))
+            throw new RuntimeException("Bilet is expired!");
+
+        vozenje.setBiletByBId(bilet);
+        return vozenjeRepository.save(vozenje);
+    }
+
+    @Override
+    public Vozenje end(Long vozenjeId, Long pnlId) {
+        // TODO : Relacija se simnuva na pnlId
+        Vozenje vozenje = this.findById(vozenjeId);
+        vozenje.setVozenjeEnd(Timestamp.valueOf(LocalDateTime.now()));
+        vozenje.setVozenjeStatus(VOZENJE_STATUS.FINISHED);
+        return vozenjeRepository.save(vozenje);
+    }
+
+    @Override
+    public Vozenje findById(Long id) {
+        return vozenjeRepository.findById(id).orElseThrow(InvalidVozenjeIdException::new);
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/BiletController.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/BiletController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/BiletController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,75 @@
+package mk.ukim.finki.busngo.web;
+
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.enums.BILET_STATUS;
+import mk.ukim.finki.busngo.model.exceptions.InvalidPatnikIdException;
+import mk.ukim.finki.busngo.service.AuthService;
+import mk.ukim.finki.busngo.service.BiletService;
+import mk.ukim.finki.busngo.service.PatnikService;
+import mk.ukim.finki.busngo.service.TipBiletService;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.time.LocalDateTime;
+
+@Controller
+@RequestMapping("/bilet")
+public class BiletController {
+    private final BiletService biletService;
+    private final TipBiletService tipBiletService;
+    private final AuthService authService;
+    private final PatnikService patnikService;
+
+    public BiletController(BiletService biletService, TipBiletService tipBiletService, AuthService authService, PatnikService patnikService) {
+        this.biletService = biletService;
+        this.tipBiletService = tipBiletService;
+        this.authService = authService;
+        this.patnikService = patnikService;
+    }
+
+    @GetMapping()
+    public String getAllBileti(@RequestParam(required = false) Long id,
+                               @RequestParam(required = false) BILET_STATUS status,
+                               Model model,
+                               Authentication authentication){
+        model.addAttribute("bodyContent", "listBileti");
+        Patnik patnik = null;
+        try{
+            patnik = patnikService.loadUserByEmail(authentication.getName());
+            model.addAttribute("bileti", biletService.findAllByPatnikEmail(authentication.getName()));
+        }
+        catch (InvalidPatnikIdException e){
+            model.addAttribute("bodyContent", "listBileti");
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", e.getMessage());
+            return "master-template";
+        }
+
+        return "master-template";
+    }
+
+    @GetMapping("/kupi")
+    public String getKupiPage(Model model){
+        model.addAttribute("bodyContent", "kupiBilet");
+        model.addAttribute("tipbileti", tipBiletService.listAll());
+        return "master-template";
+    }
+
+    @PostMapping("/kupi")
+    public String kupiBilet(@RequestParam Long tipbilet, Authentication authentication){
+        biletService.buy(tipbilet, LocalDateTime.now(), BILET_STATUS.INACTIVE, authentication.getName());
+        return "redirect:/bilet";
+    }
+
+//    @GetMapping("/encode")
+//    public String encode(){
+//        biletService.encode();
+//        return "redirect:/bilet";
+//    }
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/InstancaNaLinijaController.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/InstancaNaLinijaController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/InstancaNaLinijaController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,78 @@
+package mk.ukim.finki.busngo.web;
+
+import mk.ukim.finki.busngo.model.entities.Avtobus;
+import mk.ukim.finki.busngo.model.entities.Instancanalinija;
+import mk.ukim.finki.busngo.model.entities.Linija;
+import mk.ukim.finki.busngo.service.AvtobusService;
+import mk.ukim.finki.busngo.service.InstancaNaLinijaService;
+import mk.ukim.finki.busngo.service.KontrolaService;
+import mk.ukim.finki.busngo.service.LinijaService;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Controller
+@RequestMapping("instanca-na-linija")
+public class InstancaNaLinijaController {
+    private final InstancaNaLinijaService instancaNaLinijaService;
+    private final LinijaService linijaService;
+    private final AvtobusService avtobusService;
+    private final KontrolaService kontrolaService;
+
+    public InstancaNaLinijaController(InstancaNaLinijaService instancaNaLinijaService, LinijaService linijaService, AvtobusService avtobusService, KontrolaService kontrolaService) {
+        this.instancaNaLinijaService = instancaNaLinijaService;
+        this.linijaService = linijaService;
+        this.avtobusService = avtobusService;
+        this.kontrolaService = kontrolaService;
+    }
+
+    @GetMapping()
+    public String getList(Model model){
+        model.addAttribute("bodyContent", "listInstanci");
+        model.addAttribute("inls", instancaNaLinijaService.findAllActive());
+
+        return "master-template";
+    }
+    @GetMapping("/start")
+    public String getStartPage(Model model){
+        List<Linija> linijaList = linijaService.findAll();
+        List<Avtobus> avtobusList = avtobusService.findAll();
+        model.addAttribute("avtobusi", avtobusList);
+        model.addAttribute("linii", linijaList);
+        model.addAttribute("bodyContent", "startInstanca");
+
+        return "master-template";
+    }
+
+    @PostMapping("/start")
+    public String startInstanca(@RequestParam String aRegistracija,
+                                @RequestParam Long liId,
+                                Model model,
+                                Authentication authentication){
+        Instancanalinija start = instancaNaLinijaService.start(liId, aRegistracija, authentication.getName());
+//        model.addAttribute("inl", start);
+//        model.addAttribute("bodyContent", "inlShow");
+
+        return "redirect:/instanca-na-linija/" + start.getInlId();
+    }
+
+    @GetMapping("/{inlId}")
+    public String getInlShow(@PathVariable Long inlId,
+                             Model model){
+        model.addAttribute("inl", instancaNaLinijaService.findById(inlId));
+        model.addAttribute("kontroli", kontrolaService.findAllByInl(inlId));
+        model.addAttribute("bodyContent", "inlShow");
+
+        return "master-template";
+    }
+
+    @PostMapping("/{inlId}/end")
+    public String endInstanca(@PathVariable Long inlId,
+                              Authentication authentication){
+        Instancanalinija ended = instancaNaLinijaService.end(inlId, authentication.getName());
+        return "redirect:/instanca-na-linija/" + ended.getInlId();
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/KaznaController.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/KaznaController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/KaznaController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,49 @@
+package mk.ukim.finki.busngo.web;
+
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.exceptions.InvalidPatnikIdException;
+import mk.ukim.finki.busngo.service.KaznaZaRegistriranService;
+import mk.ukim.finki.busngo.service.VozenjeService;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping("/kazna")
+public class KaznaController {
+    private final KaznaZaRegistriranService kaznaZaRegistriranService;
+
+    public KaznaController(KaznaZaRegistriranService kaznaZaRegistriranService) {
+        this.kaznaZaRegistriranService = kaznaZaRegistriranService;
+    }
+
+    @GetMapping()
+    public String getKaznaPage(Model model,
+                                 Authentication authentication){
+        model.addAttribute("bodyContent", "listKazni");
+        Patnik patnik = null;
+        try{
+            model.addAttribute("kazni", kaznaZaRegistriranService.findAllByPatnik(authentication.getName()));
+        }
+        catch (InvalidPatnikIdException e){
+            model.addAttribute("bodyContent", "listBileti");
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", e.getMessage());
+            return "master-template";
+        }
+
+        return "master-template";
+    }
+
+    @PostMapping("/{id}/pay")
+    public String pay(@PathVariable Long id,
+                      Model model){
+        kaznaZaRegistriranService.pay(id);
+        return "redirect:/kazna";
+    }
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/KontrolaController.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/KontrolaController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/KontrolaController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,85 @@
+package mk.ukim.finki.busngo.web;
+
+import mk.ukim.finki.busngo.model.entities.Kontroli;
+import mk.ukim.finki.busngo.model.exceptions.UserShouldNotBeTicketedException;
+import mk.ukim.finki.busngo.service.*;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+@Controller
+@RequestMapping("/kontrola")
+public class KontrolaController {
+
+    private final KontrolaService kontrolaService;
+    private final KaznaZaRegistriranService kaznaZaRegistriranService;
+    private final KaznaZaNeregistriranService kaznaZaNeregistriranService;
+    private final KaznaService kaznaService;
+    private final PatnikService patnikService;
+    private final VozacService vozacService;
+    private final InstancaNaLinijaService instancaNaLinijaService;
+
+    public KontrolaController(KontrolaService kontrolaService, KaznaZaRegistriranService kaznaZaRegistriranService, KaznaZaNeregistriranService kaznaZaNeregistriranService, KaznaService kaznaService, PatnikService patnikService, VozacService vozacService, InstancaNaLinijaService instancaNaLinijaService) {
+        this.kontrolaService = kontrolaService;
+        this.kaznaZaRegistriranService = kaznaZaRegistriranService;
+        this.kaznaZaNeregistriranService = kaznaZaNeregistriranService;
+        this.kaznaService = kaznaService;
+        this.patnikService = patnikService;
+        this.vozacService = vozacService;
+        this.instancaNaLinijaService = instancaNaLinijaService;
+    }
+
+    @GetMapping("/{kontrolaId}")
+    public String get(@PathVariable Long kontrolaId,
+                      Model model){
+        model.addAttribute("bodyContent", "kontrola");
+        Kontroli kontroli = kontrolaService.findById(kontrolaId);
+
+        model.addAttribute("kontrola", kontroli);
+        model.addAttribute("kazni", kaznaService.findAllByKontrolaId(kontrolaId));
+        model.addAttribute("patnici", patnikService.listAll());
+        return "master-template";
+    }
+    @GetMapping("/start-for/{inlId}")
+    public String getStartPage(@PathVariable Long inlId,
+                               Model model,
+                               Authentication authentication){
+        model.addAttribute("bodyContent", "kontrola");
+        Kontroli kontroli = kontrolaService.create(inlId, authentication.getName());
+
+        model.addAttribute("kontrola", kontroli);
+        return "redirect:/kontrola/" + kontroli.getKontrolaId();
+    }
+
+    @PostMapping("/{kontrolaId}/kazni-registriran")
+    public String kazniRegistriran(@PathVariable Long kontrolaId,
+                                   @RequestParam String dokument,
+                                   @RequestParam Double iznos,
+                                   @RequestParam Long patnik,
+                                   Authentication authentication){
+        try {
+
+            kaznaZaRegistriranService.create(kontrolaId, dokument, iznos, patnik, authentication.getName());
+        }
+        catch (UserShouldNotBeTicketedException exception){
+            return "redirect:/kontrola/" + kontrolaId;
+        }
+
+        return "redirect:/kontrola/" + kontrolaId;
+    }
+
+    @PostMapping("/{kontrolaId}/kazni-neregistriran")
+    public String kazniNeregistriran(@PathVariable Long kontrolaId,
+                                   @RequestParam String dokument,
+                                   @RequestParam Double iznos,
+                                   @RequestParam String telefon,
+                                   @RequestParam String ime,
+                                   @RequestParam String adresa,
+                                   Authentication authentication){
+
+        kaznaZaNeregistriranService.create(kontrolaId, dokument, iznos, telefon, ime, adresa, authentication.getName());
+
+        return "redirect:/kontrola/" + kontrolaId;
+    }
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/LoginController.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/LoginController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/LoginController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,47 @@
+package mk.ukim.finki.busngo.web;
+
+import jakarta.servlet.http.HttpServletRequest;
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.exceptions.InvalidCredentialsException;
+import mk.ukim.finki.busngo.service.AuthService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping("/login")
+public class LoginController {
+
+    private final AuthService authService;
+
+    public LoginController(AuthService authService) {
+        this.authService = authService;
+    }
+
+    @GetMapping
+    public String getLoginPage(Model model) {
+        model.addAttribute("bodyContent", "login");
+        return "master-template";
+    }
+
+    @PostMapping
+    public String login(HttpServletRequest request, Model model) {
+        Korisnik user = null;
+
+        try {
+            user = authService.login(request.getParameter("username"), request.getParameter("password"));
+        } catch (InvalidCredentialsException exception) {
+            model.addAttribute("bodyContent", "login");
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", exception.getMessage());
+            return "master-template";
+        }
+
+        request.getSession().setAttribute("user", user);
+        return "redirect:/home";
+    }
+
+}
+
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/RegisterController.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/RegisterController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/RegisterController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,73 @@
+package mk.ukim.finki.busngo.web;
+
+import mk.ukim.finki.busngo.model.entities.Korisnik;
+import mk.ukim.finki.busngo.model.enums.Role;
+import mk.ukim.finki.busngo.model.enums.VrabotenType;
+import mk.ukim.finki.busngo.model.exceptions.InvalidCredentialsException;
+import mk.ukim.finki.busngo.model.exceptions.UserAlreadyExistsException;
+import mk.ukim.finki.busngo.service.AuthService;
+import mk.ukim.finki.busngo.service.KorisnikService;
+import mk.ukim.finki.busngo.service.PatnikService;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+@Controller
+@RequestMapping("/register")
+public class RegisterController {
+    private final AuthService authService;
+    private final KorisnikService korisnikService;
+    private final PatnikService patnikService;
+
+    public RegisterController(AuthService authService, KorisnikService korisnikService, PatnikService patnikService) {
+        this.authService = authService;
+        this.korisnikService = korisnikService;
+        this.patnikService = patnikService;
+    }
+
+    @GetMapping
+    public String getRegisterPage(@RequestParam(required = false) String error, Model model) {
+        if(error != null && !error.isEmpty()) {
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", error);
+        }
+
+        model.addAttribute("roles", Role.values());
+
+        model.addAttribute("bodyContent", "register");
+        return "master-template";
+    }
+
+    @PostMapping
+    public String register(@RequestParam String name,
+                           @RequestParam String email,
+                           @RequestParam String password,
+                           @RequestParam String confirmPassword,
+                           @RequestParam String address,
+                           @RequestParam String phone,
+                           @RequestParam Role role,
+                           @RequestParam(required = false) Double salary
+                           ) {
+        try{
+            Korisnik korisnik = authService.register(name, email, password, confirmPassword, address, phone, role, salary);
+
+            return "redirect:/login";
+        } catch (InvalidCredentialsException | UserAlreadyExistsException exception) {
+            return "redirect:/register?error=" + exception.getMessage();
+        }
+    }
+
+//    @PostMapping
+//    public String registerVraboten(@RequestParam String name,
+//                                   @RequestParam String email,
+//                                   @RequestParam String password,
+//                                   @RequestParam String confirmPassword,
+//                                   @RequestParam String address,
+//                                   @RequestParam String phone){
+//
+//    }
+
+}
Index: bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/VozenjeController.java
===================================================================
--- bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/VozenjeController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-do-5ta-faza/src/main/java/mk/ukim/finki/busngo/web/VozenjeController.java	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,129 @@
+package mk.ukim.finki.busngo.web;
+
+import mk.ukim.finki.busngo.model.entities.Linija;
+import mk.ukim.finki.busngo.model.entities.Patnik;
+import mk.ukim.finki.busngo.model.entities.Vozenje;
+import mk.ukim.finki.busngo.model.enums.VOZENJE_STATUS;
+import mk.ukim.finki.busngo.model.exceptions.InvalidPatnikIdException;
+import mk.ukim.finki.busngo.model.exceptions.InvalidPostojkaNaLinijaIdException;
+import mk.ukim.finki.busngo.service.*;
+import org.springframework.security.core.Authentication;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.*;
+
+@Controller
+@RequestMapping("/vozenje")
+public class VozenjeController {
+    private final VozenjeService vozenjeService;
+    private final PostojkaNaLinijaService postojkaNaLinijaService;
+    private final InstancaNaLinijaService instancaNaLinijaService;
+    private final BiletService biletService;
+
+    public VozenjeController(VozenjeService vozenjeService, PostojkaNaLinijaService postojkaNaLinijaService, InstancaNaLinijaService instancaNaLinijaService, BiletService biletService) {
+        this.vozenjeService = vozenjeService;
+        this.postojkaNaLinijaService = postojkaNaLinijaService;
+        this.instancaNaLinijaService = instancaNaLinijaService;
+        this.biletService = biletService;
+    }
+
+    @GetMapping()
+    public String getVozenjePage(Model model,
+                                 Authentication authentication,
+                                 @RequestParam(required = false) VOZENJE_STATUS status){
+        model.addAttribute("bodyContent", "listVozenja");
+        Patnik patnik = null;
+        try{
+            if(status != null)
+                model.addAttribute("vozenja", vozenjeService.findVozenjaByPatnikAndStatus(authentication.getName(), status));
+            else
+                model.addAttribute("vozenja", vozenjeService.findVozenjaByPatnikAndStatus(authentication.getName(), VOZENJE_STATUS.ACTIVE));
+            model.addAttribute("vozStatus", VOZENJE_STATUS.values());
+        }
+        catch (InvalidPatnikIdException e){
+            model.addAttribute("bodyContent", "listBileti");
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", e.getMessage());
+            return "master-template";
+        }
+
+        return "master-template";
+    }
+
+//    @GetMapping("/start")
+//    public String getStartVozenjePagePostojkaPage(Model model){
+//        model.addAttribute("postojki", postojkaNaLinijaService.findAll());
+//        model.addAttribute("bodyContent", "choosePostojka");
+//
+//        return "master-template";
+//    }
+    @GetMapping("/start")
+    public String getStartVozenjePageAll(@RequestParam(required = false) Long pnlId,
+                                         Model model,
+                                         Authentication authentication){
+        try{
+            if(pnlId != null){
+                model.addAttribute("postojka", postojkaNaLinijaService.findById(pnlId));
+                model.addAttribute("instanci", instancaNaLinijaService.findByPnlId(pnlId));
+            }
+            model.addAttribute("postojki", postojkaNaLinijaService.findAll());
+
+            model.addAttribute("bileti", biletService.findAllByPatnikEmail(authentication.getName()));
+            model.addAttribute("bodyContent", "startVozenje");
+        }
+        catch (InvalidPostojkaNaLinijaIdException | InvalidPatnikIdException exception){
+            model.addAttribute("bodyContent", "listBileti");
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", exception.getMessage());
+            return "master-template";
+        }
+
+        return "master-template";
+    }
+
+    @PostMapping("/start")
+    public String startVozenje(@RequestParam Long pnlId,
+                               @RequestParam Long inlId,
+                               @RequestParam Long bId,
+                               Authentication authentication,
+                               Model model){
+        try{
+            vozenjeService
+                    .start(authentication.getName(), bId, pnlId, inlId);
+        }
+        catch (RuntimeException e){
+            System.out.println(e.getMessage());
+            model.addAttribute("bodyContent", "listBileti");
+            model.addAttribute("hasError", true);
+            model.addAttribute("error", e.getMessage());
+            return "master-template";
+        }
+
+        return "redirect:/vozenje";
+    }
+
+    @GetMapping("/{vozenjeId}/end")
+    public String getEndVozenje(@PathVariable Long vozenjeId,
+                                Model model){
+        Vozenje vozenje = vozenjeService.findById(vozenjeId);
+        model.addAttribute("vozenje", vozenjeService.findById(vozenjeId));
+        model.addAttribute("pnls",
+                postojkaNaLinijaService
+                        .findByLinijaAfterRedenBroj(Long.valueOf(vozenje
+                                .getInstancanalinijaByInlId()
+                                .getLinijaByLiId()
+                                .getLiId()),
+                                vozenje.getPostojkanalinijaByKacuvaPnlId().getPnlRedenBroj()));
+
+        model.addAttribute("bodyContent", "endVozenje");
+
+        return "master-template";
+    }
+
+    @PostMapping("/{vozenjeId}/end")
+    public String endVozenje(@PathVariable Long vozenjeId,
+                             @RequestParam Long pnlEndId){
+        Vozenje end = vozenjeService.end(vozenjeId, pnlEndId);
+        return "redirect:/vozenje";
+    }
+}
