package tay.resource;

import tay.api.Nutrition;
import tay.core.NutritionRepository;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.util.*;
/**
 * Created by yoseph on 4/22/17.
 */

@Path("nutrition")
@Produces(MediaType.APPLICATION_JSON)
public class NutritionResource {

    private NutritionRepository repo;
    public NutritionResource(NutritionRepository repo) {
        this.repo = repo;
    }

    @GET
    public List<Nutrition> allNutrition() throws IOException {
        return repo.findAll();
    }
}

@@ -16,16 +16,59 @@
 ource;%0A%0A
+import io.dropwizard.hibernate.UnitOfWork;%0A
 import t
@@ -121,16 +121,44 @@
 ository;
+%0Aimport tay.db.NutritionDAO;
 %0A%0Aimport
@@ -445,16 +445,18 @@
 urce %7B%0A%0A
+//
     priv
@@ -481,24 +481,26 @@
 itory repo;%0A
+//
     public N
@@ -544,16 +544,18 @@
 repo) %7B%0A
+//
         
@@ -576,23 +576,188 @@
 po;%0A
-    %7D%0A%0A    @GET
+//    %7D%0A%0A    private NutritionDAO nutritionDAO;%0A%0A    public NutritionResource(NutritionDAO nutritionDAO) %7B%0A        this.nutritionDAO = nutritionDAO;%0A    %7D%0A%0A    @GET%0A    @UnitOfWork
 %0A   
@@ -831,20 +831,28 @@
  return 
-repo
+nutritionDAO
 .findAll

use dao instead of in memory repo