Browse files

Renamed timesheetUser resource

  • Loading branch information...
1 parent c2e135a commit 501ace25ab776f2f493c0046a3c8f2b6ce648408 @shsu committed Feb 24, 2014
View
15 ...sys/comp4911/services/UserTimesheets.java → ...4911/services/UserTimesheetsResource.java
@@ -17,7 +17,7 @@
import java.util.List;
@Path("/user/timesheets")
-public class UserTimesheets {
+public class UserTimesheetsResource {
@EJB
private UserTokens userTokens;
@@ -34,20 +34,13 @@ public Response retrieveAllTimesheetsForUser(
String token = SH.processHeaderQueryToken(headerToken, queryToken);
int userId = userTokens.verifyTokenAndReturnUserID(token);
- List<Timesheet> timesheetList;
-
if (timesheetsFilter.equals("current")) {
- // TODO: Get only latest timesheets for user.
- // timesheetDao.getCurrent(int year, int week)
- // SH.getCurrentWeek()
- // SH.getCurrentYear()
- timesheetList = timesheetDao.getAll();
+ return SH.corsResponseWithEntity(200, timesheetDao.getByDate(
+ SH.getCurrentWeek(), SH.getCurrentYear(), userId));
} else {
// TODO: Get timesheet for user.
- timesheetList = timesheetDao.getAll();
+ return SH.corsResponseWithEntity(200, timesheetDao.getAll());
}
-
- return SH.corsResponseWithEntity(200, timesheetList);
}
@GET

0 comments on commit 501ace2

Please sign in to comment.