示例#1
0
 @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();
 }
示例#2
0
 @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();
 }
示例#3
0
 @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);
 }
示例#4
0
 @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);
   }
 }