Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Renamed timesheetUser resource

  • Loading branch information...
commit 501ace25ab776f2f493c0046a3c8f2b6ce648408 1 parent c2e135a
Steven Hsu authored
15 ...cit/infosys/comp4911/services/UserTimesheets.java → ...sys/comp4911/services/UserTimesheetsResource.java
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.