Commit 94b61059 by Bogdan Andjelkovic

obrisani souti i uredjen kod malo

parent 4ff6a1b9
...@@ -20,18 +20,22 @@ public class AdminController ...@@ -20,18 +20,22 @@ public class AdminController
{ {
@Autowired @Autowired
KomentarRepository komRepo; KomentarRepository komRepo;
@Autowired @Autowired
KorisnikRepository kRepo; KorisnikRepository kRepo;
@Autowired
LokacijaRepository lRepo;
@Autowired @Autowired
OglasRepository oRepo; OglasRepository oRepo;
@Autowired @Autowired
ZahtevRepository zRepo; ZahtevRepository zRepo;
@Autowired @Autowired
LajkRepository lajkRepo; LajkRepository lajkRepo;
@Autowired @Autowired
KomentarVlasnikRepository komentarVlasnikRepo; KomentarVlasnikRepository komentarVlasnikRepo;
@GetMapping("/lista-korisnika") @GetMapping("/lista-korisnika")
public String getListaKorisnika(Model model, @AuthenticationPrincipal KorisnikDetails loggedUser) public String getListaKorisnika(Model model, @AuthenticationPrincipal KorisnikDetails loggedUser)
{ {
......
...@@ -24,6 +24,7 @@ public class AppController ...@@ -24,6 +24,7 @@ public class AppController
{ {
@Autowired @Autowired
KorisnikRepository kRepo; KorisnikRepository kRepo;
@Autowired @Autowired
LokacijaRepository lRepo; LokacijaRepository lRepo;
...@@ -68,6 +69,7 @@ public class AppController ...@@ -68,6 +69,7 @@ public class AppController
return("register"); return("register");
} }
} }
@GetMapping("/onama") @GetMapping("/onama")
public String getOnama(Model model,@AuthenticationPrincipal KorisnikDetails loggedUser) public String getOnama(Model model,@AuthenticationPrincipal KorisnikDetails loggedUser)
{ {
......
...@@ -14,8 +14,10 @@ public class AppRestController ...@@ -14,8 +14,10 @@ public class AppRestController
{ {
@Autowired @Autowired
KorisnikRepository kRepo; KorisnikRepository kRepo;
@Autowired @Autowired
LokacijaRepository lRepo; LokacijaRepository lRepo;
@GetMapping("/listLokacija") @GetMapping("/listLokacija")
public List<Lokacija> getRegister() public List<Lokacija> getRegister()
{ {
......
...@@ -10,13 +10,17 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -10,13 +10,17 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@Controller @Controller
public class KomentarController { public class KomentarController
{
@Autowired @Autowired
KomentarRepository komentarRepo; KomentarRepository komentarRepo;
@Autowired @Autowired
ZahtevRepository zRepo; ZahtevRepository zRepo;
@Autowired @Autowired
KomentarVlasnikRepository komentarVlasnikRepo; KomentarVlasnikRepository komentarVlasnikRepo;
@GetMapping("/profile/moji-zahtevi/sacuvaj-komentar") @GetMapping("/profile/moji-zahtevi/sacuvaj-komentar")
public String postSacuvajKomentar(@RequestParam("korisnikId") int korisnikId, public String postSacuvajKomentar(@RequestParam("korisnikId") int korisnikId,
@RequestParam("oglasId") int oglasId, @RequestParam("oglasId") int oglasId,
......
...@@ -16,6 +16,7 @@ public class LajkController ...@@ -16,6 +16,7 @@ public class LajkController
{ {
@Autowired @Autowired
LajkRepository lajkRepo; LajkRepository lajkRepo;
@GetMapping("/lajkuj-oglas/{oglasId}") @GetMapping("/lajkuj-oglas/{oglasId}")
public String postLajkujOglas(Model model, @AuthenticationPrincipal KorisnikDetails loggedUser, @PathVariable("oglasId") int oglasId) public String postLajkujOglas(Model model, @AuthenticationPrincipal KorisnikDetails loggedUser, @PathVariable("oglasId") int oglasId)
{ {
......
...@@ -35,8 +35,10 @@ public class ProfileController ...@@ -35,8 +35,10 @@ public class ProfileController
@Autowired @Autowired
KomentarRepository komRepo; KomentarRepository komRepo;
@Autowired @Autowired
KomentarVlasnikRepository komentarVlasnikRepo; KomentarVlasnikRepository komentarVlasnikRepo;
@GetMapping("/profile") @GetMapping("/profile")
public String getProfile(Model model, @AuthenticationPrincipal KorisnikDetails loggedUser) public String getProfile(Model model, @AuthenticationPrincipal KorisnikDetails loggedUser)
{ {
......
...@@ -26,14 +26,17 @@ import java.util.Date; ...@@ -26,14 +26,17 @@ import java.util.Date;
import java.util.List; import java.util.List;
@Controller @Controller
public class ZahtevController { public class ZahtevController
{
@Autowired @Autowired
ZahtevRepository zRepo; ZahtevRepository zRepo;
@Autowired @Autowired
OglasRepository oRepo; OglasRepository oRepo;
@Autowired @Autowired
SlikeRepository sRepo; SlikeRepository sRepo;
@Autowired @Autowired
KorisnikRepository kRepo; KorisnikRepository kRepo;
......
...@@ -25,12 +25,10 @@ public class LajkRepository { ...@@ -25,12 +25,10 @@ public class LajkRepository {
{ {
if(this.isLiked(lajk)) if(this.isLiked(lajk))
{ {
System.out.println("delete "+ lajk.toString());
this.deleteLajk(lajk); this.deleteLajk(lajk);
} }
else else
{ {
System.out.println("insert "+ lajk.toString());
this.insertLajk(lajk); this.insertLajk(lajk);
} }
} }
......
...@@ -226,8 +226,7 @@ public class OglasRepository ...@@ -226,8 +226,7 @@ public class OglasRepository
if(!( pretraga == null || ( pretraga != null && oglas.getNaslov().toLowerCase().contains( pretraga.toLowerCase()) ) ) ) continue; if(!( pretraga == null || ( pretraga != null && oglas.getNaslov().toLowerCase().contains( pretraga.toLowerCase()) ) ) ) continue;
else if(!( pretraga == null || ( pretraga != null && oglas.getOpis().toLowerCase().contains( pretraga.toLowerCase()) ) ) ) continue; else if(!( pretraga == null || ( pretraga != null && oglas.getOpis().toLowerCase().contains( pretraga.toLowerCase()) ) ) ) continue;
;
System.out.println( oglas.toString());
list.add( oglas); list.add( oglas);
} }
} catch (SQLException e) { } catch (SQLException e) {
......
...@@ -26,7 +26,6 @@ public class ZahtevRepository { ...@@ -26,7 +26,6 @@ public class ZahtevRepository {
provera.setInt( 2, oglasId); provera.setInt( 2, oglasId);
ResultSet rs = provera.executeQuery(); ResultSet rs = provera.executeQuery();
while( rs.next()) { while( rs.next()) {
System.out.println(rs.getString("stanje"));
throw new AktivanZahtevPostoji(); throw new AktivanZahtevPostoji();
} }
} catch (SQLException e) { } catch (SQLException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment