@Path("/peeps/dislike") @Post @Consumes("application/json") public void dislike(Peep peep) { User loggedUser = userSession.getUser(); postsDao.dislike(peep, loggedUser.getEmail()); result.use(Results.status()).ok(); }
@Path("/peeps/show") @Get public void list() { User user = userSession.getUser(); List<Peep> peeps = postsDao.retrieveTimeline(user, 0, PEEPS_LIMIT); result.include("peeps", peeps); result.forwardTo(PeepsController.class).show(); }
@Path("/peeps/showLikers") @Post @Consumes("application/json") public void showLikers(Peep peep) { peep = postsDao.retrieveById(peep); result.include("isALiker", peep.isALiker(userSession.getUser().getEmail())); result.include("peep", peep); }
@Path("/peeps") @Post @Consumes("application/json") public void save(Peep peep) { User user = userSession.getUser(); if (user != null) { peep.setDate(new Date()); peep.setAuthor(user.getEmail()); peep.setHash(user.getHashFoto()); peep.addHashTags(); postsDao.save(peep); result.include("peep", peep); } }