Index: bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/R__materialized_views.sql
===================================================================
--- bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/R__materialized_views.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/R__materialized_views.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,156 @@
+set search_path = project;
+
+drop materialized view if exists avg_time_diffs;
+CREATE MATERIALIZED VIEW avg_time_diffs AS
+WITH ordered_instanca AS (SELECT ilpl.instanca_na_linija_id,
+                                 ilpl.postojka_na_linija_id,
+                                 pnl.reden_broj,
+                                 ilpl.timestamp
+                          FROM project.instanca_na_linija_postojka_na_linija ilpl
+                                   JOIN
+                               project.postojka_na_linija pnl ON ilpl.postojka_na_linija_id = pnl.id
+                          ORDER BY ilpl.instanca_na_linija_id,
+                                   pnl.reden_broj),
+     time_differences AS (SELECT o1.instanca_na_linija_id,
+                                 o1.postojka_na_linija_id                          AS start_station_id,
+                                 o1.timestamp                                      AS start_time,
+                                 o2.postojka_na_linija_id                          AS end_station_id,
+                                 o2.timestamp                                      AS end_time,
+                                 EXTRACT(EPOCH FROM (o2.timestamp - o1.timestamp)) AS time_diff
+                          FROM ordered_instanca o1
+                                   JOIN
+                               ordered_instanca o2 ON o1.instanca_na_linija_id = o2.instanca_na_linija_id
+                          WHERE o1.reden_broj + 1 = o2.reden_broj)
+SELECT
+    row_number() over () as id,
+    start_station_id,
+       end_station_id,
+       AVG(time_diff)::double precision AS avg_time_diff_seconds
+FROM time_differences
+GROUP BY start_station_id,
+         end_station_id
+ORDER BY start_station_id,
+         end_station_id;
+
+create unique index avg_time_diffs_index on avg_time_diffs (id);
+
+drop materialized view if exists kazna_po_linija;
+create materialized view kazna_po_linija as
+select row_number() over () as id, l.id as line_id, count(l.id)
+from project.linija l
+         left join project.instanca_na_linija inl on l.id = inl.linija_id
+         left join project.kontrola k on inl.id = k.instanca_na_linija_id
+         left join project.kazna kaz on k.id = kaz.kontrola_id
+where extract(year from kaz.date_created) = extract(year from now())
+group by l.id
+order by count(l.id) desc;
+
+create unique index index_kazna_po_linija on kazna_po_linija(id);
+
+drop materialized view if exists most_busy_part_of_the_day;
+create materialized view most_busy_part_of_the_day as
+select row_number() over () as id, id as linija_id, interval_1h, count(id || '-' || interval_1h) broj_pati
+from (select li.id,
+             (to_char(extract(hour from v.start_date), '00') || ':00 -' || to_char(extract(hour from (v.start_date
+                 + '1 hours'::interval))::int, '00') || ':00') as interval_1h
+      from project.linija li
+               left join project.instanca_na_linija inl on li.id = inl.linija_id
+               left join project.vozenje v on inl.id = v.instanca_na_linija_id
+      where v.start_date between (make_date(extract(year from (now()))::int, 1, 1)) and (make_date(extract(year from (now()))::int, 12, 31))) as hours
+group by id, interval_1h
+order by interval_1h desc;
+
+create unique index index_most_busy_part_of_the_day on most_busy_part_of_the_day(id);
+
+drop materialized view if exists commutes_by_line;
+create materialized view commutes_by_line as
+select row_number() over () as id, l.id as linija_id, count(v.id)
+from project.linija l
+         left join project.instanca_na_linija inl on l.id = inl.linija_id
+         left join project.vozenje v on inl.id = v.instanca_na_linija_id
+where v.start_date between date_trunc('year', now()) and date_trunc('month', date_trunc('year', now())+ interval '7 months')
+group by l.id;
+
+
+drop materialized view if exists number_passengers_per_line_and_station;
+create materialized view number_passengers_per_line_and_station as
+select row_number() over () as id, p.id as station_id, l.id as line_id, count(p.id)
+from project.postojka p
+         join project.postojka_na_linija pnl on p.id = pnl.postojka_id
+         join project.vozenje v on pnl.id = v.postojka_na_linija_start_id
+         join project.patnik pat on v.patnik_id = pat.id
+         join project.linija l on pnl.linija_id = l.id
+where v.start_date between (make_date(extract(year from (now() - '1 years'::interval))::int, 4, 1)) and (make_date(extract(year from (now() - '1 years'::interval))::int, 6, 30))
+group by p.id, l.id
+order by count(p.id) desc;
+
+
+drop materialized view if exists ticket_sales;
+create materialized view ticket_sales as
+select row_number() over () as id, filtered.tip_id, filtered.interval_1h, filtered.broj_pati
+from (select filter.tip_id, interval_1h, count(tip_id || '-' || interval_1h) broj_pati
+      from (select *,
+                   (to_char(extract(hour from b.datum_kupuvanje), '00') || ':00 -' ||
+                    to_char(extract(hour from (b.datum_kupuvanje + '1 hours'::interval))::int, '00') ||
+                    ':00') as interval_1h
+            from project.tipbilet t
+                     left join project.bilet b on t.id = b.tip_id
+--     where  b.datum_kupuvanje between (make_date(extract(year from (now() - '1 years'::interval))::int, 1, 1)) and (make_date(extract(year from (now() - '1 years'::interval))::int, 12, 31))
+
+           ) as filter
+      group by filter.tip_id, interval_1h) filtered
+where broj_pati = (select max(filtered.broj_pati)
+                   from (select filter.tip_id, interval_1h, count(tip_id || '-' || interval_1h) broj_pati
+                         from (select *,
+                                      (to_char(extract(hour from b.datum_kupuvanje), '00') || ':00 -' ||
+                                       to_char(extract(hour from (b.datum_kupuvanje + '1 hours'::interval))::int,
+                                               '00') ||
+                                       ':00') as interval_1h
+                               from project.tipbilet t
+                                        left join project.bilet b on t.id = b.tip_id
+--     where  b.datum_kupuvanje between (make_date(extract(year from (now() - '1 years'::interval))::int, 1, 1)) and (make_date(extract(year from (now() - '1 years'::interval))::int, 12, 31))
+
+                              ) as filter
+                         group by filter.tip_id, interval_1h) filtered)
+  and tip_id in (select id
+                 from tipbilet
+                 where ime in ('Hourly', 'Daily'));
+
+
+
+drop materialized view if exists total_income;
+create materialized view total_income as
+WITH kazna_sum AS (
+    SELECT
+        EXTRACT(YEAR FROM k.date_payed) AS year,
+        SUM(k.iznos) AS sum_kz
+    FROM
+        project.kazna k
+    WHERE
+        k.plateno = TRUE
+    GROUP BY
+        EXTRACT(YEAR FROM k.date_payed)
+),
+     bilet_sum AS (
+         SELECT
+             EXTRACT(YEAR FROM b.datum_kupuvanje) AS year,
+             SUM(tb.cena) AS sum_b
+         FROM
+             project.bilet b
+                 JOIN tipbilet tb ON tb.id = b.tip_id
+         GROUP BY
+             EXTRACT(YEAR FROM b.datum_kupuvanje)
+     )
+SELECT
+    row_number() over () as id,
+    COALESCE(k.year, b.year)::text AS year,
+    COALESCE(sum_kz, 0) as fines_income,
+    COALESCE(sum_b, 0) as ticket_income,
+    COALESCE(sum_kz, 0) + COALESCE(sum_b, 0) AS total_income
+FROM
+    kazna_sum k
+        FULL OUTER JOIN bilet_sum b ON k.year = b.year
+ORDER BY
+    year desc;
+
+create unique index index_total_income on total_income(id);
Index: bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/R__triggers_for_start_commute.sql
===================================================================
--- bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/R__triggers_for_start_commute.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/R__triggers_for_start_commute.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,49 @@
+set search_path = project;
+
+create or replace function check_expiry_date() returns trigger
+as
+    $$
+    begin
+        if exists(
+            select 1
+            from project.vozenje v
+            where v.patnik_id = new.patnik_id and v.end_date is null
+        ) then
+            update project.vozenje set end_date = now(), status = 'FINISHED' where id in (select v.id
+                                                                                  from project.vozenje v
+                                                                                  where v.patnik_id = new.patnik_id and v.end_date is null);
+        end if;
+
+        if exists(
+            select 1
+            from project.bilet
+            where id = new.bilet_id and datum_aktivacija is null
+        ) then
+            update project.bilet set datum_aktivacija = now(), status = 'ACTIVE' where id = new.bilet_id;
+        end if;
+
+        if exists(
+            select 1
+            from project.bilet b
+            join project.tipbilet tb on b.tip_id = tb.id
+            where b.id = new.bilet_id and ((b.datum_aktivacija + (tb.trajnost || ' milliseconds')::interval) < now())
+        ) then
+            update project.bilet set status = 'EXPIRED' where id = new.bilet_id;
+            end if;
+
+        if exists(
+            select 1
+            from project.bilet b
+                     join project.tipbilet tb on b.tip_id = tb.id
+            where b.id = new.bilet_id and ((b.datum_aktivacija + (tb.trajnost || ' milliseconds')::interval) < now())
+        ) then
+            RAISE exception 'Ticket is expired';
+        end if;
+        return new;
+    end;
+    $$ language plpgsql;
+
+create or replace trigger check_validity_of_ticket
+    before insert on vozenje
+    for each row
+    execute function check_expiry_date();
Index: bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1.1__data_init.sql
===================================================================
--- bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1.1__data_init.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1.1__data_init.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,269 @@
+set search_path = project;
+
+INSERT INTO Korisnik (is_admin, adresa, email, ime, lozinka, telefon) VALUES
+                                                                          (true, 'Bulevar Partizanski Odredi 45, Skopje', 'admin@example.com', 'Nikola Stojanovski', 'admin_password', '070123456'),
+                                                                          (false, 'Ulica Makedonija 12, Skopje', 'user1@example.com', 'Elena Petrovska', 'user1_password', '071234567'),
+                                                                          (false, 'Bulevar Sveti Kliment Ohridski 23, Skopje', 'user2@example.com', 'Marija Trajkovska', 'user2_password', '072345678'),
+                                                                          (false, 'Ulica Vasil Glavinov 10, Skopje', 'user3@example.com', 'Ivana Risteska', 'user3_password', '073456789'),
+                                                                          (false, 'Bulevar Krste Misirkov 56, Skopje', 'user4@example.com', 'Stefan Dimitrovski', 'user4_password', '074567890');
+INSERT INTO Role (description, name) VALUES
+                                         ('Administrator with full access rights', 'ROLE_ADMIN'),
+                                         ('Driver responsible for operating the bus', 'ROLE_DRIVER'),
+                                         ('Conductor responsible for checking tickets', 'ROLE_CONDUCTOR'),
+                                         ('Commuter using the public transport services', 'ROLE_PASSENGER');
+-- Nikola Stojanovski (Admin)
+INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
+    (1, 2),
+    (1, 3),
+    (1, 4),
+    (1, 1); -- Admin role
+
+-- Elena Petrovska (Commuter)
+INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
+    (2, 4); -- Commuter role
+
+-- Marija Trajkovska (Driver)
+INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
+    (3, 2); -- Driver role
+
+-- Ivana Risteska (Conductor)
+INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
+    (4, 3); -- Conductor role
+
+-- Stefan Dimitrovski (Commuter)
+INSERT INTO Korisnik_Role (korisnik_id, role_id) VALUES
+    (5, 4); -- Commuter role
+
+-- Elena Petrovska (Commuter)
+INSERT INTO Patnik (korisnik_id) VALUES
+    (2);
+
+-- Stefan Dimitrovski (Commuter)
+INSERT INTO Patnik (korisnik_id) VALUES
+    (5);
+
+-- Nikola Stojanovski (Admin)
+INSERT INTO Patnik (korisnik_id) VALUES
+    (1); -- Assuming Nikola Stojanovski has vraboten_id 1
+
+-- Nikola Stojanovski (Admin)
+INSERT INTO Vraboten (datum_na_vrabotuvanje, datum_prekin_vrabotuvanje, plata, korisnik_id) VALUES
+    ('2020-01-01', NULL, 60000, 1);
+
+-- Marija Trajkovska (Driver)
+INSERT INTO Vraboten (datum_na_vrabotuvanje, datum_prekin_vrabotuvanje, plata, korisnik_id) VALUES
+    ('2021-05-15', NULL, 35000, 3);
+
+-- Ivana Risteska (Conductor)
+INSERT INTO Vraboten (datum_na_vrabotuvanje, datum_prekin_vrabotuvanje, plata, korisnik_id) VALUES
+    ('2022-03-20', NULL, 30000, 4);
+
+-- Marija Trajkovska (Driver)
+INSERT INTO Vozac (vraboten_id) VALUES
+    (2); -- Assuming Marija Trajkovska has vraboten_id 2
+
+-- Nikola Stojanovski (Admin)
+INSERT INTO Vozac (vraboten_id) VALUES
+    (1); -- Assuming Nikola Stojanovski has vraboten_id 1
+
+-- Insert employees into the Kondukter table
+
+-- Ivana Risteska (Conductor)
+INSERT INTO Kondukter (vraboten_id) VALUES
+    (3); -- Assuming Ivana Risteska has vraboten_id 3
+
+-- Nikola Stojanovski (Admin)
+INSERT INTO Kondukter (vraboten_id) VALUES
+    (1); -- Assuming Nikola Stojanovski has vraboten_id 1
+
+INSERT INTO Avtobus (broj_sedishta, registracija, seriski_broj) VALUES
+                                                                    (50, 'SK-1234-AB', 'SN-000001'),
+                                                                    (45, 'SK-2345-BC', 'SN-000002'),
+                                                                    (50, 'SK-3456-CD', 'SN-000003'),
+                                                                    (40, 'SK-4567-DE', 'SN-000004'),
+                                                                    (50, 'SK-5678-EF', 'SN-000005'),
+                                                                    (55, 'SK-6789-FG', 'SN-000006'),
+                                                                    (50, 'SK-7890-GH', 'SN-000007'),
+                                                                    (45, 'SK-8901-HI', 'SN-000008'),
+                                                                    (50, 'SK-9012-IJ', 'SN-000009'),
+                                                                    (40, 'SK-0123-JK', 'SN-000010'),
+                                                                    (50, 'SK-1234-KL', 'SN-000011'),
+                                                                    (55, 'SK-2345-LM', 'SN-000012'),
+                                                                    (50, 'SK-3456-MN', 'SN-000013'),
+                                                                    (45, 'SK-4567-NO', 'SN-000014'),
+                                                                    (50, 'SK-5678-OP', 'SN-000015'),
+                                                                    (40, 'SK-6789-PQ', 'SN-000016'),
+                                                                    (50, 'SK-7890-QR', 'SN-000017'),
+                                                                    (55, 'SK-8901-RS', 'SN-000018'),
+                                                                    (50, 'SK-9012-ST', 'SN-000019'),
+                                                                    (45, 'SK-0123-TU', 'SN-000020');
+
+INSERT INTO Linija (ime) VALUES
+                                     ('Line 1'),
+                                     ('Line 2'),
+                                     ('Line 3'),
+                                     ('Line 4'),
+                                     ('Line 5'),
+                                     ('Line 6'),
+                                     ('Line 7'),
+                                     ('Line 8'),
+                                     ('Line 9'),
+                                     ('Line 10');
+
+INSERT INTO Pravec (pravec, opis) VALUES
+                                      ('Skopje - Tetovo', 'Skopje to Tetovo'),
+                                      ('Tetovo - Skopje', 'Tetovo to Skopje'),
+                                      ('Skopje - Ohrid', 'Skopje to Ohrid'),
+                                      ('Ohrid - Skopje', 'Ohrid to Skopje'),
+                                      ('Skopje - Bitola', 'Skopje to Bitola'),
+                                      ('Bitola - Skopje', 'Bitola to Skopje'),
+                                      ('Skopje - Kumanovo', 'Skopje to Kumanovo'),
+                                      ('Kumanovo - Skopje', 'Kumanovo to Skopje'),
+                                      ('Skopje - Strumica', 'Skopje to Strumica'),
+                                      ('Strumica - Skopje', 'Strumica to Skopje'),
+                                      ('Skopje - Veles', 'Skopje to Veles'),
+                                      ('Veles - Skopje', 'Veles to Skopje'),
+                                      ('Skopje - Prilep', 'Skopje to Prilep'),
+                                      ('Prilep - Skopje', 'Prilep to Skopje'),
+                                      ('Skopje - Gostivar', 'Skopje to Gostivar'),
+                                      ('Gostivar - Skopje', 'Gostivar to Skopje'),
+                                      ('Skopje - Stip', 'Skopje to Stip'),
+                                      ('Stip - Skopje', 'Stip to Skopje'),
+                                      ('Skopje - Kavadarci', 'Skopje to Kavadarci'),
+                                      ('Kavadarci - Skopje', 'Kavadarci to Skopje');
+
+-- Line 1: Skopje - Tetovo
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (1, 1), -- Skopje to Tetovo
+                                                     (2, 1); -- Tetovo to Skopje
+
+-- Line 2: Skopje - Ohrid
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (3, 2), -- Skopje to Ohrid
+                                                     (4, 2); -- Ohrid to Skopje
+
+-- Line 3: Skopje - Bitola
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (5, 3), -- Skopje to Bitola
+                                                     (6, 3); -- Bitola to Skopje
+
+-- Line 4: Skopje - Kumanovo
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (7, 4), -- Skopje to Kumanovo
+                                                     (8, 4); -- Kumanovo to Skopje
+
+-- Line 5: Skopje - Strumica
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (9, 5), -- Skopje to Strumica
+                                                     (10, 5); -- Strumica to Skopje
+
+-- Line 6: Skopje - Veles
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (11, 6), -- Skopje to Veles
+                                                     (12, 6); -- Veles to Skopje
+
+-- Line 7: Skopje - Prilep
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (13, 7), -- Skopje to Prilep
+                                                     (14, 7); -- Prilep to Skopje
+
+-- Line 8: Skopje - Gostivar
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (15, 8), -- Skopje to Gostivar
+                                                     (16, 8); -- Gostivar to Skopje
+
+-- Line 9: Skopje - Stip
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (17, 9), -- Skopje to Stip
+                                                     (18, 9); -- Stip to Skopje
+
+-- Line 10: Skopje - Kavadarci
+INSERT INTO linija_pravec (pravec_id, linija_id) VALUES
+                                                     (19, 10), -- Skopje to Kavadarci
+                                                     (20, 10); -- Kavadarci to Skopje
+
+INSERT INTO Instanca_Na_Linija (linija_id, avtobus_id, start_date, end_date, vozac_id)
+VALUES
+-- Line 1: Skopje - Tetovo
+(1, 1, '2024-06-24 08:00:00', '2024-06-24 09:00:00', 1),
+(1, 1, '2024-06-24 09:00:00', '2024-06-24 10:00:00', 1),
+(1, 1, '2024-06-24 10:00:00', '2024-06-24 11:00:00', 1),
+(1, 1, '2024-06-24 11:00:00', '2024-06-24 12:00:00', 1),
+(1, 1, '2024-06-24 12:00:00', '2024-06-24 13:00:00', 1);
+
+
+-- Insert stops from Skopje to Tetovo
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia'),
+                                               (41.9643, 21.6228, 'Gazi Baba', 'Municipality near Skopje'),
+                                               (42.0264, 21.5957, 'Tetovo', 'City in western North Macedonia');
+
+-- Insert stops from Tetovo to Skopje
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (42.0264, 21.5957, 'Tetovo', 'City in western North Macedonia'),
+                                               (41.9643, 21.6228, 'Gazi Baba', 'Municipality near Skopje'),
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia');
+
+-- Additional stops for Skopje to Tetovo
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.9808, 21.4631, 'Butel', 'Municipality in Skopje'),
+                                               (42.0035, 21.4701, 'Kisela Voda', 'Municipality in Skopje'),
+                                               (41.9866, 21.5666, 'Gostivar', 'City in western North Macedonia'),
+                                               (41.9764, 21.6060, 'Zelino', 'Village near Tetovo'),
+                                               (41.9939, 21.6481, 'Tetovo Bus Station', 'Central bus station in Tetovo'),
+                                               (41.9861, 21.5705, 'Gostivar Train Station', 'Train station in Gostivar'),
+                                               (42.0081, 21.4500, 'Skopje University', 'University campus in Skopje'),
+                                               (42.0070, 21.4421, 'Kapishtec', 'Neighborhood in Skopje'),
+                                               (41.9794, 21.4604, 'Skopje City Mall', 'Shopping mall in Skopje');
+
+-- Additional stops for Tetovo to Skopje
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.9839, 21.4647, 'Butel', 'Municipality in Skopje'),
+                                               (41.9934, 21.4752, 'Kisela Voda', 'Municipality in Skopje'),
+                                               (41.9901, 21.5804, 'Gostivar', 'City in western North Macedonia'),
+                                               (41.9798, 21.6093, 'Zelino', 'Village near Tetovo'),
+                                               (41.9997, 21.6543, 'Tetovo Bus Station', 'Central bus station in Tetovo'),
+                                               (41.9930, 21.5741, 'Gostivar Train Station', 'Train station in Gostivar'),
+                                               (42.0132, 21.4578, 'Skopje University', 'University campus in Skopje'),
+                                               (42.0111, 21.4491, 'Kapishtec', 'Neighborhood in Skopje'),
+                                               (41.9822, 21.4679, 'Skopje City Mall', 'Shopping mall in Skopje');
+
+-- Insert stops for Line 1 (Skopje - Tetovo)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                        (1, 1, 1, 1),   -- Skopje
+                                                                        (1, 2, 2, 1),   -- Gazi Baba
+                                                                        (1, 8, 3, 1),   -- Skopje University
+                                                                        (1, 7, 4, 1),   -- Kapishtec
+                                                                        (1, 3, 5, 1),   -- Tetovo
+                                                                        (1, 6, 6, 1),   -- Gostivar Train Station
+                                                                        (1, 5, 7, 1),   -- Gostivar
+                                                                        (1, 4, 8, 1),   -- Zelino
+                                                                        (1, 9, 9, 1),   -- Tetovo Bus Station
+                                                                        (1, 10, 10, 1); -- Butel
+
+-- Insert stops for Line 1 (Tetovo to Skopje)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                        (1, 10, 1, 2),   -- Butel
+                                                                        (1, 9, 2, 2),    -- Tetovo Bus Station
+                                                                        (1, 4, 3, 2),    -- Zelino
+                                                                        (1, 5, 4, 2),    -- Gostivar
+                                                                        (1, 6, 5, 2),    -- Gostivar Train Station
+                                                                        (1, 3, 6, 2),    -- Tetovo
+                                                                        (1, 7, 7, 2),    -- Kapishtec
+                                                                        (1, 8, 8, 2),    -- Skopje University
+                                                                        (1, 2, 9, 2),    -- Gazi Baba
+                                                                        (1, 1, 10, 2);   -- Skopje
+
+
+-- Insert ticket types
+INSERT INTO TipBilet (cena, trajnost, ime) VALUES
+                                               (50.00, 3600000, 'Hourly'),    -- Hourly ticket (1 hour = 3,600,000 milliseconds)
+                                               (150.00, 86400000, 'Daily'),   -- Daily ticket (1 day = 86,400,000 milliseconds)
+                                               (1000.00, 2592000000, 'Monthly'),  -- Monthly ticket (30 days = 2,592,000,000 milliseconds)
+                                               (10000.00, 31536000000, 'Yearly'); -- Yearly ticket (365 days = 31,536,000,000 milliseconds)
+
+-- Add tickets for commuter with patnik_id 1
+INSERT INTO Bilet (datum_kupuvanje, patnik_id, tip_id, status) VALUES
+                                                                   ('2024-06-24 10:00:00', 1, 1, 'INACTIVE'),  -- Hourly ticket (ID 1)
+                                                                   ('2024-06-23 15:00:00', 1, 2, 'ACTIVE');    -- Daily ticket (ID 2)
+
Index: bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1.2__additional_data.sql
===================================================================
--- bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1.2__additional_data.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1.2__additional_data.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,126 @@
+set search_path = project;
+
+-- Insert stops from Skopje to Ohrid
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia'),
+                                               (41.8770, 21.0720, 'Tetovo', 'City in western North Macedonia'),
+                                               (41.7150, 20.9620, 'Gostivar', 'City in western North Macedonia'),
+                                               (41.5886, 20.6305, 'Kicevo', 'City in western North Macedonia'),
+                                               (41.5120, 20.2690, 'Struga', 'City in southwestern North Macedonia'),
+                                               (41.1136, 20.8016, 'Ohrid', 'City in southwestern North Macedonia');
+-- Insert stops for Line 2 (Skopje - Ohrid)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                                   (2, 25, 1, 3),  -- Skopje
+                                                                                   (2, 26, 2, 3),  -- Tetovo
+                                                                                   (2, 27, 3, 3),  -- Gostivar
+                                                                                   (2, 28, 4, 3),  -- Kicevo
+                                                                                   (2, 29, 5, 3),  -- Struga
+                                                                                   (2, 30, 6, 3);  -- Ohrid
+
+-- Insert stops from Ohrid to Skopje
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.1136, 20.8016, 'Ohrid', 'City in southwestern North Macedonia'),
+                                               (41.5910, 20.6520, 'Debarca', 'Municipality near Ohrid'),
+                                               (41.6340, 20.8940, 'Makedonski Brod', 'Town in central North Macedonia'),
+                                               (41.6980, 21.1290, 'Samokov', 'Village in western North Macedonia'),
+                                               (41.7820, 21.3340, 'Tetovo', 'City in western North Macedonia'),
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia');
+-- Insert stops for Line 2 (Ohrid - Skopje)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                                   (2, 31, 1, 4),  -- Ohrid
+                                                                                   (2, 32, 2, 4),  -- Debarca
+                                                                                   (2, 33, 3, 4),  -- Makedonski Brod
+                                                                                   (2, 34, 4, 4),  -- Samokov
+                                                                                   (2, 35, 5, 4),  -- Tetovo
+                                                                                   (2, 36, 6, 4);  -- Skopje
+-- Insert stops from Skopje to Bitola
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia'),    -- id 37
+                                               (41.9202, 21.5511, 'Veles', 'City in central North Macedonia'),     -- id 38
+                                               (41.7361, 21.7744, 'Prilep', 'City in southern North Macedonia'),   -- id 39
+                                               (41.6130, 21.5523, 'Krushevo', 'Town in southern North Macedonia'), -- id 40
+                                               (41.4442, 21.2761, 'Bitola', 'City in southwestern North Macedonia'); -- id 41
+-- Insert stops for Line 3 (Skopje - Bitola)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                                   (3, 37, 1, 5),  -- Skopje
+                                                                                   (3, 38, 2, 5),  -- Veles
+                                                                                   (3, 39, 3, 5),  -- Prilep
+                                                                                   (3, 40, 4, 5),  -- Krushevo
+                                                                                   (3, 41, 5, 5);  -- Bitola
+-- Insert stops from Bitola to Skopje
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.4442, 21.2761, 'Bitola', 'City in southwestern North Macedonia'), -- id 42
+                                               (41.6130, 21.5523, 'Krushevo', 'Town in southern North Macedonia'),   -- id 43
+                                               (41.7361, 21.7744, 'Prilep', 'City in southern North Macedonia'),     -- id 44
+                                               (41.9202, 21.5511, 'Veles', 'City in central North Macedonia'),       -- id 45
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia');      -- id 46
+-- Insert stops for Line 3 (Bitola - Skopje)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                                   (3, 42, 1, 6),  -- Bitola
+                                                                                   (3, 43, 2, 6),  -- Krushevo
+                                                                                   (3, 44, 3, 6),  -- Prilep
+                                                                                   (3, 45, 4, 6),  -- Veles
+                                                                                   (3, 46, 5, 6);  -- Skopje
+
+-- Insert stops from Skopje to Kumanovo
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia'),       -- id 47
+                                               (41.9945, 21.5770, 'Butel', 'Municipality in Skopje'),                 -- id 48
+                                               (42.0153, 21.7000, 'Aracinovo', 'Village near Skopje'),                -- id 49
+                                               (42.0892, 21.7184, 'Lipkovo', 'Village in northeastern North Macedonia'), -- id 50
+                                               (42.1322, 21.7144, 'Kumanovo', 'City in northeastern North Macedonia'); -- id 51
+
+-- Insert stops for Line 4 (Skopje - Kumanovo)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                                   (4, 47, 1, 7),  -- Skopje
+                                                                                   (4, 48, 2, 7),  -- Butel
+                                                                                   (4, 49, 3, 7),  -- Aracinovo
+                                                                                   (4, 50, 4, 7),  -- Lipkovo
+                                                                                   (4, 51, 5, 7);  -- Kumanovo
+-- Insert stops from Kumanovo to Skopje
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (42.1322, 21.7144, 'Kumanovo', 'City in northeastern North Macedonia'), -- id 52
+                                               (42.0892, 21.7184, 'Lipkovo', 'Village in northeastern North Macedonia'), -- id 53
+                                               (42.0153, 21.7000, 'Aracinovo', 'Village near Skopje'),                -- id 54
+                                               (41.9945, 21.5770, 'Butel', 'Municipality in Skopje'),                 -- id 55
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia');       -- id 56
+-- Insert stops for Line 4 (Kumanovo - Skopje)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                                   (4, 52, 1, 8),  -- Kumanovo
+                                                                                   (4, 53, 2, 8),  -- Lipkovo
+                                                                                   (4, 54, 3, 8),  -- Aracinovo
+                                                                                   (4, 55, 4, 8),  -- Butel
+                                                                                   (4, 56, 5, 8);  -- Skopje
+-- Insert stops from Skopje to Strumica
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.9981, 21.4254, 'Skopje', 'Capital city of North Macedonia'),               -- id 57
+                                               (41.8833, 21.5065, 'Katlanovo', 'Village near Skopje'),                        -- id 58
+                                               (41.7466, 21.3600, 'Veles Rest Area', 'Rest area near Veles'),                 -- id 59
+                                               (41.6165, 22.1796, 'Demir Kapija', 'Town in central North Macedonia'),         -- id 60
+                                               (41.3472, 22.5533, 'Radovish', 'Town in southeastern North Macedonia'),        -- id 61
+                                               (41.4378, 22.6431, 'Strumica', 'City in southeastern North Macedonia');        -- id 62
+-- Insert stops for Line 5 (Skopje - Strumica)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                                   (5, 57, 1, 9),  -- Skopje
+                                                                                   (5, 58, 2, 9),  -- Katlanovo
+                                                                                   (5, 59, 3, 9),  -- Veles Rest Area
+                                                                                   (5, 60, 4, 9),  -- Demir Kapija
+                                                                                   (5, 61, 5, 9),  -- Radovish
+                                                                                   (5, 62, 6, 9);  -- Strumica
+-- Insert stops from Strumica to Skopje
+INSERT INTO Postojka (lat, lon, ime, opis) VALUES
+                                               (41.4380, 22.6429, 'Strumica', 'City in southeastern North Macedonia'),       -- id 63
+                                               (41.3480, 22.5525, 'Radovish Park', 'Park in Radovish'),                      -- id 64
+                                               (41.6170, 22.1802, 'Demir Kapija South', 'Southern part of Demir Kapija'),    -- id 65
+                                               (41.7470, 21.3610, 'Veles South Rest Area', 'Rest area south of Veles'),      -- id 66
+                                               (41.8840, 21.5070, 'Katlanovo East', 'Eastern part of Katlanovo'),            -- id 67
+                                               (41.9985, 21.4260, 'Skopje Center', 'Center of Skopje');                      -- id 68
+-- Insert stops for Line 5 (Strumica - Skopje)
+INSERT INTO Postojka_Na_Linija (linija_id, postojka_id, reden_broj, pravec_id) VALUES
+                                                                                   (5, 63, 1, 10),  -- Strumica
+                                                                                   (5, 64, 2, 10),  -- Radovish Park
+                                                                                   (5, 65, 3, 10),  -- Demir Kapija South
+                                                                                   (5, 66, 4, 10),  -- Veles South Rest Area
+                                                                                   (5, 67, 5, 10),  -- Katlanovo East
+                                                                                   (5, 68, 6, 10);  -- Skopje Center
+
Index: bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1__init_db.sql
===================================================================
--- bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1__init_db.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
+++ bus-n-go-pavel-216049/bus-n-go-backend/src/main/resources/db/migration/V1__init_db.sql	(revision baf4cc4b66f1d62e9dc9c2e71bcc078c9c3956a3)
@@ -0,0 +1,238 @@
+set search_path = project;
+
+drop table if exists Se_simnuva_na;
+drop table if exists KaznaZaRegistriran;
+drop table if exists KaznaZaNeregistriran;
+drop table if exists Kazna;
+drop table if exists Kontroli;
+drop table if exists Vozenje;
+drop table if exists Bilet;
+drop table if exists TipBilet;
+drop table if exists PostojkaNaLinija;
+drop table if exists Postojka;
+drop table if exists Mesto;
+drop table if exists InstancaNaLinija;
+drop table if exists Linija;
+drop table if exists Avtobus;
+drop table if exists Kondukter;
+drop table if exists Vozac;
+drop table if exists Vraboten;
+drop table if exists Patnik;
+drop table if exists KorisnikRole;
+drop table if exists Korisnik;
+drop table if exists Role;
+
+create table Korisnik(
+                         is_admin boolean,
+                         id bigserial primary key,
+                         adresa character varying(255),
+                         email character varying(255),
+                         ime character varying(255),
+                         lozinka character varying(255),
+                         telefon character varying(255)
+);
+
+create table Role (
+                      id bigserial primary key,
+                      description character varying(255),
+                      name character varying(255)
+);
+
+create table Korisnik_Role (
+                               id bigserial primary key,
+                               korisnik_id bigint,
+                               role_id bigint,
+                               foreign key (role_id) references role (id),
+                               foreign key (korisnik_id) references korisnik (id)
+);
+
+create table Patnik(
+                       id bigserial primary key,
+                       korisnik_id bigint,
+                       foreign key (korisnik_id) references korisnik (id)
+);
+--	*k_id referencira od Korisnik(k_id)
+
+
+create table Vraboten(
+                         datum_na_vrabotuvanje date,
+                         datum_prekin_vrabotuvanje date,
+                         plata double precision,
+                         id bigserial primary key,
+                         korisnik_id bigint,
+                         foreign key (korisnik_id) references korisnik (id)
+);
+--	*k_id referencira od Korisnik(k_id)
+
+
+create table Vozac(
+                      id bigserial primary key,
+                      vraboten_id bigint,
+                      foreign key (vraboten_id) references vraboten (id)
+);
+--	*k_id referencira od Korisnik(k_id)
+
+create table Kondukter(
+                          id bigserial primary key,
+                          vraboten_id bigint,
+                          foreign key (vraboten_id) references vraboten (id)
+);
+--	*k_id referencira od Korisnik(k_id)
+
+create table Avtobus(
+                        broj_sedishta smallint,
+                        id bigserial primary key,
+                        registracija character varying(255),
+                        seriski_broj character varying(255)
+);
+
+create table Linija(
+                       id serial primary key,
+                       ime character varying(255)
+);
+
+create table Pravec (
+                      id bigserial primary key,
+                      pravec character varying(255),
+                      opis character varying(255)
+);
+
+create table linija_pravec (
+                      id bigserial primary key,
+                      pravec_id bigint,
+                      linija_id integer,
+                      foreign key (pravec_id) references Pravec (id),
+                      foreign key (linija_id) references Linija (id)
+);
+
+create table Instanca_Na_Linija (
+                                  linija_id integer,
+                                  pravec_id bigint,
+                                  avtobus_id bigint,
+                                  end_date timestamp(6) without time zone,
+                                  id bigserial primary key,
+                                  start_date timestamp(6) without time zone,
+                                  vozac_id bigint,
+                                  foreign key (avtobus_id) references avtobus (id),
+                                  foreign key (linija_id) references linija (id),
+                                  foreign key (vozac_id) references vozac (id)
+);
+--	*k_id referencira od Korisnik(k_id)
+--	^a_registracija referncira od Avtobus(a_registracija)
+--	#li_id referencira od Linija(li_id)
+
+create table Postojka (
+                          id serial primary key,
+                          lat double precision,
+                          lon double precision,
+                          ime character varying(255),
+                          opis character varying(255)
+);
+--*m_id referncira od Mesto(m_id)
+
+
+create table Postojka_Na_Linija (
+                                  linija_id integer,
+                                  postojka_id integer,
+                                  pravec_id bigint,
+                                  reden_broj smallint,
+                                  id bigserial primary key,
+                                  foreign key (postojka_id) references postojka (id),
+                                  foreign key (linija_id) references linija (id)
+);
+--	*li_id referencira od Linija(li_id)
+--	^p_id referencira od Postojka(p_id)
+
+create table instanca_na_linija_postojka_na_linija (
+                                  id bigserial primary key,
+                                  instanca_na_linija_id bigint not null,
+                                  postojka_na_linija_id bigint not null,
+                                  timestamp timestamp not null,
+                                  foreign key (instanca_na_linija_id) references instanca_na_linija(id),
+                                  foreign key (postojka_na_linija_id) references postojka_na_linija(id)
+);
+
+create table TipBilet (
+                          cena real,
+                          id bigserial primary key,
+                          trajnost bigint,
+                          ime character varying(255)
+);
+
+
+
+create table Bilet (
+                       datum_kupuvanje timestamp(6) without time zone,
+                       datum_aktivacija timestamp(6) without time zone,
+                       id bigserial primary key,
+                       patnik_id bigint,
+                       tip_id bigint,
+                       status character varying(255),
+                       foreign key (patnik_id) references patnik (id),
+                       foreign key (tip_id) references tipbilet (id)
+);
+
+
+create table Vozenje (
+                         bilet_id bigint,
+                         end_date timestamp(6) without time zone,
+                         id bigserial primary key,
+                         instanca_na_linija_id bigint,
+                         patnik_id bigint,
+                         postojka_na_linija_start_id bigint,
+                         start_date timestamp(6) without time zone,
+                         status character varying(255),
+                         foreign key (patnik_id) references patnik (id),
+                         foreign key (bilet_id) references bilet (id),
+                         foreign key (instanca_na_linija_id) references instanca_na_linija (id),
+                         foreign key (postojka_na_linija_start_id) references postojka_na_linija (id)
+);
+
+
+create table Kontrola (
+                          date_created timestamp(6) without time zone,
+                          id bigserial primary key,
+                          instanca_na_linija_id bigint,
+                          kondukter_id bigint,
+                          foreign key (instanca_na_linija_id) references instanca_na_linija (id),
+                          foreign key (kondukter_id) references kondukter (id)
+);
+
+create table Kazna (
+                       iznos double precision,
+                       plateno boolean,
+                       date_created timestamp(6) without time zone,
+                       date_payed timestamp(6) without time zone,
+                       id bigserial primary key,
+                       kondukter_id bigint,
+                       kontrola_id bigint,
+                       dokument character varying(255),
+                       foreign key (kondukter_id) references Kondukter (id),
+                       foreign key (kontrola_id) references kontrola (id)
+);
+
+
+create table Kazna_Za_Registriran(
+                                   id bigserial primary key,
+                                   kazna_id bigint,
+                                   patnik_id bigint,
+                                   foreign key (patnik_id) references patnik (id),
+                                   foreign key (kazna_id) references kazna (id)
+);
+
+create table kazna_za_neregistriran(
+                                     id bigserial primary key,
+                                     kazna_id bigint,
+                                     adresa character varying(255),
+                                     ime character varying(255),
+                                     telefon character varying(255),
+                                     foreign key (kazna_id) references kazna (id)
+);
+
+create table se_simnuva_na (
+                               id bigserial primary key,
+                               postojka_na_linija_id bigint,
+                               vozenje_id bigint,
+                               foreign key (vozenje_id) references vozenje (id),
+                               foreign key (postojka_na_linija_id) references postojka_na_linija (id)
+);
