diff --git a/src/index.js b/src/index.js index 284503d..79e3d40 100644 --- a/src/index.js +++ b/src/index.js @@ -26,15 +26,15 @@ import { PersistGate } from "redux-persist/integration/react" import { ApolloClient, InMemoryCache, ApolloProvider } from "@apollo/client" -const client = new ApolloClient({ - uri: "http://localhost:8000/graphql", - cache: new InMemoryCache() -}) +// const client = new ApolloClient({ +// uri: "http://localhost:8000/graphql", +// cache: new InMemoryCache() +// }) const root = ReactDOM.createRoot(document.getElementById('root')); root.render( - + {/* */} {/* */} @@ -64,7 +64,7 @@ root.render( {/* */} - + {/* */} ); diff --git a/src/utils/graphql/nutrition-tracker.graphql.js b/src/utils/graphql/nutrition-tracker.graphql.js index e69de29..44a9bb9 100644 --- a/src/utils/graphql/nutrition-tracker.graphql.js +++ b/src/utils/graphql/nutrition-tracker.graphql.js @@ -0,0 +1,62 @@ +import { gql } from "@apollo/client"; + +// graphql nutrition tracker queries +export const NUTRITION_TRACKED_DAYS_BY_USER = gql` + query NutritionTrackedDaysByUser($userId: String!, $email: String!) { + nutritionTrackedDaysByUser(userId: $userId, email: $email) { + dateTracked + calories + macronutrients { + carbohydrates + protein + fat + } + micronutrients { + exerciseName + amount + unit + } + } + } +` + +export const NUTRITION_TRACKED_DAYS_SUMMARY_BY_USER = gql` + query NutritionTrackedDaysSummaryByUser($userId: String!, $email: String!) { + nutritionTrackedDaysSummaryByUser(userId: $userId, email: $email) { + averageDailyCaloriesConsumption + averageDailyCarbohydratesConsumption + averageDailyFatConsumption + } + } +` + +// graphql nutrition tracker mutations +export const CREATE_USER_NUTRITION_TRACKED_DAY = gql` + mutation CreateUserNutritionTrackedDay($userId: String!, $email: String!, $nutritionTrackedDay: NutritionTrackedDayInfo!) { + createUserNutritionTrackedDay(userId: $userId, email: $email, nutritionTrackedDay: $nutritionTrackedDay) + } +` + +export const DELETE_USER_NUTRITION_TRACKED_DAY = gql` + mutation DeleteUserNutritionTrackedDay($userId: String!, $email: String!, $nutritionTrackedDate: String!) { + deleteUserNutritionTrackedDay(userId: $userId, email: $email, nutritionTrackedDate: $nutritionTrackedDate) + } +` + +export const UPDATE_USER_NUTRITION_TRACKED_DAY = gql` + mutation UpdateUserNutritionTrackedDay($userId: String!, $email: String!, $nutritionTrackedDayInfoUpdate: NutritionTrackedDayInfoUpdate!) { + updateUserNutritionTrackedDay(userId: $userId, email: $email, nutritionTrackedDayInfoUpdate: $nutritionTrackedDayInfoUpdate) + } +` + +export const UPDATE_USER_NUTRITION_TRACKED_DAYS = gql` + mutation UpdateUserNutritionTrackedDays($userId: String!, $email: String!, $nutritionTrackedDays: [NutritionTrackedDayInfo]!) { + updateUserNutritionTrackedDays(userId: $userId, email: $email, nutritionTrackedDays: $nutritionTrackedDays) + } +` + +export const UPDATE_USER_NUTRITION_TRACKED_DAYS_SUMMARY = gql` + mutation UpdateUserNutritionTrackedDaysSummary($userId: String!, $email: String!, $nutritionTrackedDaysSummary: NutritionTrackedDaysSummaryInfo!) { + updateUserNutritionTrackedDaysSummary(userId: $userId, email: $email, nutritionTrackedDaysSummary: $nutritionTrackedDaysSummary) + } +` \ No newline at end of file