This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext, useState } from "react"; | |
import PageContainer from "../components/PageContainer.component"; | |
import { UserContext } from "../contexts/user.context"; | |
import { gql, request } from "graphql-request"; | |
import { GRAPHQL_ENDPOINT } from "../realm/constants"; | |
import ExpenseForm from "../components/ExpenseForm.component"; | |
import { useNavigate } from "react-router-dom"; | |
const CreateExpense = () => { | |
const { user } = useContext(UserContext); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Button, TextField } from "@mui/material"; | |
import CustomDatePicker from "./CustomDatePicker.component"; | |
import PageContainer from "./PageContainer.component"; | |
const ExpenseForm = ({ onSubmit, form, setForm, editing }) => { | |
const onFormInputChange = (event) => { | |
const { name, value } = event.target; | |
setForm({ ...form, [name]: value }); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import TextField from '@mui/material/TextField'; | |
import AdapterDateFns from '@mui/lab/AdapterDateFns'; | |
import LocalizationProvider from '@mui/lab/LocalizationProvider'; | |
import DatePicker from '@mui/lab/DatePicker'; | |
const CustomDatePicker = ({ label, value, onChange, style }) => { | |
return ( | |
<span style={style}> | |
<LocalizationProvider dateAdapter={AdapterDateFns}> | |
<DatePicker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext, useEffect, useState } from "react"; | |
import PageContainer from "../components/PageContainer.component"; | |
import { UserContext } from "../contexts/user.context"; | |
import { gql, request } from "graphql-request"; | |
import { GRAPHQL_ENDPOINT } from "../realm/constants"; | |
import ExpenseForm from "../components/ExpenseForm.component"; | |
import { useParams, useNavigate } from "react-router-dom"; | |
const EditExpense = () => { | |
const { user } = useContext(UserContext); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BrowserRouter, Route, Routes } from "react-router-dom"; | |
import NavBar from "./components/NavBar.component"; | |
import { UserProvider } from "./contexts/user.context"; | |
import CreateExpense from "./pages/CreateExpense.page"; | |
import EditExpense from "./pages/EditExpense.page"; | |
import Home from "./pages/Home.page"; | |
import Login from "./pages/Login.page"; | |
import PrivateRoute from "./pages/PrivateRoute.page"; | |
import Signup from "./pages/Signup.page"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports = async (input) => { | |
// fetching the from and to date from the input query of Custom GraphQL Resolver | |
const {from, to} = input; | |
const collection = context.services.get('mongodb-atlas').db('expengo').collection("expenses"); | |
const user = context.user.id; | |
// Creating a pipeline that matches the current author and the timeline mentioned in the input query, | |
// and then combine all the amount by category. | |
const pipeline = [ | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "object", | |
"title": "filter", | |
"properties": { | |
"from": { | |
"bsonType": "timestamp" | |
}, | |
"to": { | |
"bsonType": "timestamp" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "object", | |
"title": "CategoryAnalyticsOutput", | |
"properties": { | |
"categories": { | |
"bsonType": "array", | |
"items": { | |
"bsonType": "object", | |
"title": "categoryAnalyticsItem", | |
"properties": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useContext, useEffect, useState } from "react"; | |
import { Button, Grid } from "@mui/material"; | |
import request, { gql } from "graphql-request"; | |
import { formatISO, subMonths, endOfToday, startOfDay, endOfDay } from "date-fns"; | |
import { UserContext } from "../contexts/user.context"; | |
import { GRAPHQL_ENDPOINT } from "../realm/constants"; | |
import PageContainer from "../components/PageContainer.component"; | |
import CustomDatePicker from "../components/CustomDatePicker.component"; | |
import ModeAnalytics from "../components/ModeAnalytics.component"; | |
import CategoryAnalytics from "../components/CategoryAnalytics.component"; |