From 97a1336a585f5f0198be685d7276f964c011b506 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Tue, 16 Apr 2024 18:52:33 -0300 Subject: [PATCH 001/173] Add react-circular-progressbar package --- app/package-lock.json | 9 +++++++++ app/package.json | 1 + 2 files changed, 10 insertions(+) diff --git a/app/package-lock.json b/app/package-lock.json index 486ab7c..4c73a63 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -22,6 +22,7 @@ "marked": "^12.0.1", "react": "^18.2.0", "react-bootstrap": "^2.10.2", + "react-circular-progressbar": "^2.1.0", "react-dom": "^18.2.0", "react-router-dom": "^6.22.3" }, @@ -3802,6 +3803,14 @@ } } }, + "node_modules/react-circular-progressbar": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/react-circular-progressbar/-/react-circular-progressbar-2.1.0.tgz", + "integrity": "sha512-xp4THTrod4aLpGy68FX/k1Q3nzrfHUjUe5v6FsdwXBl3YVMwgeXYQKDrku7n/D6qsJA9CuunarAboC2xCiKs1g==", + "peerDependencies": { + "react": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-dom": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", diff --git a/app/package.json b/app/package.json index 358ce6a..0f740aa 100644 --- a/app/package.json +++ b/app/package.json @@ -24,6 +24,7 @@ "marked": "^12.0.1", "react": "^18.2.0", "react-bootstrap": "^2.10.2", + "react-circular-progressbar": "^2.1.0", "react-dom": "^18.2.0", "react-router-dom": "^6.22.3" }, From 62aa20bbbbc3ee477d93e72a2e125584e8b857db Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Tue, 16 Apr 2024 18:52:38 -0300 Subject: [PATCH 002/173] Update index.css with new color variables --- app/src/index.css | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/src/index.css b/app/src/index.css index 3b9cfab..568d36d 100644 --- a/app/src/index.css +++ b/app/src/index.css @@ -16,6 +16,8 @@ --c1: #f3edfa; --c2: #dfdae5; --c3: #c6c2cc; + --c4: #B3AEB8; + --c5: #9F9BA3; --c6: #8B888F; --c7: #77747a; --c8: #636166; @@ -75,16 +77,6 @@ h1 { line-height: 1.1; } -button { - border-radius: 8px; - border: 1px solid transparent; - padding: 0.5rem 1rem; - font-size: 14px; - font-weight: 500; - font-family: inherit; - cursor: pointer; -} - @media (prefers-color-scheme: light) { :root { color: #213547; From ccb6af77438b1bda443c15d410942a5d2c52d255 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Tue, 16 Apr 2024 18:52:43 -0300 Subject: [PATCH 003/173] Update file paths for PageTasks and PageCards components --- app/src/main.jsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main.jsx b/app/src/main.jsx index 2fd792f..70de121 100644 --- a/app/src/main.jsx +++ b/app/src/main.jsx @@ -23,9 +23,10 @@ import "./index.css"; import LandingPage from "./components/pages/LandingPage.jsx"; import LoginPage from "./components/LoginPage.jsx"; import ErrorPage from "./components/ErrorPage.jsx"; -import PageTasks from "./components/app/PageTasks.jsx"; -import PageCards from "./components/app/PageCards.jsx"; +import PageTasks from "./components/app/tasks/PageTasks.jsx"; +import PageCards from "./components/app/cards/PageCards.jsx"; import Markdown from "./components/app/markdown/Markdown.jsx"; +import PagePomo from "./components/app/pomo/PagePomo.jsx"; const router = createBrowserRouter([ { @@ -47,13 +48,17 @@ const router = createBrowserRouter([ }, { path: "cards", - element: + element: , }, { path: "notes", element: , - } - ] + }, + { + path: "pomo", + element: , + }, + ], }, { path: "login", @@ -63,8 +68,6 @@ const router = createBrowserRouter([ path: "cadastro", element: , }, - - ]); ReactDOM.createRoot(document.getElementById("root")).render( From 3f35ddfae6493433d1cdbe708a51a3d4d9b306e6 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Tue, 16 Apr 2024 18:52:52 -0300 Subject: [PATCH 004/173] Refactor PageTasks component and its styles --- app/src/components/app/PageCard.module.css | 259 -------------------- app/src/components/app/PageCards.jsx | 118 --------- app/src/components/app/PageTasks.jsx | 69 ------ app/src/components/app/PageTasks.module.css | 128 ---------- 4 files changed, 574 deletions(-) delete mode 100644 app/src/components/app/PageCard.module.css delete mode 100644 app/src/components/app/PageCards.jsx delete mode 100644 app/src/components/app/PageTasks.jsx delete mode 100644 app/src/components/app/PageTasks.module.css diff --git a/app/src/components/app/PageCard.module.css b/app/src/components/app/PageCard.module.css deleted file mode 100644 index 9fedc32..0000000 --- a/app/src/components/app/PageCard.module.css +++ /dev/null @@ -1,259 +0,0 @@ -.caixasBody { - padding: 16px; - display: flex; - gap: 16px; - flex-wrap: wrap; - width: 100%; - box-shadow: 1px 0px 0px 0px var(--c3); -} - -.caixa { - display: flex; - width: 224px; - height: fit-content; - padding: 16px; - flex-direction: column; - justify-content: center; - align-items: flex-start; - gap: 8px; - - border-radius: 8px; - border: 1px solid var(--c7); - - &.active { - border-top: 1px solid var(--r7); - border-right: 2px solid var(--r7); - border-bottom: 2px solid var(--r7); - border-left: 1px solid var(--r7); - } -} - -.tituloCaixa { - color: var(--r12); - font-family: Raleway; - font-size: 14px; - font-style: normal; - font-weight: 500; - line-height: normal; - margin: 0; -} - -.descCaixa { - color: var(--c10); - font-family: Lato; - font-size: 12px; - font-style: normal; - font-weight: 400; - line-height: normal; -} - -.listaCaixas { - display: flex; - align-items: center; - gap: 8px; - list-style: none; - margin: 0; - padding: 0; -} - -.noCardSelected { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - gap: 16px; - padding: 16px; - width: 36%; - min-width: 320px; -} - -.img { - width: 100px; - height: 100px; -} - -.infoText { - color: var(--c7); - font-family: Raleway; - font-size: 12px; - font-style: normal; - font-weight: 400; - line-height: normal; -} - -.cardInfo { - display: flex; - flex-direction: column; - gap: 8px; - align-items: center; - width: 36%; - min-width: 320px; - padding: 16px; -} - -.cardHeader { - display: flex; - justify-content: center; - align-items: center; - width: 100%; - padding: 8px 16px; -} - -.cardTitle { - color: var(--c12); - font-family: Raleway; - font-size: 14px; - font-style: normal; - font-weight: 600; - line-height: normal; -} - -.wrapperNiveis { - display: flex; - justify-content: center; -} - -.nivel { - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - gap: 4px; - padding: 0 8px; -} - -.nivel span { - color: var(--c12); - font-family: Lato; - font-size: 14px; - font-style: normal; - font-weight: 500; - line-height: normal; -} - -.secHeader { - display: flex; - justify-content: space-between; - align-items: center; - width: 100%; - padding: 16px 8px; -} - -.cardSecTitle { - color: var(--c12); - font-family: Raleway; - font-size: 14px; - font-style: normal; - font-weight: 400; - line-height: normal; -} - -.qtdCards { - font-family: Lato; - font-weight: 700; -} - -.addCard { - padding: 8px 16px; - border-radius: 8px; - color: var(--r1); - background-color: var(--r12); - font-family: Raleway; - font-size: 12px; - font-style: normal; - font-weight: 500; - line-height: normal; -} - -.wrapperEstudar { - display: flex; - flex-direction: column; - gap: 16px; - padding: 16px 8px; - width: 100%; - align-items: center; -} - -.qtdEstudar { - color: var(--r12); - font-family: Lato; - font-size: 32px; - font-style: normal; - font-weight: 500; - line-height: normal; -} - -.btnEstudar { - padding: 8px 16px; - border-radius: 8px; - background-color: var(--r7); - color: var(--r1); - font-family: Raleway; - font-size: 12px; - font-style: normal; - font-weight: 500; - line-height: normal; -} - -.wrapperTabs { - display: flex; - flex-direction: column; - gap: 10px; - align-items: flex-start; - padding: 8px; - background-color: var(--r1); - border-radius: 8px; - width: 100%; -} - -.nav { - display: flex; - background-color: var(--r12); - border-radius: 8px; - padding: 4px; -} - -.tab { - color: var(--r1); - font-family: Lato; - font-size: 12px; - font-style: normal; - font-weight: 500; - line-height: normal; - background-color: transparent; - border-radius: 4px; - padding: 4px 8px; -} - -.tab.active { - background-color: var(--r1); - color: var(--r12); -} - -.tarefas { - display: flex; - flex-direction: column; - gap: 10px; - width: 100%; -} - -.tarefa { - display: flex; - justify-content: space-between; - align-items: center; - gap: 8px; - padding: 16px; - border-radius: 8px; - background-color: transparent; - width: 100%; - border: 1px solid var(--r12); -} - -.tarefaTitle { - color: var(--r12); - font-family: Raleway; - font-size: 12px; - font-style: normal; - font-weight: 400; - line-height: normal; -} \ No newline at end of file diff --git a/app/src/components/app/PageCards.jsx b/app/src/components/app/PageCards.jsx deleted file mode 100644 index 7da9b8f..0000000 --- a/app/src/components/app/PageCards.jsx +++ /dev/null @@ -1,118 +0,0 @@ -import React, { useState } from "react"; -import style from "./PageCard.module.css"; -import { UilBox, UilEdit } from "@iconscout/react-unicons"; -import logo from "../../assets/logo-cinza.png"; - -function PageCard() { - const [selectedCard, setSelectedCard] = useState(1); - - return ( - <> -
-
-

Vocabulário Francês

- 2 cartões, 2 para hoje -
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
-
-

Vocabulário Francês

- 2 cartões, 2 para hoje -
    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
-
-
- {selectedCard ? ( -
-
-

Vocabulário Francês

-
-
-
- 2 - -
-
- 0 - -
-
- 0 - -
-
- 0 - -
-
- 0 - -
-
-
-

- Cartões na caixa: 2 -

- -
-
-

0/2

- -
-
-
- - - -
-
-
- Vouloir - -
-
-
-
- ) : ( -
- Logo -

- Clique em uma caixa para ver mais informações -

-
- )} - - ); -} - -export default PageCard; diff --git a/app/src/components/app/PageTasks.jsx b/app/src/components/app/PageTasks.jsx deleted file mode 100644 index 3ccf854..0000000 --- a/app/src/components/app/PageTasks.jsx +++ /dev/null @@ -1,69 +0,0 @@ -import React, { useState } from "react"; -import SecSidebar from "./SecSidebar"; -import style from "./PageTasks.module.css"; -import { - UilArrowToRight, - UilLeftArrowToLeft, - UilSlidersV, - UilGrid, - UilAngleDown, - UilCircle, -} from "@iconscout/react-unicons"; -import useListas from "./Listas"; - -const PageTasks = () => { - const [sidebar, setSidebar] = useState(true); - const { listas, setListas, addLista } = useListas(); - - return ( - <> - -
-
-
- {sidebar ? ( - setSidebar(false)} - /> - ) : ( - setSidebar(true)} - /> - )} -

Hoje

-
-
- - -
-
- {listas.map((lista) => ( -
-
- - {lista.nome} -
- {lista.tarefas.map((tarefa) => ( -
-
- - {tarefa.nome} -
-
- {lista.nome} - {tarefa.data} -
-
- ))} -
- ))} -
- - ); -}; - -export default PageTasks; diff --git a/app/src/components/app/PageTasks.module.css b/app/src/components/app/PageTasks.module.css deleted file mode 100644 index c1ab87c..0000000 --- a/app/src/components/app/PageTasks.module.css +++ /dev/null @@ -1,128 +0,0 @@ -.tasksBody { - display: flex; - flex-direction: column; - gap: 8px; - padding: 16px; - width: 100%; -} - -.tasksHeader { - display: flex; - padding: 16px 0; - justify-content: space-between; - align-items: center; - width: 100%; - gap: 16px; -} - -.switchSidebarContainer { - display: flex; - align-items: center; - gap: 16px; - - & > svg { - cursor: pointer; - } -} - -.listTitle { - color: var(--c11); - font-family: Raleway; - font-size: 20px; - font-style: normal; - font-weight: 700; - line-height: normal; - margin: 0; - display: flex; - align-items: center; - gap: 8px; -} - -.gridSettings { - display: flex; - gap: 16px; - align-items: center; - - & > * { - cursor: pointer; - } -} - -.lista { - display: flex; - flex-direction: column; - gap: 8px; - border-radius: 8px; -} - -.listaHeader { - display: flex; - align-items: center; - gap: 4px; - padding: 4px 0; - cursor: pointer; -} - -.listaNome { - color: var(--c11); - font-family: Raleway; - font-size: 12px; - font-style: normal; - font-weight: 700; - line-height: normal; -} - -.tarefa { - display: flex; - align-items: center; - justify-content: space-between; - padding: 8px; - gap: 16px; - border-radius: 8px; - border: 1px solid var(--c7); - - &:hover { - background-color: var(--r1); - } -} - -.tarefaCheck { - display: flex; - align-items: center; - gap: 8px; -} - -.tarefaNome { - color: var(--c12); - font-family: Raleway; - font-size: 12px; - font-style: normal; - font-weight: 500; - line-height: normal; -} - -.tarefaOptions { - display: flex; - align-items: center; - gap: 8px; - flex-wrap: wrap; -} - -.tarefaOptionsLista { - color: var(--c10); - font-family: Raleway; - font-size: 10px; - font-style: normal; - font-weight: 400; - line-height: normal; -} - -.tarefaOptionsData { - color: var(--azul-royal); - font-variant-numeric: lining-nums proportional-nums; - font-family: Raleway; - font-size: 12px; - font-style: normal; - font-weight: 400; - line-height: normal; -} From d2a6ff03eeb29eca46d401463d021204abf502c3 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Tue, 16 Apr 2024 18:53:08 -0300 Subject: [PATCH 005/173] Refactor PagePomo component and its styles --- .../components/app/cards/PageCard.module.css | 259 ++++++++++++++++++ app/src/components/app/cards/PageCards.jsx | 118 ++++++++ app/src/components/app/pomo/PagePomo.jsx | 14 + .../components/app/pomo/PagePomo.module.css | 20 ++ app/src/components/app/tasks/PageTasks.jsx | 69 +++++ .../components/app/tasks/PageTasks.module.css | 128 +++++++++ 6 files changed, 608 insertions(+) create mode 100644 app/src/components/app/cards/PageCard.module.css create mode 100644 app/src/components/app/cards/PageCards.jsx create mode 100644 app/src/components/app/pomo/PagePomo.jsx create mode 100644 app/src/components/app/pomo/PagePomo.module.css create mode 100644 app/src/components/app/tasks/PageTasks.jsx create mode 100644 app/src/components/app/tasks/PageTasks.module.css diff --git a/app/src/components/app/cards/PageCard.module.css b/app/src/components/app/cards/PageCard.module.css new file mode 100644 index 0000000..9fedc32 --- /dev/null +++ b/app/src/components/app/cards/PageCard.module.css @@ -0,0 +1,259 @@ +.caixasBody { + padding: 16px; + display: flex; + gap: 16px; + flex-wrap: wrap; + width: 100%; + box-shadow: 1px 0px 0px 0px var(--c3); +} + +.caixa { + display: flex; + width: 224px; + height: fit-content; + padding: 16px; + flex-direction: column; + justify-content: center; + align-items: flex-start; + gap: 8px; + + border-radius: 8px; + border: 1px solid var(--c7); + + &.active { + border-top: 1px solid var(--r7); + border-right: 2px solid var(--r7); + border-bottom: 2px solid var(--r7); + border-left: 1px solid var(--r7); + } +} + +.tituloCaixa { + color: var(--r12); + font-family: Raleway; + font-size: 14px; + font-style: normal; + font-weight: 500; + line-height: normal; + margin: 0; +} + +.descCaixa { + color: var(--c10); + font-family: Lato; + font-size: 12px; + font-style: normal; + font-weight: 400; + line-height: normal; +} + +.listaCaixas { + display: flex; + align-items: center; + gap: 8px; + list-style: none; + margin: 0; + padding: 0; +} + +.noCardSelected { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 16px; + padding: 16px; + width: 36%; + min-width: 320px; +} + +.img { + width: 100px; + height: 100px; +} + +.infoText { + color: var(--c7); + font-family: Raleway; + font-size: 12px; + font-style: normal; + font-weight: 400; + line-height: normal; +} + +.cardInfo { + display: flex; + flex-direction: column; + gap: 8px; + align-items: center; + width: 36%; + min-width: 320px; + padding: 16px; +} + +.cardHeader { + display: flex; + justify-content: center; + align-items: center; + width: 100%; + padding: 8px 16px; +} + +.cardTitle { + color: var(--c12); + font-family: Raleway; + font-size: 14px; + font-style: normal; + font-weight: 600; + line-height: normal; +} + +.wrapperNiveis { + display: flex; + justify-content: center; +} + +.nivel { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 4px; + padding: 0 8px; +} + +.nivel span { + color: var(--c12); + font-family: Lato; + font-size: 14px; + font-style: normal; + font-weight: 500; + line-height: normal; +} + +.secHeader { + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; + padding: 16px 8px; +} + +.cardSecTitle { + color: var(--c12); + font-family: Raleway; + font-size: 14px; + font-style: normal; + font-weight: 400; + line-height: normal; +} + +.qtdCards { + font-family: Lato; + font-weight: 700; +} + +.addCard { + padding: 8px 16px; + border-radius: 8px; + color: var(--r1); + background-color: var(--r12); + font-family: Raleway; + font-size: 12px; + font-style: normal; + font-weight: 500; + line-height: normal; +} + +.wrapperEstudar { + display: flex; + flex-direction: column; + gap: 16px; + padding: 16px 8px; + width: 100%; + align-items: center; +} + +.qtdEstudar { + color: var(--r12); + font-family: Lato; + font-size: 32px; + font-style: normal; + font-weight: 500; + line-height: normal; +} + +.btnEstudar { + padding: 8px 16px; + border-radius: 8px; + background-color: var(--r7); + color: var(--r1); + font-family: Raleway; + font-size: 12px; + font-style: normal; + font-weight: 500; + line-height: normal; +} + +.wrapperTabs { + display: flex; + flex-direction: column; + gap: 10px; + align-items: flex-start; + padding: 8px; + background-color: var(--r1); + border-radius: 8px; + width: 100%; +} + +.nav { + display: flex; + background-color: var(--r12); + border-radius: 8px; + padding: 4px; +} + +.tab { + color: var(--r1); + font-family: Lato; + font-size: 12px; + font-style: normal; + font-weight: 500; + line-height: normal; + background-color: transparent; + border-radius: 4px; + padding: 4px 8px; +} + +.tab.active { + background-color: var(--r1); + color: var(--r12); +} + +.tarefas { + display: flex; + flex-direction: column; + gap: 10px; + width: 100%; +} + +.tarefa { + display: flex; + justify-content: space-between; + align-items: center; + gap: 8px; + padding: 16px; + border-radius: 8px; + background-color: transparent; + width: 100%; + border: 1px solid var(--r12); +} + +.tarefaTitle { + color: var(--r12); + font-family: Raleway; + font-size: 12px; + font-style: normal; + font-weight: 400; + line-height: normal; +} \ No newline at end of file diff --git a/app/src/components/app/cards/PageCards.jsx b/app/src/components/app/cards/PageCards.jsx new file mode 100644 index 0000000..90feb2b --- /dev/null +++ b/app/src/components/app/cards/PageCards.jsx @@ -0,0 +1,118 @@ +import { useState } from "react"; +import style from "./PageCard.module.css"; +import { UilBox, UilEdit } from "@iconscout/react-unicons"; +import logo from "../../../assets/logo-cinza.png"; + +function PageCard() { + const [selectedCard, setSelectedCard] = useState(1); + + return ( + <> +
+
+

Vocabulário Francês

+ 2 cartões, 2 para hoje +
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+
+

Vocabulário Francês

+ 2 cartões, 2 para hoje +
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
+
+
+ {selectedCard ? ( +
+
+

Vocabulário Francês

+
+
+
+ 2 + +
+
+ 0 + +
+
+ 0 + +
+
+ 0 + +
+
+ 0 + +
+
+
+

+ Cartões na caixa: 2 +

+ +
+
+

0/2

+ +
+
+
+ + + +
+
+
+ Vouloir + +
+
+
+
+ ) : ( +
+ Logo +

+ Clique em uma caixa para ver mais informações +

+
+ )} + + ); +} + +export default PageCard; diff --git a/app/src/components/app/pomo/PagePomo.jsx b/app/src/components/app/pomo/PagePomo.jsx new file mode 100644 index 0000000..21e4742 --- /dev/null +++ b/app/src/components/app/pomo/PagePomo.jsx @@ -0,0 +1,14 @@ +import style from './PagePomo.module.css' +import Timer from './Timer' + +const PagePomo = () => { + return ( +
+
+ +
+
+ ) +} + +export default PagePomo \ No newline at end of file diff --git a/app/src/components/app/pomo/PagePomo.module.css b/app/src/components/app/pomo/PagePomo.module.css new file mode 100644 index 0000000..390e877 --- /dev/null +++ b/app/src/components/app/pomo/PagePomo.module.css @@ -0,0 +1,20 @@ +.pagePomo { + display: flex; +} + +.pomoBody { + display: flex; + flex-direction: column; + width: 100%; + height: 100%; + padding: 16px; +} + +.button { + background-color: transparent; + color: var(--c5); + border: 0; + display: inline-block; + width: 60px; + cursor: pointer; +} \ No newline at end of file diff --git a/app/src/components/app/tasks/PageTasks.jsx b/app/src/components/app/tasks/PageTasks.jsx new file mode 100644 index 0000000..0b50669 --- /dev/null +++ b/app/src/components/app/tasks/PageTasks.jsx @@ -0,0 +1,69 @@ +import React, { useState } from "react"; +import SecSidebar from "../SecSidebar"; +import style from "./PageTasks.module.css"; +import { + UilArrowToRight, + UilLeftArrowToLeft, + UilSlidersV, + UilGrid, + UilAngleDown, + UilCircle, +} from "@iconscout/react-unicons"; +import useListas from "../Listas"; + +const PageTasks = () => { + const [sidebar, setSidebar] = useState(true); + const { listas, setListas, addLista } = useListas(); + + return ( + <> + +
+
+
+ {sidebar ? ( + setSidebar(false)} + /> + ) : ( + setSidebar(true)} + /> + )} +

Hoje

+
+
+ + +
+
+ {listas.map((lista) => ( +
+
+ + {lista.nome} +
+ {lista.tarefas.map((tarefa) => ( +
+
+ + {tarefa.nome} +
+
+ {lista.nome} + {tarefa.data} +
+
+ ))} +
+ ))} +
+ + ); +}; + +export default PageTasks; diff --git a/app/src/components/app/tasks/PageTasks.module.css b/app/src/components/app/tasks/PageTasks.module.css new file mode 100644 index 0000000..c1ab87c --- /dev/null +++ b/app/src/components/app/tasks/PageTasks.module.css @@ -0,0 +1,128 @@ +.tasksBody { + display: flex; + flex-direction: column; + gap: 8px; + padding: 16px; + width: 100%; +} + +.tasksHeader { + display: flex; + padding: 16px 0; + justify-content: space-between; + align-items: center; + width: 100%; + gap: 16px; +} + +.switchSidebarContainer { + display: flex; + align-items: center; + gap: 16px; + + & > svg { + cursor: pointer; + } +} + +.listTitle { + color: var(--c11); + font-family: Raleway; + font-size: 20px; + font-style: normal; + font-weight: 700; + line-height: normal; + margin: 0; + display: flex; + align-items: center; + gap: 8px; +} + +.gridSettings { + display: flex; + gap: 16px; + align-items: center; + + & > * { + cursor: pointer; + } +} + +.lista { + display: flex; + flex-direction: column; + gap: 8px; + border-radius: 8px; +} + +.listaHeader { + display: flex; + align-items: center; + gap: 4px; + padding: 4px 0; + cursor: pointer; +} + +.listaNome { + color: var(--c11); + font-family: Raleway; + font-size: 12px; + font-style: normal; + font-weight: 700; + line-height: normal; +} + +.tarefa { + display: flex; + align-items: center; + justify-content: space-between; + padding: 8px; + gap: 16px; + border-radius: 8px; + border: 1px solid var(--c7); + + &:hover { + background-color: var(--r1); + } +} + +.tarefaCheck { + display: flex; + align-items: center; + gap: 8px; +} + +.tarefaNome { + color: var(--c12); + font-family: Raleway; + font-size: 12px; + font-style: normal; + font-weight: 500; + line-height: normal; +} + +.tarefaOptions { + display: flex; + align-items: center; + gap: 8px; + flex-wrap: wrap; +} + +.tarefaOptionsLista { + color: var(--c10); + font-family: Raleway; + font-size: 10px; + font-style: normal; + font-weight: 400; + line-height: normal; +} + +.tarefaOptionsData { + color: var(--azul-royal); + font-variant-numeric: lining-nums proportional-nums; + font-family: Raleway; + font-size: 12px; + font-style: normal; + font-weight: 400; + line-height: normal; +} From da40d0906eaf4a7e12785025ad92b99dc5ab81fd Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Tue, 16 Apr 2024 18:53:19 -0300 Subject: [PATCH 006/173] Refactor Pomo components and add Timer component --- app/src/components/app/pomo/PauseButton.jsx | 20 +++++++++++++ app/src/components/app/pomo/PlayButton.jsx | 20 +++++++++++++ app/src/components/app/pomo/Settings.jsx | 0 .../components/app/pomo/SettingsButton.jsx | 20 +++++++++++++ app/src/components/app/pomo/Timer.jsx | 29 +++++++++++++++++++ 5 files changed, 89 insertions(+) create mode 100644 app/src/components/app/pomo/PauseButton.jsx create mode 100644 app/src/components/app/pomo/PlayButton.jsx create mode 100644 app/src/components/app/pomo/Settings.jsx create mode 100644 app/src/components/app/pomo/SettingsButton.jsx create mode 100644 app/src/components/app/pomo/Timer.jsx diff --git a/app/src/components/app/pomo/PauseButton.jsx b/app/src/components/app/pomo/PauseButton.jsx new file mode 100644 index 0000000..26f633f --- /dev/null +++ b/app/src/components/app/pomo/PauseButton.jsx @@ -0,0 +1,20 @@ +const PauseButton = (props) => { + return ( + + ); +}; + +export default PauseButton; diff --git a/app/src/components/app/pomo/PlayButton.jsx b/app/src/components/app/pomo/PlayButton.jsx new file mode 100644 index 0000000..9aec7ae --- /dev/null +++ b/app/src/components/app/pomo/PlayButton.jsx @@ -0,0 +1,20 @@ +const PlayButton = (props) => { + return ( + + ); +}; + +export default PlayButton; diff --git a/app/src/components/app/pomo/Settings.jsx b/app/src/components/app/pomo/Settings.jsx new file mode 100644 index 0000000..e69de29 diff --git a/app/src/components/app/pomo/SettingsButton.jsx b/app/src/components/app/pomo/SettingsButton.jsx new file mode 100644 index 0000000..afce286 --- /dev/null +++ b/app/src/components/app/pomo/SettingsButton.jsx @@ -0,0 +1,20 @@ +const SettingsButton = (props) => { + return ( + + ); +}; + +export default SettingsButton; diff --git a/app/src/components/app/pomo/Timer.jsx b/app/src/components/app/pomo/Timer.jsx new file mode 100644 index 0000000..d108d33 --- /dev/null +++ b/app/src/components/app/pomo/Timer.jsx @@ -0,0 +1,29 @@ +import PropTypes from 'prop-types'; +import { CircularProgressbar, buildStyles } from 'react-circular-progressbar'; +import 'react-circular-progressbar/dist/styles.css'; +import PlayButton from './PlayButton'; +import PauseButton from './PauseButton'; +import SettingsButton from './SettingsButton'; + +const Timer = ({estilo}) => { + return ( +
+ +
+ + + +
+
+ ) +} + +Timer.propTypes = { + estilo: PropTypes.object.isRequired +} + +export default Timer \ No newline at end of file From 35310ec090e160fcb53622f852acc40a56171a82 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Wed, 24 Apr 2024 22:01:06 -0300 Subject: [PATCH 007/173] Add new models for caixa, lista, pomo, and task in backend/models --- backend/models/caixaModel.js | 8 ++++++++ backend/models/listaModel.js | 21 +++++++++++++++++++ backend/models/pomoModel.js | 29 +++++++++++++++++++++++++++ backend/models/taskModel.js | 39 ++++++++++++++++++++++++++++++++++++ 4 files changed, 97 insertions(+) create mode 100644 backend/models/caixaModel.js create mode 100644 backend/models/listaModel.js create mode 100644 backend/models/pomoModel.js create mode 100644 backend/models/taskModel.js diff --git a/backend/models/caixaModel.js b/backend/models/caixaModel.js new file mode 100644 index 0000000..a5e89e1 --- /dev/null +++ b/backend/models/caixaModel.js @@ -0,0 +1,8 @@ +const mongoose = require("mongoose"); + +const caixaSchema = new mongoose.Schema({ + nome: { + type: String, + required: true, + }, +}) \ No newline at end of file diff --git a/backend/models/listaModel.js b/backend/models/listaModel.js new file mode 100644 index 0000000..9cbb861 --- /dev/null +++ b/backend/models/listaModel.js @@ -0,0 +1,21 @@ +const mongoose = require('mongoose'); + +const listaSchema = new mongoose.Schema({ + nome: { + type: String, + required: true, + }, + cor: { + type: String, + }, + emoji: { + type: String, + }, + usuario: { + type: mongoose.Schema.Types.ObjectId, + ref: "User", + required: true, + }, +}, { timestamps: true }); + +module.exports = mongoose.model("Lista", listaSchema); \ No newline at end of file diff --git a/backend/models/pomoModel.js b/backend/models/pomoModel.js new file mode 100644 index 0000000..b412dd9 --- /dev/null +++ b/backend/models/pomoModel.js @@ -0,0 +1,29 @@ +const mongoose = require('mongoose'); + +const pomoSchema = new mongoose.Schema({ + tipo: { + type: String, + required: true, + }, + inicio: { + type: Date, + default: Date.now, + }, + fim: { + type: Date, + }, + duracao: { + type: Number, + }, + task: { + type: mongoose.Schema.Types.ObjectId, + ref: "Task", + }, + usuario: { + type: mongoose.Schema.Types.ObjectId, + ref: "User", + required: true, + }, +}, { timestamps: true }); + +module.exports = mongoose.model("Pomo", pomoSchema); \ No newline at end of file diff --git a/backend/models/taskModel.js b/backend/models/taskModel.js new file mode 100644 index 0000000..7be152b --- /dev/null +++ b/backend/models/taskModel.js @@ -0,0 +1,39 @@ +const mongoose = require('mongoose'); + +const taskSchema = new mongoose.Schema({ + nome: { + type: String, + required: true, + }, + desc: { + type: String, + }, + vencimento: { + type: Date, + }, + status: { + type: String, + enum: ["A fazer", "Concluída", "Excluída"], + default: "A fazer", + }, + prioridade: { + type: Number, + default: 1, + enum: [1, 2, 3] + }, + tags: { + type: Array, + }, + usuario: { + type: mongoose.Schema.Types.ObjectId, + ref: "User", + required: true, + }, + lista: { + type: mongoose.Schema.Types.ObjectId, + ref: "Lista", + required: true, + }, +}, { timestamps: true }); + +module.exports = mongoose.model("Task", taskSchema); \ No newline at end of file From a0ba4dd559be1307c38d85dad38e590359c475e5 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Thu, 25 Apr 2024 15:44:46 -0300 Subject: [PATCH 008/173] Revert "Merge pull request #23 from CosmicTasks/mongo" This reverts commit 7b6677eb21386c80d3ccf2b79b47d9043ed31ae0, reversing changes made to 275f204fb6157b7911628ed250d1b8fd8531f66e. --- .gitignore | 4 - app/package-lock.json | 91 -- app/package.json | 1 - app/src/components/LoginPage.jsx | 43 +- backend/controllers/loginController.js | 20 - backend/controllers/userControllers.js | 79 -- backend/models/userModel.js | 22 - backend/package-lock.json | 1334 ------------------------ backend/package.json | 25 - backend/routes/login.js | 8 - backend/routes/users.js | 27 - backend/server.js | 40 - package-lock.json | 126 +++ package.json | 8 + 14 files changed, 140 insertions(+), 1688 deletions(-) delete mode 100644 backend/controllers/loginController.js delete mode 100644 backend/controllers/userControllers.js delete mode 100644 backend/models/userModel.js delete mode 100644 backend/package-lock.json delete mode 100644 backend/package.json delete mode 100644 backend/routes/login.js delete mode 100644 backend/routes/users.js delete mode 100644 backend/server.js create mode 100644 package-lock.json create mode 100644 package.json diff --git a/.gitignore b/.gitignore index c7f34ac..45b9b19 100644 --- a/.gitignore +++ b/.gitignore @@ -8,11 +8,7 @@ pnpm-debug.log* lerna-debug.log* node_modules -package.json -package-lock.json app/node_modules -backend/node_modules -backend/.env dist dist-ssr *.local diff --git a/app/package-lock.json b/app/package-lock.json index 6c4c811..486ab7c 100644 --- a/app/package-lock.json +++ b/app/package-lock.json @@ -14,7 +14,6 @@ "@fortawesome/free-solid-svg-icons": "^6.5.1", "@fortawesome/react-fontawesome": "^0.2.0", "@iconscout/react-unicons": "^2.0.2", - "axios": "^1.6.8", "bootstrap": "^5.3.3", "dompurify": "^3.1.0", "emoji-mart": "^5.5.2", @@ -1599,11 +1598,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, "node_modules/available-typed-arrays": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", @@ -1619,16 +1613,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/axios": { - "version": "1.6.8", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", - "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==", - "dependencies": { - "follow-redirects": "^1.15.6", - "form-data": "^4.0.0", - "proxy-from-env": "^1.1.0" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1777,17 +1761,6 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1927,14 +1900,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "engines": { - "node": ">=0.4.0" - } - }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -2573,25 +2538,6 @@ "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, - "node_modules/follow-redirects": { - "version": "1.15.6", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz", - "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -2601,19 +2547,6 @@ "is-callable": "^1.1.3" } }, - "node_modules/form-data": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", - "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -3471,25 +3404,6 @@ "node": ">= 18" } }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -3819,11 +3733,6 @@ "react": ">=0.14.0" } }, - "node_modules/proxy-from-env": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", - "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" - }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", diff --git a/app/package.json b/app/package.json index 74e006e..358ce6a 100644 --- a/app/package.json +++ b/app/package.json @@ -16,7 +16,6 @@ "@fortawesome/free-solid-svg-icons": "^6.5.1", "@fortawesome/react-fontawesome": "^0.2.0", "@iconscout/react-unicons": "^2.0.2", - "axios": "^1.6.8", "bootstrap": "^5.3.3", "dompurify": "^3.1.0", "emoji-mart": "^5.5.2", diff --git a/app/src/components/LoginPage.jsx b/app/src/components/LoginPage.jsx index 155c343..40a5a32 100644 --- a/app/src/components/LoginPage.jsx +++ b/app/src/components/LoginPage.jsx @@ -1,32 +1,14 @@ -import { useState } from "react"; +import React from "react"; import style from "./LoginPage.module.css"; import astronauta from "../assets/astronauta.svg"; import PropTypes from "prop-types"; import { Link } from "react-router-dom"; const LoginPage = ({ acao }) => { - const [email, setEmail] = useState(""); - const [senha, setSenha] = useState(""); - - const handleLogin = async () => { - try { - const user = { email, senha }; - const response = await fetch("http://localhost:4000/api/login", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(user), - }); - response.ok ? window.location.replace("/app") : alert("Erro ao logar"); - } catch (error) { - console.error(error); - } - }; const handleSubmit = (e) => { e.preventDefault(); - handleLogin(); + window.location.href = "/app"; }; const login = ( @@ -46,11 +28,7 @@ const LoginPage = ({ acao }) => {

Entrar

Bem-vindo de volta!

-
handleSubmit(e)} - > +
@@ -75,19 +51,16 @@ const LoginPage = ({ acao }) => { name="password" className={style.input} placeholder="Insira sua senha" - value={senha} - onChange={(e) => setSenha(e.target.value)} />
Esqueceu a senha? -

- Ainda não possui uma conta?{" "} - Cadastre-se + Ainda não possui uma conta? Cadastre-se

@@ -126,11 +99,7 @@ const LoginPage = ({ acao }) => { placeholder="Crie uma senha forte" /> -

diff --git a/backend/controllers/loginController.js b/backend/controllers/loginController.js deleted file mode 100644 index fe68416..0000000 --- a/backend/controllers/loginController.js +++ /dev/null @@ -1,20 +0,0 @@ -const User = require("../models/userModel"); -const mongoose = require("mongoose"); - -const userLogin = async (req, res) => { - try { - const { email, senha } = req.body; - const user = await User.findOne({ email: email}); - if (!user) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - if (user.senha !== senha) { - return res.status(401).json({ error: "Senha inválida" }); - } - res.status(200).json(user); - } catch (error) { - res.status(500).json({ error: error.message }); - } -} - -module.exports = { userLogin }; \ No newline at end of file diff --git a/backend/controllers/userControllers.js b/backend/controllers/userControllers.js deleted file mode 100644 index c5aa418..0000000 --- a/backend/controllers/userControllers.js +++ /dev/null @@ -1,79 +0,0 @@ -const User = require("../models/userModel"); -const mongoose = require("mongoose"); - -// GET todos os usuarios -const getUsers = async (req, res) => { - try { - const users = await User.find({}).sort({ createdAt: -1 }); - res.status(200).json(users); - } catch (error) { - res.status(500).json({ error: error.message }); - } -}; - -// GET um usuario -const getUser = async (req, res) => { - const { id } = req.params; - - if (!mongoose.Types.ObjectId.isValid(id)) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - const user = await User.findById(id); - - if (!user) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - res.status(200).json(user); -}; - -// POST um novo usuario -const createUser = async (req, res) => { - const user = req.body; - - try { - const novoUser = await User.create(user); - res.status(201).json(novoUser); - } catch (error) { - res.status(409).json({ error: error.message }); - } -}; - -// DELETE um usuario -const deleteUser = async (req, res) => { - const { id } = req.params; - - if (!mongoose.Types.ObjectId.isValid(id)) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - const user = await User.findByIdAndDelete(id); - - if (!user) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - res.status(200).json(user); -}; - -// UPDATE um usuario -const updateUser = async (req, res) => { - const { id } = req.params; - - if (!mongoose.Types.ObjectId.isValid(id)) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - const user = await User.findByIdAndUpdate(id, { - ...req.body, - }); - - if (!user) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - res.status(200).json(user); -}; - -module.exports = { getUsers, getUser, createUser, deleteUser, updateUser }; diff --git a/backend/models/userModel.js b/backend/models/userModel.js deleted file mode 100644 index dab2d82..0000000 --- a/backend/models/userModel.js +++ /dev/null @@ -1,22 +0,0 @@ -const mongoose = require("mongoose"); - -const userSchema = new mongoose.Schema({ - nome: { - type: String, - required: true, - }, - email: { - type: String, - required: true, - }, - senha: { - type: String, - required: true, - }, - configuracoes: { - type: Object, - required: true, - }, -}, { timestamps: true }); - -module.exports = mongoose.model("User", userSchema); \ No newline at end of file diff --git a/backend/package-lock.json b/backend/package-lock.json deleted file mode 100644 index 0dcbc28..0000000 --- a/backend/package-lock.json +++ /dev/null @@ -1,1334 +0,0 @@ -{ - "name": "backend", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "backend", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "cors": "^2.8.5", - "dotenv": "^16.4.5", - "express": "^4.19.2", - "mongodb": "^6.5.0", - "mongoose": "^8.3.2" - }, - "devDependencies": { - "nodemon": "^3.1.0" - } - }, - "node_modules/@mongodb-js/saslprep": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.5.tgz", - "integrity": "sha512-XLNOMH66KhJzUJNwT/qlMnS4WsNDWD5ASdyaSH3EtK+F4r/CFGa3jT4GNi4mfOitGvWXtdLgQJkQjxSVrio+jA==", - "dependencies": { - "sparse-bitfield": "^3.0.3" - } - }, - "node_modules/@types/webidl-conversions": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz", - "integrity": "sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==" - }, - "node_modules/@types/whatwg-url": { - "version": "11.0.4", - "resolved": "https://registry.npmjs.org/@types/whatwg-url/-/whatwg-url-11.0.4.tgz", - "integrity": "sha512-lXCmTWSHJvf0TRSO58nm978b8HJ/EdsSsEKLd3ODHFjo+3VGAyyTp4v50nWvwtzBxSMQrVOK7tcuN0zGPLICMw==", - "dependencies": { - "@types/webidl-conversions": "*" - } - }, - "node_modules/abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true - }, - "node_modules/accepts": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", - "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", - "dependencies": { - "mime-types": "~2.1.34", - "negotiator": "0.6.3" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/binary-extensions": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", - "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", - "dependencies": { - "bytes": "3.1.2", - "content-type": "~1.0.5", - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "on-finished": "2.4.1", - "qs": "6.11.0", - "raw-body": "2.5.2", - "type-is": "~1.6.18", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/bson": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-6.6.0.tgz", - "integrity": "sha512-BVINv2SgcMjL4oYbBuCQTpE3/VKOSxrOA8Cj/wQP7izSzlBGVomdm+TcUd0Pzy0ytLSSDweCKQ6X3f5veM5LQA==", - "engines": { - "node": ">=16.20.1" - } - }, - "node_modules/bytes": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", - "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/chokidar": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", - "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", - "dev": true, - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/content-disposition": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", - "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", - "dependencies": { - "safe-buffer": "5.2.1" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/content-type": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", - "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" - }, - "node_modules/cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "dependencies": { - "object-assign": "^4", - "vary": "^1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/depd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", - "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/destroy": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", - "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", - "engines": { - "node": ">= 0.8", - "npm": "1.2.8000 || >= 1.4.16" - } - }, - "node_modules/dotenv": { - "version": "16.4.5", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", - "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, - "node_modules/ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" - }, - "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/es-errors": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", - "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" - }, - "node_modules/etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", - "dependencies": { - "accepts": "~1.3.8", - "array-flatten": "1.1.1", - "body-parser": "1.20.2", - "content-disposition": "0.5.4", - "content-type": "~1.0.4", - "cookie": "0.6.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "2.0.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "1.2.0", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.7", - "qs": "6.11.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "engines": { - "node": ">= 0.10.0" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", - "dependencies": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "2.4.1", - "parseurl": "~1.3.3", - "statuses": "2.0.1", - "unpipe": "~1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/forwarded": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", - "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", - "dependencies": { - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "^1.1.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hasown": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", - "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", - "dependencies": { - "function-bind": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/http-errors": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", - "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", - "dependencies": { - "depd": "2.0.0", - "inherits": "2.0.4", - "setprototypeof": "1.2.0", - "statuses": "2.0.1", - "toidentifier": "1.0.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/ignore-by-default": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz", - "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==", - "dev": true - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/ipaddr.js": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", - "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/kareem": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/kareem/-/kareem-2.6.3.tgz", - "integrity": "sha512-C3iHfuGUXK2u8/ipq9LfjFfXFxAZMQJJq7vLS45r3D9Y2xQ/m4S8zaR4zMLFWh9AsNPXmcFfUDhTEO8UIC/V6Q==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/memory-pager": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", - "integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==" - }, - "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" - }, - "node_modules/methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", - "bin": { - "mime": "cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dependencies": { - "mime-db": "1.52.0" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/mongodb": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-6.5.0.tgz", - "integrity": "sha512-Fozq68InT+JKABGLqctgtb8P56pRrJFkbhW0ux+x1mdHeyinor8oNzJqwLjV/t5X5nJGfTlluxfyMnOXNggIUA==", - "dependencies": { - "@mongodb-js/saslprep": "^1.1.5", - "bson": "^6.4.0", - "mongodb-connection-string-url": "^3.0.0" - }, - "engines": { - "node": ">=16.20.1" - }, - "peerDependencies": { - "@aws-sdk/credential-providers": "^3.188.0", - "@mongodb-js/zstd": "^1.1.0", - "gcp-metadata": "^5.2.0", - "kerberos": "^2.0.1", - "mongodb-client-encryption": ">=6.0.0 <7", - "snappy": "^7.2.2", - "socks": "^2.7.1" - }, - "peerDependenciesMeta": { - "@aws-sdk/credential-providers": { - "optional": true - }, - "@mongodb-js/zstd": { - "optional": true - }, - "gcp-metadata": { - "optional": true - }, - "kerberos": { - "optional": true - }, - "mongodb-client-encryption": { - "optional": true - }, - "snappy": { - "optional": true - }, - "socks": { - "optional": true - } - } - }, - "node_modules/mongodb-connection-string-url": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-3.0.0.tgz", - "integrity": "sha512-t1Vf+m1I5hC2M5RJx/7AtxgABy1cZmIPQRMXw+gEIPn/cZNF3Oiy+l0UIypUwVB5trcWHq3crg2g3uAR9aAwsQ==", - "dependencies": { - "@types/whatwg-url": "^11.0.2", - "whatwg-url": "^13.0.0" - } - }, - "node_modules/mongoose": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/mongoose/-/mongoose-8.3.2.tgz", - "integrity": "sha512-3JcpDjFI25cF/3xpu+4+9nM0lURQTNLcP86X83+LvuICdn453QQLmhSrUr2IPM/ffLiDE9KPl9slNb2s0hZPpg==", - "dependencies": { - "bson": "^6.5.0", - "kareem": "2.6.3", - "mongodb": "6.5.0", - "mpath": "0.9.0", - "mquery": "5.0.0", - "ms": "2.1.3", - "sift": "16.0.1" - }, - "engines": { - "node": ">=16.20.1" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mongoose" - } - }, - "node_modules/mongoose/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/mpath": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/mpath/-/mpath-0.9.0.tgz", - "integrity": "sha512-ikJRQTk8hw5DEoFVxHG1Gn9T/xcjtdnOKIU1JTmGjZZlg9LST2mBLmcX3/ICIbgJydT2GOc15RnNy5mHmzfSew==", - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/mquery": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/mquery/-/mquery-5.0.0.tgz", - "integrity": "sha512-iQMncpmEK8R8ncT8HJGsGc9Dsp8xcgYMVSbs5jgnm1lFHTZqMJTUWTDx1LBO8+mK3tPNZWFLBghQEIOULSTHZg==", - "dependencies": { - "debug": "4.x" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/mquery/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/mquery/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/negotiator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", - "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/nodemon": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.0.tgz", - "integrity": "sha512-xqlktYlDMCepBJd43ZQhjWwMw2obW/JRvkrLxq5RCNcuDDX1DbcPT+qT1IlIIdf+DhnWs90JpTMe+Y5KxOchvA==", - "dev": true, - "dependencies": { - "chokidar": "^3.5.2", - "debug": "^4", - "ignore-by-default": "^1.0.1", - "minimatch": "^3.1.2", - "pstree.remy": "^1.1.8", - "semver": "^7.5.3", - "simple-update-notifier": "^2.0.0", - "supports-color": "^5.5.0", - "touch": "^3.1.0", - "undefsafe": "^2.0.5" - }, - "bin": { - "nodemon": "bin/nodemon.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/nodemon" - } - }, - "node_modules/nodemon/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/nodemon/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/nopt": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", - "integrity": "sha512-NWmpvLSqUrgrAC9HCuxEvb+PSloHpqVu+FqcO4eeF2h5qYRhA7ev6KvelyQAKtegUbC6RypJnlEOhd8vloNKYg==", - "dev": true, - "dependencies": { - "abbrev": "1" - }, - "bin": { - "nopt": "bin/nopt.js" - }, - "engines": { - "node": "*" - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/on-finished": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", - "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", - "dependencies": { - "ee-first": "1.1.1" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/proxy-addr": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", - "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", - "dependencies": { - "forwarded": "0.2.0", - "ipaddr.js": "1.9.1" - }, - "engines": { - "node": ">= 0.10" - } - }, - "node_modules/pstree.remy": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz", - "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==", - "dev": true - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "engines": { - "node": ">=6" - } - }, - "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", - "dependencies": { - "side-channel": "^1.0.4" - }, - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/raw-body": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz", - "integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==", - "dependencies": { - "bytes": "3.1.2", - "http-errors": "2.0.0", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - }, - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", - "dependencies": { - "debug": "2.6.9", - "depd": "2.0.0", - "destroy": "1.2.0", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "2.0.0", - "mime": "1.6.0", - "ms": "2.1.3", - "on-finished": "2.4.1", - "range-parser": "~1.2.1", - "statuses": "2.0.1" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/send/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, - "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", - "dependencies": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.18.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/setprototypeof": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", - "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" - }, - "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", - "dependencies": { - "call-bind": "^1.0.7", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/sift": { - "version": "16.0.1", - "resolved": "https://registry.npmjs.org/sift/-/sift-16.0.1.tgz", - "integrity": "sha512-Wv6BjQ5zbhW7VFefWusVP33T/EM0vYikCaQ2qR8yULbsilAT8/wQaXvuQ3ptGLpoKx+lihJE3y2UTgKDyyNHZQ==" - }, - "node_modules/simple-update-notifier": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz", - "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==", - "dev": true, - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/sparse-bitfield": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz", - "integrity": "sha512-kvzhi7vqKTfkh0PZU+2D2PIllw2ymqJKujUcyPMd9Y75Nv4nPbGJZXNhxsgdQab2BmlDct1YnfQCguEvHr7VsQ==", - "dependencies": { - "memory-pager": "^1.0.2" - } - }, - "node_modules/statuses": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", - "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/toidentifier": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", - "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", - "engines": { - "node": ">=0.6" - } - }, - "node_modules/touch": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.0.tgz", - "integrity": "sha512-WBx8Uy5TLtOSRtIq+M03/sKDrXCLHxwDcquSP2c43Le03/9serjQBIztjRz6FkJez9D/hleyAXTBGLwwZUw9lA==", - "dev": true, - "dependencies": { - "nopt": "~1.0.10" - }, - "bin": { - "nodetouch": "bin/nodetouch.js" - } - }, - "node_modules/tr46": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-4.1.1.tgz", - "integrity": "sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==", - "dependencies": { - "punycode": "^2.3.0" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "dependencies": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - }, - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/undefsafe": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz", - "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==", - "dev": true - }, - "node_modules/unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", - "engines": { - "node": ">= 0.8" - } - }, - "node_modules/webidl-conversions": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", - "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", - "engines": { - "node": ">=12" - } - }, - "node_modules/whatwg-url": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-13.0.0.tgz", - "integrity": "sha512-9WWbymnqj57+XEuqADHrCJ2eSXzn8WXIW/YSGaZtb2WKAInQ6CHfaUUcTyyver0p8BDg5StLQq8h1vtZuwmOig==", - "dependencies": { - "tr46": "^4.1.1", - "webidl-conversions": "^7.0.0" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - } - } -} diff --git a/backend/package.json b/backend/package.json deleted file mode 100644 index 10fe54f..0000000 --- a/backend/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "proxy": "http://localhost:4000", - "name": "backend", - "version": "1.0.0", - "description": "", - "main": "server.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "start": "node server.js", - "dev": "nodemon server.js" - }, - "keywords": [], - "author": "", - "license": "ISC", - "dependencies": { - "cors": "^2.8.5", - "dotenv": "^16.4.5", - "express": "^4.19.2", - "mongodb": "^6.5.0", - "mongoose": "^8.3.2" - }, - "devDependencies": { - "nodemon": "^3.1.0" - } -} diff --git a/backend/routes/login.js b/backend/routes/login.js deleted file mode 100644 index 917ab3e..0000000 --- a/backend/routes/login.js +++ /dev/null @@ -1,8 +0,0 @@ -const express = require("express"); -const { userLogin } = require("../controllers/loginController"); - -const router = express.Router(); - -router.post("/", userLogin); - -module.exports = router; \ No newline at end of file diff --git a/backend/routes/users.js b/backend/routes/users.js deleted file mode 100644 index 00bc7a0..0000000 --- a/backend/routes/users.js +++ /dev/null @@ -1,27 +0,0 @@ -const express = require("express"); -const { - getUsers, - getUser, - createUser, - deleteUser, - updateUser, -} = require("../controllers/userControllers"); - -const router = express.Router(); - -// GET todos os usuarios -router.get("/", getUsers); - -// GET um usuario -router.get("/:id", getUser); - -// POST um novo usuario -router.post("/", createUser); - -// DELETE um usuario -router.delete("/:id", deleteUser); - -// UPDATE um usuario -router.patch("/:id", updateUser); - -module.exports = router; diff --git a/backend/server.js b/backend/server.js deleted file mode 100644 index 844a038..0000000 --- a/backend/server.js +++ /dev/null @@ -1,40 +0,0 @@ -require("dotenv").config(); -const uri = "mongodb+srv://cosmicdb:cosmicpassword@cosmicserver.xz0bish.mongodb.net/?retryWrites=true&w=majority&appName=CosmicServer"; -const port = 4000; - -// Inicializar app express -const express = require("express"); -const mongoose = require("mongoose"); -const usersRoutes = require("./routes/users"); -const loginRoutes = require("./routes/login"); -const cors = require("cors"); - -// Criar app express -const app = express(); -app.use(cors({ - origin: "http://localhost:5173", -})); - -// Middleware -app.use(express.json()); -app.use((req, res, next) => { - console.log(req.path, req.method); - next(); -}); - -// rotas -app.use("/api/users", usersRoutes); -app.use("/api/login", loginRoutes); - -// connect to db -mongoose - .connect(uri, { dbName: "cosmic" }) - .then(() => { - // Ouvir requisições - app.listen(port, () => { - console.log(`ouvindo na porta ${port}!`); - }); - }) - .catch((error) => { - console.log(error); - }); diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..3d377ce --- /dev/null +++ b/package-lock.json @@ -0,0 +1,126 @@ +{ + "name": "dev", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "react-router-dom": "^6.22.3" + }, + "devDependencies": { + "@iconify/react": "^4.1.1" + } + }, + "node_modules/@iconify/react": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@iconify/react/-/react-4.1.1.tgz", + "integrity": "sha512-jed14EjvKjee8mc0eoscGxlg7mSQRkwQG3iX3cPBCO7UlOjz0DtlvTqxqEcHUJGh+z1VJ31Yhu5B9PxfO0zbdg==", + "dev": true, + "dependencies": { + "@iconify/types": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/cyberalien" + }, + "peerDependencies": { + "react": ">=16" + } + }, + "node_modules/@iconify/types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", + "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", + "dev": true + }, + "node_modules/@remix-run/router": { + "version": "1.15.3", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.15.3.tgz", + "integrity": "sha512-Oy8rmScVrVxWZVOpEF57ovlnhpZ8CCPlnIIumVcV9nFdiSIrus99+Lw78ekXyGvVDlIsFJbSfmSovJUhCWYV3w==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "peer": true + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "peer": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/react": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", + "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", + "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.0" + }, + "peerDependencies": { + "react": "^18.2.0" + } + }, + "node_modules/react-router": { + "version": "6.22.3", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.22.3.tgz", + "integrity": "sha512-dr2eb3Mj5zK2YISHK++foM9w4eBnO23eKnZEDs7c880P6oKbrjz/Svg9+nxqtHQK+oMW4OtjZca0RqPglXxguQ==", + "dependencies": { + "@remix-run/router": "1.15.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.22.3", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.22.3.tgz", + "integrity": "sha512-7ZILI7HjcE+p31oQvwbokjk6OA/bnFxrhJ19n82Ex9Ph8fNAq+Hm/7KchpMGlTgWhUxRHMMCut+vEtNpWpowKw==", + "dependencies": { + "@remix-run/router": "1.15.3", + "react-router": "6.22.3" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, + "node_modules/scheduler": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", + "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", + "peer": true, + "dependencies": { + "loose-envify": "^1.1.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..deb60d7 --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "dependencies": { + "react-router-dom": "^6.22.3" + }, + "devDependencies": { + "@iconify/react": "^4.1.1" + } +} From c7493e74d6d83e1fa66ad094ff8fa0c27c5c2061 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:22:10 -0300 Subject: [PATCH 009/173] Update main.jsx to include context providers for UserContext and ListaContext --- app/src/main.jsx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/app/src/main.jsx b/app/src/main.jsx index 2fd792f..3590510 100644 --- a/app/src/main.jsx +++ b/app/src/main.jsx @@ -27,6 +27,10 @@ import PageTasks from "./components/app/PageTasks.jsx"; import PageCards from "./components/app/PageCards.jsx"; import Markdown from "./components/app/markdown/Markdown.jsx"; +// Contextos +import { UserContextProvider } from "./context/UserContext.jsx"; +import { ListaContextProvider } from "./context/ListaContext.jsx"; + const router = createBrowserRouter([ { path: "/", @@ -35,7 +39,11 @@ const router = createBrowserRouter([ }, { path: "app", - element: , + element: ( + + + + ), children: [ { index: true, @@ -47,13 +55,13 @@ const router = createBrowserRouter([ }, { path: "cards", - element: + element: , }, { path: "notes", element: , - } - ] + }, + ], }, { path: "login", @@ -63,12 +71,12 @@ const router = createBrowserRouter([ path: "cadastro", element: , }, - - ]); ReactDOM.createRoot(document.getElementById("root")).render( - + + + ); From a19de3a1b7b327f41b1f84cf3e4e243503b95582 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:22:21 -0300 Subject: [PATCH 010/173] Add useEffect hook to fetch user and listas data in App.jsx --- app/src/components/App.jsx | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/app/src/components/App.jsx b/app/src/components/App.jsx index efa29d8..eaa1b1c 100644 --- a/app/src/components/App.jsx +++ b/app/src/components/App.jsx @@ -1,9 +1,41 @@ import Sidebar from "./app/Sidebar"; import style from "./App.module.css"; import { Outlet } from "react-router-dom"; -import { useState } from "react"; +import { useEffect } from "react"; +import { useListaContext } from "../hooks/useListaContext"; +import { useUserContext } from "../hooks/useUserContext"; function App() { + const { dispatch: listaDispatch } = useListaContext(); + const { dispatch: userDispatch } = useUserContext(); + + useEffect(() => { + const userJSON = JSON.parse(localStorage.getItem("user")); + console.log(userJSON); + const fetchUser = async () => { + if (userJSON) { + userDispatch({ type: "SET_USER", payload: userJSON }); + } + } + + const fetchListas = async () => { + const response = await fetch(`http://localhost:4000/api/listas/${userJSON._id}`, { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + }); + const data = await response.json(); + console.log(data); + if (response.ok) { + listaDispatch({ type: "SET_LISTAS", payload: data }); + } + } + + fetchUser(); + fetchListas(); + }, []) + return (

From 29d8419b93f18b90e063ef37c911897b1806ad95 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:22:28 -0300 Subject: [PATCH 011/173] Update LoginPage component to handle user login and registration --- app/src/components/LoginPage.jsx | 129 ++++++++++++++++++++++++++----- 1 file changed, 108 insertions(+), 21 deletions(-) diff --git a/app/src/components/LoginPage.jsx b/app/src/components/LoginPage.jsx index 155c343..46b42f2 100644 --- a/app/src/components/LoginPage.jsx +++ b/app/src/components/LoginPage.jsx @@ -5,28 +5,93 @@ import PropTypes from "prop-types"; import { Link } from "react-router-dom"; const LoginPage = ({ acao }) => { + const [nome, setNome] = useState(""); const [email, setEmail] = useState(""); const [senha, setSenha] = useState(""); + const [erro, setErro] = useState(""); + const [disabled, setDisabled] = useState(style.disabled); + + const handleChange = (e) => { + if (acao === "login") { + if (e.target.validity.valid && senha.length >= 8) { + setDisabled(""); + } else { + setDisabled(style.disabled); + } + } + if (acao === "cadastro") { + if (e.target.validity.valid && senha.length >= 8 && nome.length > 0) { + setDisabled(""); + } else { + setDisabled(style.disabled); + } + } + }; const handleLogin = async () => { + setErro(""); try { - const user = { email, senha }; + const info = { email, senha }; const response = await fetch("http://localhost:4000/api/login", { method: "POST", headers: { "Content-Type": "application/json", }, - body: JSON.stringify(user), + body: JSON.stringify(info), }); - response.ok ? window.location.replace("/app") : alert("Erro ao logar"); + const data = await response.json(); + if (response.ok) { + const user = JSON.stringify(data); + localStorage.setItem("user", user); + window.location.replace("/app"); + } else { + setErro(response.error); + } } catch (error) { console.error(error); + alert("Erro ao fazer login."); + } + }; + + const handleCadastro = async () => { + setErro(false); + try { + const info = { + nome, + email, + senha, + configuracoes: { permiteEmail: true }, + }; + const response = await fetch("http://localhost:4000/api/cadastro", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(info), + }); + const data = await response.json(); + if (response.ok) { + const user = JSON.stringify(data); + alert(user); + localStorage.setItem("user", user); + window.location.replace("/app"); + } else { + setErro(data.error || response.statusText || response.status.toString); + } + } catch (error) { + console.error(error); + alert("Erro ao cadastrar usuário."); } }; const handleSubmit = (e) => { e.preventDefault(); - handleLogin(); + if (acao === "login") { + handleLogin(); + } + if (acao === "cadastro") { + handleCadastro(); + } }; const login = ( @@ -46,11 +111,7 @@ const LoginPage = ({ acao }) => {

Entrar

Bem-vindo de volta!

-
handleSubmit(e)} - > + handleSubmit(e)}>
@@ -76,13 +140,18 @@ const LoginPage = ({ acao }) => { className={style.input} placeholder="Insira sua senha" value={senha} - onChange={(e) => setSenha(e.target.value)} + onChange={(e) => { + setSenha(e.target.value); + }} + minLength="8" />
- - Esqueceu a senha? - -

@@ -101,7 +170,21 @@ const LoginPage = ({ acao }) => {

Cadastrar

Comece sua jornada!

- + handleSubmit(e)}> +
+ + setNome(e.target.value)} + minLength="1" + /> +
@@ -124,13 +208,16 @@ const LoginPage = ({ acao }) => { name="password" className={style.input} placeholder="Crie uma senha forte" + onChange={(e) => setSenha(e.target.value)} + minLength="8" />
-

From 62990dbc466b6dcf894685658b42ec43ad9634be Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:22:38 -0300 Subject: [PATCH 012/173] Update LoginPage component styles to include error message and forgot password link --- app/src/components/LoginPage.module.css | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/components/LoginPage.module.css b/app/src/components/LoginPage.module.css index 95f4e04..92e6515 100644 --- a/app/src/components/LoginPage.module.css +++ b/app/src/components/LoginPage.module.css @@ -93,6 +93,16 @@ } } +.error { + color: var(--vermelho); + font-family: Raleway; + font-size: 12px; + font-style: normal; + font-weight: 400; + width: fit-content; + margin: 0; +} + .forgotPassword { color: var(--r7); font-family: Raleway; @@ -109,6 +119,8 @@ font-style: normal; font-weight: 400; border-radius: 8px; + background: var(--r7); + color: var(--c1); &.disabled { background: var(--c7); From 6830d5d41ca4649a3fe063fa70c6ea61e8620a9d Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:22:47 -0300 Subject: [PATCH 013/173] Refactor Listas component to use custom hook useListas in Listas.jsx --- app/src/components/app/Listas.jsx | 77 ------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 app/src/components/app/Listas.jsx diff --git a/app/src/components/app/Listas.jsx b/app/src/components/app/Listas.jsx deleted file mode 100644 index 5efd538..0000000 --- a/app/src/components/app/Listas.jsx +++ /dev/null @@ -1,77 +0,0 @@ -import { useState } from 'react' - -export default function useListas() { - const [listas, setListas] = useState([ - { - id: 1, - nome: "Francês", - emoji: "croissant", - cor: null, - tarefas: [ - { - id: 1, - nome: "Estudar francês", - data: "26/03", - concluido: false, - }, - { - id: 2, - nome: "Praticar francês", - data: "26/03", - concluido: false, - }, - ], - }, - { - id: 2, - nome: "Inglês", - emoji: null, - cor: "var(--azul-royal)", - tarefas: [ - { - id: 1, - nome: "Estudar inglês", - data: "26/03", - concluido: false, - }, - { - id: 2, - nome: "Praticar inglês", - data: "26/03", - concluido: false, - }, - ], - }, - ]); - - const addLista = (nome, decoracao, modo) => { - let novaLista = []; - if (modo === "emoji") { - novaLista = [ - ...listas, - { - id: listas.length + 1, - nome: nome, - emoji: decoracao, - cor: null, - tarefas: [], - }, - ]; - } else { - novaLista = [ - ...listas, - { - id: listas.length + 1, - nome: nome, - emoji: null, - cor: decoracao, - tarefas: [], - }, - ]; - } - - setListas(novaLista); - }; - - return { listas, setListas, addLista }; -} \ No newline at end of file From 5359fffae282d6abaa1e33de1cdb5033d55625a8 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:23:01 -0300 Subject: [PATCH 014/173] Update PageTasks component to fetch and display users data --- app/src/components/app/PageTasks.jsx | 36 +++++++++++++--------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/app/src/components/app/PageTasks.jsx b/app/src/components/app/PageTasks.jsx index 3ccf854..fbd4152 100644 --- a/app/src/components/app/PageTasks.jsx +++ b/app/src/components/app/PageTasks.jsx @@ -1,4 +1,4 @@ -import React, { useState } from "react"; +import { useState, useEffect } from "react"; import SecSidebar from "./SecSidebar"; import style from "./PageTasks.module.css"; import { @@ -9,11 +9,21 @@ import { UilAngleDown, UilCircle, } from "@iconscout/react-unicons"; -import useListas from "./Listas"; +import useListas from "./listas/Listas"; const PageTasks = () => { const [sidebar, setSidebar] = useState(true); const { listas, setListas, addLista } = useListas(); + const [users, setUsers] = useState(null); + + useEffect(() => { + const fetchUsers = async () => { + const response = await fetch("http://localhost:4000/api/users"); + const data = await response.json(); + setUsers(data) + } + fetchUsers(); + }, []); return ( <> @@ -41,24 +51,10 @@ const PageTasks = () => { - {listas.map((lista) => ( -

-
- - {lista.nome} -
- {lista.tarefas.map((tarefa) => ( -
-
- - {tarefa.nome} -
-
- {lista.nome} - {tarefa.data} -
-
- ))} + {users && users.map((user) => ( +
+ + {user.nome}
))}
From 23d024ec7a3064f471f1b2bea6a525b40ed55f6a Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:23:21 -0300 Subject: [PATCH 015/173] Update SecSidebar component to include useContext and PropTypes in SecSidebar.jsx --- app/src/components/app/SecSidebar.jsx | 31 ++++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/src/components/app/SecSidebar.jsx b/app/src/components/app/SecSidebar.jsx index 3146f91..833fe10 100644 --- a/app/src/components/app/SecSidebar.jsx +++ b/app/src/components/app/SecSidebar.jsx @@ -1,4 +1,5 @@ -import { useState } from "react"; +import { useState, useContext } from "react"; +import PropTypes from "prop-types"; import style from "./SecSidebar.module.css"; import { UilPlus, @@ -14,12 +15,16 @@ import { UilSquareShape, } from "@iconscout/react-unicons"; import ModalNewList from "./modal/ModalNewList"; +import BtnListas from "./listas/BtnListas"; import data from "@emoji-mart/data"; import { init } from "emoji-mart"; init({ data }); +import { useListaContext } from "../../hooks/useListaContext"; + +const SecSidebar = ({isOpen, addLista}) => { + + const { listas } = useListaContext(); -const SecSidebar = ({isOpen, listas, addLista}) => { - const [showModal, setShowModal] = useState(false); const handleAddLista = () => { @@ -58,18 +63,8 @@ const SecSidebar = ({isOpen, listas, addLista}) => { - {listas.map((lista, id) => ( - + {listas && listas.map((lista) => ( + ))} @@ -110,4 +105,10 @@ const SecSidebar = ({isOpen, listas, addLista}) => { ); }; +SecSidebar.propTypes = { + isOpen: PropTypes.bool.isRequired, + listas: PropTypes.array.isRequired, + addLista: PropTypes.func.isRequired, +}; + export default SecSidebar; From 2225d00114307c2d4497deed47ebd620b5754f93 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:23:30 -0300 Subject: [PATCH 016/173] Add BtnListas component to handle list buttons in app/src/components/app/listas/BtnListas.jsx --- app/src/components/app/listas/BtnListas.jsx | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 app/src/components/app/listas/BtnListas.jsx diff --git a/app/src/components/app/listas/BtnListas.jsx b/app/src/components/app/listas/BtnListas.jsx new file mode 100644 index 0000000..4ea7631 --- /dev/null +++ b/app/src/components/app/listas/BtnListas.jsx @@ -0,0 +1,22 @@ +import PropTypes from "prop-types"; +import { UilSquareShape } from "@iconscout/react-unicons"; + +const BtnListas = ({lista, style}) => { + return ( + + ); +}; + +BtnListas.propTypes = { + lista: PropTypes.object.isRequired, + style: PropTypes.object.isRequired, +}; + +export default BtnListas; From 382b5eaeff2691762961c739796903869bb375de Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:23:36 -0300 Subject: [PATCH 017/173] Refactor Listas component to use custom hook useListas in Listas.jsx --- app/src/components/app/listas/Listas.jsx | 44 ++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 app/src/components/app/listas/Listas.jsx diff --git a/app/src/components/app/listas/Listas.jsx b/app/src/components/app/listas/Listas.jsx new file mode 100644 index 0000000..7e0393c --- /dev/null +++ b/app/src/components/app/listas/Listas.jsx @@ -0,0 +1,44 @@ +import { useState, useEffect } from 'react' + +export default function useListas() { + const [listas, setListas] = useState(null); + + + const addLista = async (nome, decoracao, modo) => { + let novaLista = []; + if (modo === "emoji") { + fetch("http://localhost:4000/api/listas", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + nome: nome, + cor: null, + emoji: decoracao, + usuario: "662ab383d58317b3c6c7f81b" + }), + }).then((response) => response.json()).then((json) => { + novaLista = [...listas, json]; + }); + } else { + fetch("http://localhost:4000/api/listas", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + nome: nome, + cor: decoracao, + emoji: null, + usuario: "662ab383d58317b3c6c7f81b" + }), + }).then((response) => response.json()).then((json) => { + novaLista = [...listas, json]; + }); + } + setListas(novaLista); + }; + + return { listas, setListas, addLista }; +} \ No newline at end of file From d7dbee308d31ecf71d1526974b7f7bc90a0fb815 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:23:44 -0300 Subject: [PATCH 018/173] Refactor ModalNewList component to use custom hook useListaContext in ModalNewList.jsx --- app/src/components/app/modal/ModalNewList.jsx | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/app/src/components/app/modal/ModalNewList.jsx b/app/src/components/app/modal/ModalNewList.jsx index a6c2783..2fc34a7 100644 --- a/app/src/components/app/modal/ModalNewList.jsx +++ b/app/src/components/app/modal/ModalNewList.jsx @@ -1,10 +1,12 @@ -import React, { useState } from "react"; +import { useState, useEffect } from "react"; import style from "./ModalNewList.module.css"; import { UilSquareShape } from "@iconscout/react-unicons"; import data from "@emoji-mart/data"; import Picker from "@emoji-mart/react"; +import { useListaContext } from "../../../hooks/useListaContext"; -const ModalNewList = ({addLista, setShowModal}) => { +const ModalNewList = ({setShowModal}) => { + const { listas, dispatch } = useListaContext(); const [tabEmoji, setTabEmoji] = useState(false); const [emoji, setEmoji] = useState("smiley"); const [cor, setCor] = useState("var(--azul-royal)"); @@ -35,13 +37,49 @@ const ModalNewList = ({addLista, setShowModal}) => { ], ]; + const addLista = async (nome, decoracao, modo) => { + if (modo === "emoji") { + const response = await fetch("http://localhost:4000/api/listas", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + nome: nome, + cor: null, + emoji: decoracao, + usuario: "662ab383d58317b3c6c7f81b" + }), + }); + const data = await response.json(); + if (response.ok) { + dispatch({ type: "CREATE_LISTA", payload: data }); + } + } else { + const response = await fetch("http://localhost:4000/api/listas", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + nome: nome, + cor: decoracao, + emoji: null, + usuario: "662ab383d58317b3c6c7f81b" + }), + }); + const data = await response.json(); + if (response.ok) { + dispatch({ type: "CREATE_LISTA", payload: data }); + } + } + } + const handleSubmit = (e) => { e.preventDefault(); if (nomeLista === "") return; - const currentModo = tabEmoji ? "emoji" : "cor"; const currentDecoracao = currentModo === 'cor' ? cor : emoji; - addLista(nomeLista, currentDecoracao, currentModo); setNomeLista(""); setCor("var(--azul-royal)"); From 835a6b355cd27805191db821afd18fd8b2dd0d7e Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:24:08 -0300 Subject: [PATCH 019/173] Add ListaContext and listaReducer to handle list data in app/src/context/ListaContext.jsx --- app/src/context/ListaContext.jsx | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 app/src/context/ListaContext.jsx diff --git a/app/src/context/ListaContext.jsx b/app/src/context/ListaContext.jsx new file mode 100644 index 0000000..c2e13f3 --- /dev/null +++ b/app/src/context/ListaContext.jsx @@ -0,0 +1,35 @@ +import { createContext, useReducer } from "react"; + +export const ListaContext = createContext(); + +export const listaReducer = (state, action) => { + switch (action.type) { + case "SET_LISTAS": + return { + listas: action.payload + }; + case "CREATE_LISTA": + return { + listas: [action.payload, ...state.listas] + }; + case "REMOVE_LISTA": + return { + ...state, + listas: state.listas.filter((lista) => lista._id !== action.payload) + }; + default: + return state; + } +}; + +export const ListaContextProvider = ({ children }) => { + const [state, dispatch] = useReducer(listaReducer, { + listas: null + }); + + return ( + + { children } + + ) +} \ No newline at end of file From bbbeda5fb4736f80ec04fe84db19f231951955f1 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:24:14 -0300 Subject: [PATCH 020/173] Add UserContext and userReducer to handle user data in app/src/context/UserContext.jsx --- app/src/context/UserContext.jsx | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 app/src/context/UserContext.jsx diff --git a/app/src/context/UserContext.jsx b/app/src/context/UserContext.jsx new file mode 100644 index 0000000..a33ca72 --- /dev/null +++ b/app/src/context/UserContext.jsx @@ -0,0 +1,30 @@ +import { createContext, useReducer } from "react"; + +export const UserContext = createContext(); + +export const userReducer = (state, action) => { + switch (action.type) { + case "SET_USER": + return { + user: action.payload + }; + case "REMOVE_USER": + return { + user: null + }; + default: + return state; + } +} + +export const UserContextProvider = ({ children }) => { + const [state, dispatch] = useReducer(userReducer, { + user: null + }); + + return ( + + { children } + + ) +} \ No newline at end of file From 9e76d6160b1b4733b2b1475288c778a3950633e6 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:24:47 -0300 Subject: [PATCH 021/173] Add useListaContext custom hook to handle list context in app/src/hooks/useListaContext.jsx --- app/src/hooks/useListaContext.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/src/hooks/useListaContext.jsx diff --git a/app/src/hooks/useListaContext.jsx b/app/src/hooks/useListaContext.jsx new file mode 100644 index 0000000..f54dbf0 --- /dev/null +++ b/app/src/hooks/useListaContext.jsx @@ -0,0 +1,12 @@ +import { ListaContext } from "../context/ListaContext"; +import { useContext } from "react"; + +export const useListaContext = () => { + const context = useContext(ListaContext); + if (!context) { + throw new Error( + "useListaContext must be used within a ListaContextProvider" + ); + } + return context; +}; From 1b6f91314fc83fefcb4a9350b253d1ab3e44fb37 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:24:54 -0300 Subject: [PATCH 022/173] Add useUserContext custom hook to handle user context in app/src/hooks/useUserContext.jsx --- app/src/hooks/useUserContext.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/src/hooks/useUserContext.jsx diff --git a/app/src/hooks/useUserContext.jsx b/app/src/hooks/useUserContext.jsx new file mode 100644 index 0000000..04c7576 --- /dev/null +++ b/app/src/hooks/useUserContext.jsx @@ -0,0 +1,12 @@ +import { UserContext } from "../context/UserContext"; +import { useContext } from "react"; + +export const useUserContext = () => { + const context = useContext(UserContext); + if (!context) { + throw new Error( + "useUserContext must be used within a UserContextProvider" + ); + } + return context; +} \ No newline at end of file From 83cfc7044541895a0f5bc321538c0d7c799f26ce Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:00 -0300 Subject: [PATCH 023/173] Refactor server.js to add new routes and update MongoDB connection URI --- backend/server.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/backend/server.js b/backend/server.js index 844a038..545b7e5 100644 --- a/backend/server.js +++ b/backend/server.js @@ -1,12 +1,10 @@ require("dotenv").config(); -const uri = "mongodb+srv://cosmicdb:cosmicpassword@cosmicserver.xz0bish.mongodb.net/?retryWrites=true&w=majority&appName=CosmicServer"; +const uri = "mongodb://localhost:27017"; const port = 4000; // Inicializar app express const express = require("express"); const mongoose = require("mongoose"); -const usersRoutes = require("./routes/users"); -const loginRoutes = require("./routes/login"); const cors = require("cors"); // Criar app express @@ -23,8 +21,15 @@ app.use((req, res, next) => { }); // rotas +const usersRoutes = require("./routes/users"); +const loginRoutes = require("./routes/login"); +const cadastroRoutes = require("./routes/cadastro"); +const listasRoutes = require("./routes/listas"); + app.use("/api/users", usersRoutes); app.use("/api/login", loginRoutes); +app.use("/api/cadastro", cadastroRoutes); +app.use("/api/listas", listasRoutes); // connect to db mongoose From 46b68c92771b3bf70c7af2a31ec1db5eaf7b7748 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:07 -0300 Subject: [PATCH 024/173] Add cadastrarUsuario function to handle user registration in backend/controllers/cadastroController.js --- backend/controllers/cadastroController.js | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 backend/controllers/cadastroController.js diff --git a/backend/controllers/cadastroController.js b/backend/controllers/cadastroController.js new file mode 100644 index 0000000..dd07382 --- /dev/null +++ b/backend/controllers/cadastroController.js @@ -0,0 +1,26 @@ +const User = require("../models/userModel"); +const mongoose = require("mongoose"); + +const cadastrarUsuario = async (req, res) => { + const user = req.body; + + if (!user.email || !user.senha || !user.nome) { + return res.status(400).json({ error: "Dados inválidos" }); + } + + try { + const findUser = await User.findOne({ email: user.email }); + if (findUser) { + return res.status(409).json({ error: "Email já cadastrado" }); + } else { + const novoUser = await User.create(user); + res.status(201).json(novoUser); + } + } catch (error) { + res.status(409).json({ error: error.message }); + } +} + +module.exports = { + cadastrarUsuario, +}; \ No newline at end of file From 3d0a3b2ea7fb2c91c9bf5d854fa34a9de06dcb57 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:13 -0300 Subject: [PATCH 025/173] Add listaController.js to handle list operations in backend/controllers --- backend/controllers/listaController.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 backend/controllers/listaController.js diff --git a/backend/controllers/listaController.js b/backend/controllers/listaController.js new file mode 100644 index 0000000..9660afe --- /dev/null +++ b/backend/controllers/listaController.js @@ -0,0 +1,25 @@ +const mongoose = require("mongoose"); +const Lista = require("../models/listaModel"); + +const getListas = async (req, res) => { + const { id } = req.params; + try { + const listas = await Lista.find({ usuario: id }).sort({ createdAt: -1 }); + res.status(200).json(listas); + } catch (error) { + res.status(500).json({ error: error.message }); + } +} + +const postLista = async (req, res) => { + try { + const { nome, cor, emoji, usuario } = req.body; + const novaLista = new Lista({ nome, cor, emoji, usuario }); + const listaSalva = await novaLista.save(); + res.status(201).json(listaSalva); + } catch (error) { + res.status(500).json({ error: error.message }); + } +} + +module.exports = { getListas, postLista }; \ No newline at end of file From 49feddbe9bbd0219005f3158e4f1f1eecc06d5f6 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:19 -0300 Subject: [PATCH 026/173] Add userController.js to handle user operations in backend/controllers --- backend/controllers/userController.js | 79 +++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 backend/controllers/userController.js diff --git a/backend/controllers/userController.js b/backend/controllers/userController.js new file mode 100644 index 0000000..797bd58 --- /dev/null +++ b/backend/controllers/userController.js @@ -0,0 +1,79 @@ +const User = require("../models/userModel"); +const mongoose = require("mongoose"); + +// GET todos os usuarios +const getUsers = async (req, res) => { + try { + const users = await User.find({}).sort({ createdAt: -1 }); + res.status(200).json(users); + } catch (error) { + res.status(500).json({ error: error.message }); + } +}; + +// GET um usuario +const getUser = async (req, res) => { + const { id } = req.params; + + if (!mongoose.Types.ObjectId.isValid(id)) { + return res.status(404).json({ error: "Usuario não encontrado" }); + } + + const user = await User.findById(id); + + if (!user) { + return res.status(404).json({ error: "Usuario não encontrado" }); + } + + res.status(200).json(user); +}; + +// POST um novo usuario +const createUser = async (req, res) => { + const user = req.body; + + try { + const novoUser = await User.create(user); + res.status(201).json(novoUser); + } catch (error) { + res.status(409).json({ error: error.message }); + } +}; + +// DELETE um usuario +const deleteUser = async (req, res) => { + const { id } = req.params; + + if (!mongoose.Types.ObjectId.isValid(id)) { + return res.status(404).json({ error: "Usuario não encontrado" }); + } + + const user = await User.findByIdAndDelete(id); + + if (!user) { + return res.status(404).json({ error: "Usuario não encontrado" }); + } + + res.status(200).json(user); +}; + +// UPDATE um usuario +const updateUser = async (req, res) => { + const { id } = req.params; + + if (!mongoose.Types.ObjectId.isValid(id)) { + return res.status(404).json({ error: "Usuario não encontrado" }); + } + + const user = await User.findByIdAndUpdate(id, { + ...req.body, + }); + + if (!user) { + return res.status(404).json({ error: "Usuario não encontrado" }); + } + + res.status(200).json(user); +}; + +module.exports = { getUsers, getUser, createUser, deleteUser, updateUser }; From 0d050e21847acb10cdca80411c3e67528bcaadb4 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:25 -0300 Subject: [PATCH 027/173] Refactor userControllers.js to handle user operations in backend/controllers --- backend/controllers/userControllers.js | 79 -------------------------- 1 file changed, 79 deletions(-) delete mode 100644 backend/controllers/userControllers.js diff --git a/backend/controllers/userControllers.js b/backend/controllers/userControllers.js deleted file mode 100644 index c5aa418..0000000 --- a/backend/controllers/userControllers.js +++ /dev/null @@ -1,79 +0,0 @@ -const User = require("../models/userModel"); -const mongoose = require("mongoose"); - -// GET todos os usuarios -const getUsers = async (req, res) => { - try { - const users = await User.find({}).sort({ createdAt: -1 }); - res.status(200).json(users); - } catch (error) { - res.status(500).json({ error: error.message }); - } -}; - -// GET um usuario -const getUser = async (req, res) => { - const { id } = req.params; - - if (!mongoose.Types.ObjectId.isValid(id)) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - const user = await User.findById(id); - - if (!user) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - res.status(200).json(user); -}; - -// POST um novo usuario -const createUser = async (req, res) => { - const user = req.body; - - try { - const novoUser = await User.create(user); - res.status(201).json(novoUser); - } catch (error) { - res.status(409).json({ error: error.message }); - } -}; - -// DELETE um usuario -const deleteUser = async (req, res) => { - const { id } = req.params; - - if (!mongoose.Types.ObjectId.isValid(id)) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - const user = await User.findByIdAndDelete(id); - - if (!user) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - res.status(200).json(user); -}; - -// UPDATE um usuario -const updateUser = async (req, res) => { - const { id } = req.params; - - if (!mongoose.Types.ObjectId.isValid(id)) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - const user = await User.findByIdAndUpdate(id, { - ...req.body, - }); - - if (!user) { - return res.status(404).json({ error: "Usuario não encontrado" }); - } - - res.status(200).json(user); -}; - -module.exports = { getUsers, getUser, createUser, deleteUser, updateUser }; From 2c586f8a621cd752c3b5f9a320c5bf9547a4bf4f Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:31 -0300 Subject: [PATCH 028/173] Add flashcardSchema and niveis array to caixaModel.js --- backend/models/caixaModel.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/backend/models/caixaModel.js b/backend/models/caixaModel.js index a5e89e1..d3999db 100644 --- a/backend/models/caixaModel.js +++ b/backend/models/caixaModel.js @@ -1,8 +1,37 @@ const mongoose = require("mongoose"); +const flashcardSchema = new mongoose.Schema({ + frente: { + type: String, + required: true, + }, + verso: { + type: String, + required: true, + }, +}, { timestamps: true }) + const caixaSchema = new mongoose.Schema({ nome: { type: String, required: true, }, -}) \ No newline at end of file + niveis: [{ + numero:{ + type: Number, + required: true, + }, + intervalo: { + type: Number, + required: true, + }, + flashcards: [flashcardSchema], + usuario: { + type: mongoose.Schema.Types.ObjectId, + ref: "User", + required: true, + }, + }] +}, { timestamps: true }); + +module.exports = mongoose.model("Caixa", caixaSchema); \ No newline at end of file From 852bdbf131b8e4904f697e405622b0d76707e4dc Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:37 -0300 Subject: [PATCH 029/173] Add notaModel.js to handle note operations in backend/models --- backend/models/notaModel.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 backend/models/notaModel.js diff --git a/backend/models/notaModel.js b/backend/models/notaModel.js new file mode 100644 index 0000000..e16d5c8 --- /dev/null +++ b/backend/models/notaModel.js @@ -0,0 +1,18 @@ +const mongoose = require('mongoose'); + +const notaSchema = new mongoose.Schema({ + titulo: { + type: String, + required: true, + }, + conteudo: { + type: String, + }, + usuario: { + type: mongoose.Schema.Types.ObjectId, + ref: "User", + required: true, + }, +}, { timestamps: true }); + +module.exports = mongoose.model("Nota", notaSchema); \ No newline at end of file From f818ad47a781cb87049a7639f0e096516a3ed544 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:42 -0300 Subject: [PATCH 030/173] Add tagSchema to taskModel.js in backend/models --- backend/models/taskModel.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/backend/models/taskModel.js b/backend/models/taskModel.js index 7be152b..ad9ee2b 100644 --- a/backend/models/taskModel.js +++ b/backend/models/taskModel.js @@ -1,5 +1,16 @@ const mongoose = require('mongoose'); +const tagSchema = new mongoose.Schema({ + nome: { + type: String, + required: true, + }, + cor: { + type: String, + required: true, + }, +}) + const taskSchema = new mongoose.Schema({ nome: { type: String, @@ -13,7 +24,7 @@ const taskSchema = new mongoose.Schema({ }, status: { type: String, - enum: ["A fazer", "Concluída", "Excluída"], + enum: ["A fazer", "Em andamento", "Concluída", "Atrasada", "Excluída"], default: "A fazer", }, prioridade: { @@ -21,9 +32,7 @@ const taskSchema = new mongoose.Schema({ default: 1, enum: [1, 2, 3] }, - tags: { - type: Array, - }, + tags: [tagSchema], usuario: { type: mongoose.Schema.Types.ObjectId, ref: "User", From 5a718666deebeb74b7eb7609130c1a54ce881028 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:47 -0300 Subject: [PATCH 031/173] Add cadastro.js route to handle user registration in backend/routes --- backend/routes/cadastro.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 backend/routes/cadastro.js diff --git a/backend/routes/cadastro.js b/backend/routes/cadastro.js new file mode 100644 index 0000000..3870fd9 --- /dev/null +++ b/backend/routes/cadastro.js @@ -0,0 +1,11 @@ +const express = require("express"); +const { + cadastrarUsuario, +} = require("../controllers/cadastroController"); + +const router = express.Router(); + +// POST um novo usuario +router.post("/", cadastrarUsuario); + +module.exports = router; \ No newline at end of file From 21d1de8365f0f788d6f3ff5018d64341f55e502f Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:53 -0300 Subject: [PATCH 032/173] Add listas.js route to handle list operations in backend/routes --- backend/routes/listas.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 backend/routes/listas.js diff --git a/backend/routes/listas.js b/backend/routes/listas.js new file mode 100644 index 0000000..a3e2d17 --- /dev/null +++ b/backend/routes/listas.js @@ -0,0 +1,15 @@ +const express = require("express"); +const { + getListas, + postLista, +} = require("../controllers/listaController"); + +const router = express.Router(); + +// GET todas as listas +router.get("/:id", getListas); + +// POST uma nova lista +router.post("/", postLista); + +module.exports = router; \ No newline at end of file From 17b58910fcd00692dccc72473cbcaf34067a66d1 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 14:25:59 -0300 Subject: [PATCH 033/173] Refactor userControllers.js to userController.js in backend/routes/users.js --- backend/routes/users.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/routes/users.js b/backend/routes/users.js index 00bc7a0..57f4063 100644 --- a/backend/routes/users.js +++ b/backend/routes/users.js @@ -5,7 +5,7 @@ const { createUser, deleteUser, updateUser, -} = require("../controllers/userControllers"); +} = require("../controllers/userController"); const router = express.Router(); From 14f2d6c9d0dab03782466c93cb96ef8ff1e5fa11 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:28:12 -0300 Subject: [PATCH 034/173] Add TaskContextProvider to handle task operations in main.jsx --- app/src/main.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main.jsx b/app/src/main.jsx index 3590510..5637238 100644 --- a/app/src/main.jsx +++ b/app/src/main.jsx @@ -30,6 +30,7 @@ import Markdown from "./components/app/markdown/Markdown.jsx"; // Contextos import { UserContextProvider } from "./context/UserContext.jsx"; import { ListaContextProvider } from "./context/ListaContext.jsx"; +import { TaskContextProvider } from "./context/TaskContext.jsx"; const router = createBrowserRouter([ { @@ -41,7 +42,9 @@ const router = createBrowserRouter([ path: "app", element: ( - + + + ), children: [ From 1a0387adbcd670fb3ef6000434111e836fd127a9 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:28:17 -0300 Subject: [PATCH 035/173] Refactor fetchListas and fetchTasks functions in App.jsx --- app/src/components/App.jsx | 46 ++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/app/src/components/App.jsx b/app/src/components/App.jsx index eaa1b1c..f81f06d 100644 --- a/app/src/components/App.jsx +++ b/app/src/components/App.jsx @@ -11,31 +11,53 @@ function App() { useEffect(() => { const userJSON = JSON.parse(localStorage.getItem("user")); - console.log(userJSON); const fetchUser = async () => { if (userJSON) { userDispatch({ type: "SET_USER", payload: userJSON }); } - } + }; const fetchListas = async () => { - const response = await fetch(`http://localhost:4000/api/listas/${userJSON._id}`, { - method: "GET", - headers: { - "Content-Type": "application/json", - }, - }); + const response = await fetch( + `http://localhost:4000/api/listas/${userJSON._id}`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + } + ); const data = await response.json(); - console.log(data); if (response.ok) { listaDispatch({ type: "SET_LISTAS", payload: data }); + } else { + console.log("Erro ao buscar listas"); } - } + }; + + const fetchTasks = async () => { + const response = await fetch( + `http://localhost:4000/api/tasks/user/${userJSON._id}`, + { + method: "GET", + headers: { + "Content-Type": "application/json", + }, + } + ); + const data = await response.json(); + if (response.ok) { + listaDispatch({ type: "SET_TASKS", payload: data }); + } else { + console.log("Erro ao buscar tarefas"); + } + }; fetchUser(); fetchListas(); - }, []) - + fetchTasks(); + }, []); + return (
From 71bfa8a6a1cda5810f036233efd2069da8f3f61f Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:28:23 -0300 Subject: [PATCH 036/173] Refactor PageTasks component to use context hooks and filter tasks by today's date --- app/src/components/app/PageTasks.jsx | 44 +++++++++++++++++----------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/app/src/components/app/PageTasks.jsx b/app/src/components/app/PageTasks.jsx index fbd4152..a444937 100644 --- a/app/src/components/app/PageTasks.jsx +++ b/app/src/components/app/PageTasks.jsx @@ -9,25 +9,21 @@ import { UilAngleDown, UilCircle, } from "@iconscout/react-unicons"; -import useListas from "./listas/Listas"; +import { useListaContext } from "../../hooks/useListaContext"; +import { useTaskContext } from "../../hooks/useTaskContext"; const PageTasks = () => { const [sidebar, setSidebar] = useState(true); - const { listas, setListas, addLista } = useListas(); - const [users, setUsers] = useState(null); + const { listas, dispatch: dispatchListas } = useListaContext(); + const { tasks, dispatch: dispatchTasks } = useTaskContext(); - useEffect(() => { - const fetchUsers = async () => { - const response = await fetch("http://localhost:4000/api/users"); - const data = await response.json(); - setUsers(data) - } - fetchUsers(); - }, []); + const hoje = new Date().toISOString().split("T")[0]; + console.log(hoje); + const tasksHoje = tasks.filter((task) => task.data === hoje); return ( <> - +
@@ -51,12 +47,26 @@ const PageTasks = () => {
- {users && users.map((user) => ( -
- - {user.nome} + {/* {listas.map((lista) => ( +
+
+ + {lista.nome} +
+ {lista.tarefas.map((tarefa) => ( +
+
+ + {tarefa.nome} +
+
+ {lista.nome} + {tarefa.data} +
+
+ ))}
- ))} + ))} */}
); From e1b78c143a4b53068d0d757dc636814259864e2f Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:28:32 -0300 Subject: [PATCH 037/173] Refactor SecSidebar component to use showModalNewList state instead of showModal state --- app/src/components/app/SecSidebar.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/components/app/SecSidebar.jsx b/app/src/components/app/SecSidebar.jsx index 833fe10..884e91f 100644 --- a/app/src/components/app/SecSidebar.jsx +++ b/app/src/components/app/SecSidebar.jsx @@ -7,6 +7,7 @@ import { UilInbox, UilCalendarAlt, UilPuzzlePiece, + UilAngleUp, UilAngleDown, UilTagAlt, UilCheckCircle, @@ -25,10 +26,10 @@ const SecSidebar = ({isOpen, addLista}) => { const { listas } = useListaContext(); - const [showModal, setShowModal] = useState(false); + const [showModalNewList, setShowModalNewList] = useState(false); const handleAddLista = () => { - setShowModal(!showModal); + setShowModalNewList(!showModalNewList); }; return ( @@ -59,7 +60,7 @@ const SecSidebar = ({isOpen, addLista}) => {
- Listas + Listas
@@ -95,10 +96,10 @@ const SecSidebar = ({isOpen, addLista}) => { Excluídas
- {showModal && ( + {showModalNewList && ( )}
From 3ae3f0defd76d1267629a5563ef8a88680d16fd7 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:28:37 -0300 Subject: [PATCH 038/173] Fix hover behavior in SecSidebar module CSS --- app/src/components/app/SecSidebar.module.css | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/src/components/app/SecSidebar.module.css b/app/src/components/app/SecSidebar.module.css index dbadc6c..b016bda 100644 --- a/app/src/components/app/SecSidebar.module.css +++ b/app/src/components/app/SecSidebar.module.css @@ -65,6 +65,12 @@ line-height: normal; } + &:hover { + .badge { + display: flex; + } + } + .badge { color: var(--c7); font-family: Raleway; @@ -73,6 +79,9 @@ font-weight: 400; line-height: normal; position: absolute; + display: none; + align-items: center; + gap: 4px; right: 8px; top: auto; bottom: auto; From 664c91d6819e9f56545f7aa79c04a88b43f34b95 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:28:42 -0300 Subject: [PATCH 039/173] Add edit and delete buttons to BtnListas component --- app/src/components/app/listas/BtnListas.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/components/app/listas/BtnListas.jsx b/app/src/components/app/listas/BtnListas.jsx index 4ea7631..ece80f1 100644 --- a/app/src/components/app/listas/BtnListas.jsx +++ b/app/src/components/app/listas/BtnListas.jsx @@ -1,5 +1,5 @@ import PropTypes from "prop-types"; -import { UilSquareShape } from "@iconscout/react-unicons"; +import { UilSquareShape, UilPen, UilTrash } from "@iconscout/react-unicons"; const BtnListas = ({lista, style}) => { return ( @@ -10,6 +10,10 @@ const BtnListas = ({lista, style}) => { )} {lista.nome} + + + + ); }; From fdae0e1afc06faa1b65588bcaa421baf767a1169 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:28:49 -0300 Subject: [PATCH 040/173] Remove unused Listas component --- app/src/components/app/listas/Listas.jsx | 44 ------------------------ 1 file changed, 44 deletions(-) delete mode 100644 app/src/components/app/listas/Listas.jsx diff --git a/app/src/components/app/listas/Listas.jsx b/app/src/components/app/listas/Listas.jsx deleted file mode 100644 index 7e0393c..0000000 --- a/app/src/components/app/listas/Listas.jsx +++ /dev/null @@ -1,44 +0,0 @@ -import { useState, useEffect } from 'react' - -export default function useListas() { - const [listas, setListas] = useState(null); - - - const addLista = async (nome, decoracao, modo) => { - let novaLista = []; - if (modo === "emoji") { - fetch("http://localhost:4000/api/listas", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - nome: nome, - cor: null, - emoji: decoracao, - usuario: "662ab383d58317b3c6c7f81b" - }), - }).then((response) => response.json()).then((json) => { - novaLista = [...listas, json]; - }); - } else { - fetch("http://localhost:4000/api/listas", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - nome: nome, - cor: decoracao, - emoji: null, - usuario: "662ab383d58317b3c6c7f81b" - }), - }).then((response) => response.json()).then((json) => { - novaLista = [...listas, json]; - }); - } - setListas(novaLista); - }; - - return { listas, setListas, addLista }; -} \ No newline at end of file From ac5d64e82e5a9062fef9e01004bade3d953e8208 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:28:54 -0300 Subject: [PATCH 041/173] Refactor ModalNewList component to use setShowModalNewList prop instead of setShowModal prop --- app/src/components/app/modal/ModalNewList.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/components/app/modal/ModalNewList.jsx b/app/src/components/app/modal/ModalNewList.jsx index 2fc34a7..3ecc57b 100644 --- a/app/src/components/app/modal/ModalNewList.jsx +++ b/app/src/components/app/modal/ModalNewList.jsx @@ -5,7 +5,7 @@ import data from "@emoji-mart/data"; import Picker from "@emoji-mart/react"; import { useListaContext } from "../../../hooks/useListaContext"; -const ModalNewList = ({setShowModal}) => { +const ModalNewList = ({setShowModalNewList}) => { const { listas, dispatch } = useListaContext(); const [tabEmoji, setTabEmoji] = useState(false); const [emoji, setEmoji] = useState("smiley"); @@ -86,7 +86,7 @@ const ModalNewList = ({setShowModal}) => { setEmoji("smiley"); setModo(currentModo); setDecoracao(currentDecoracao); - setShowModal(false); + setShowModalNewList(false); }; const handleEmojiClick = (e) => { From 2d7c461e2f386b46ed5263714b030f3141fc803e Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:29:01 -0300 Subject: [PATCH 042/173] Add TaskContextProvider and TaskContext to handle task operations in app/src/context/TaskContext.jsx --- app/src/context/TaskContext.jsx | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 app/src/context/TaskContext.jsx diff --git a/app/src/context/TaskContext.jsx b/app/src/context/TaskContext.jsx new file mode 100644 index 0000000..13c81c7 --- /dev/null +++ b/app/src/context/TaskContext.jsx @@ -0,0 +1,35 @@ +import { createContext, useReducer } from "react"; + +export const TaskContext = createContext(); + +export const taskReducer = (state, action) => { + switch (action.type) { + case "SET_TASKS": + return { + tasks: action.payload + }; + case "CREATE_TASK": + return { + tasks: [action.payload, ...state.tasks] + }; + case "REMOVE_TASK": + return { + ...state, + tasks: state.tasks.filter((task) => task._id !== action.payload) + }; + default: + return state; + } +} + +export const TaskContextProvider = ({ children }) => { + const [state, dispatch] = useReducer(taskReducer, { + tasks: null + }); + + return ( + + { children } + + ) +} \ No newline at end of file From b8e6dce535c2ef3d173e64d0e045b5023d026f3c Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:29:06 -0300 Subject: [PATCH 043/173] Add useTaskContext hook to handle task operations in app/src/hooks/useTaskContext.jsx --- app/src/hooks/useTaskContext.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/src/hooks/useTaskContext.jsx diff --git a/app/src/hooks/useTaskContext.jsx b/app/src/hooks/useTaskContext.jsx new file mode 100644 index 0000000..a57f01c --- /dev/null +++ b/app/src/hooks/useTaskContext.jsx @@ -0,0 +1,10 @@ +import { TaskContext } from "../context/TaskContext"; +import { useContext } from "react"; + +export const useTaskContext = () => { + const context = useContext(TaskContext); + if (!context) { + throw new Error("useTaskContext must be used within a TaskContextProvider"); + } + return context; +}; From dde7279051da89ca998b2d5fc4fb73e2cb838684 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:29:11 -0300 Subject: [PATCH 044/173] Add tasksRoutes to server.js --- backend/server.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backend/server.js b/backend/server.js index 545b7e5..78d3800 100644 --- a/backend/server.js +++ b/backend/server.js @@ -25,11 +25,13 @@ const usersRoutes = require("./routes/users"); const loginRoutes = require("./routes/login"); const cadastroRoutes = require("./routes/cadastro"); const listasRoutes = require("./routes/listas"); +const tasksRoutes = require("./routes/tasks"); app.use("/api/users", usersRoutes); app.use("/api/login", loginRoutes); app.use("/api/cadastro", cadastroRoutes); app.use("/api/listas", listasRoutes); +app.use("/api/tasks", tasksRoutes); // connect to db mongoose From 7486abe13222d71b1ed13d09658a11a42fcb0fb5 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:29:16 -0300 Subject: [PATCH 045/173] Add taskController.js to handle task operations in backend/controllers --- backend/controllers/taskController.js | 70 +++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 backend/controllers/taskController.js diff --git a/backend/controllers/taskController.js b/backend/controllers/taskController.js new file mode 100644 index 0000000..53281ea --- /dev/null +++ b/backend/controllers/taskController.js @@ -0,0 +1,70 @@ +const Task = require('../models/taskModel'); +const mongoose = require('mongoose'); + +const criarTask = async (req, res) => { + const tarefa = req.body; + + if (!tarefa.nome || !tarefa.lista) { + return res.status(400).json({ error: 'Dados inválidos' }); + } + + try { + const novaTarefa = await Task.create(tarefa); + res.status(201).json(novaTarefa); + } catch (error) { + res.status(409).json({ error: error.message }); + } +} + +const buscarTasks = async (req, res) => { + const { id } = req.params; + + try { + const tarefas = await Task.find({ usuario: id }); + res.status(200).json(tarefas); + } catch (error) { + res.status(404).json({ error: error.message }); + } +} + +const buscarTask = async (req, res) => { + const { id } = req.params; + + try { + const tarefa = await Task.findById(id); + res.status(200).json(tarefa); + } catch (error) { + res.status(404).json({ error: error.message }); + } +} + +const atualizarTask = async (req, res) => { + const { id } = req.params; + const tarefa = req.body; + + try { + const tarefaAtualizada = await Task.findByIdAndUpdate(id, tarefa, { new: true }); + res.status(200).json(tarefaAtualizada); + } catch (error) { + res.status(404).json({ error: error.message }); + } +} + +const deletarTask = async (req, res) => { + const { id } = req.params; + + try { + await Task.findByIdAndDelete(id); + res.status(204).end(); + } catch (error) { + res.status(404).json({ error: error.message }); + } +} + +module.exports = { + criarTask, + buscarTasks, + buscarTask, + atualizarTask, + deletarTask, +}; \ No newline at end of file From 253ef206d8c0f28953eea35b56eace9f56cbe80f Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Fri, 26 Apr 2024 18:29:21 -0300 Subject: [PATCH 046/173] Add tasksRoutes to handle task operations in backend/routes/tasks.js --- backend/routes/tasks.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 backend/routes/tasks.js diff --git a/backend/routes/tasks.js b/backend/routes/tasks.js new file mode 100644 index 0000000..10a48cc --- /dev/null +++ b/backend/routes/tasks.js @@ -0,0 +1,18 @@ +const express = require('express'); +const { + criarTask, + buscarTasks, + buscarTask, + atualizarTask, + deletarTask, +} = require('../controllers/taskController.js'); + +const router = express.Router(); + +router.post('/', criarTask); +router.get('/user/:id', buscarTasks); +router.get('/:id', buscarTask); +router.put('/:id', atualizarTask); +router.delete('/:id', deletarTask); + +module.exports = router; \ No newline at end of file From 8e4957c9933a9d2148d3e6ce40133b8001a66ac2 Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Tue, 30 Apr 2024 14:08:18 -0300 Subject: [PATCH 047/173] Update Markdown component with new features and bug fixes --- app/src/components/app/PageNotes.jsx | 0 app/src/components/app/markdown/Markdown.jsx | 74 +++++++++++++++++--- 2 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 app/src/components/app/PageNotes.jsx diff --git a/app/src/components/app/PageNotes.jsx b/app/src/components/app/PageNotes.jsx new file mode 100644 index 0000000..e69de29 diff --git a/app/src/components/app/markdown/Markdown.jsx b/app/src/components/app/markdown/Markdown.jsx index b187f80..70f39b8 100644 --- a/app/src/components/app/markdown/Markdown.jsx +++ b/app/src/components/app/markdown/Markdown.jsx @@ -1,4 +1,4 @@ -import { useState } from "react"; +import { useState, useRef } from "react"; import style from "./Markdown.module.css"; import { UilBold, @@ -9,6 +9,7 @@ import { UilCheckSquare, UilCommentAlt, UilArrow, + UilFileDownload, } from "@iconscout/react-unicons"; import MdEditor from "./MdEditor"; import MdPreview from "./MdPreview"; @@ -17,27 +18,80 @@ const Markdown = () => { const storedMarkdown = localStorage.getItem("MARKDOWN"); const [markdown, setMarkdown] = useState(storedMarkdown ? storedMarkdown : "# Olá, mundo!"); + const textAreaRef = useRef(null); const callback = (markdown) => { setMarkdown(markdown); localStorage.setItem("MARKDOWN", markdown); } + const insertTag = (start, end) => { + const textArea = textAreaRef.current; + const startPos = textArea.selectionStart; + const endPos = textArea.selectionEnd; + const text = textArea.value; + + const newText = text.substring(0, startPos) + start + text.substring(startPos, endPos) + end + text.substring(endPos); + + setMarkdown(newText); + + textArea.selectionStart = startPos + start.length; + textArea.selectionEnd = endPos + start.length; + } + + const bold = () => { + insertTag("**", "**"); + } + const italic = () => { + insertTag("_", "_"); + } + const size = () => { + insertTag("# ", ""); + } + const listUl = () => { + insertTag("- ", ""); + } + const listOl = () => { + insertTag("1. ", ""); + } + const checkSquare = () => { + insertTag("- [ ] ", ""); + } + const quoteBlock = () => { + insertTag("\n> ", ""); + } + const codeBlock = () => { + insertTag('\n```\n', '\n```\n'); + } + + const gerarArquivo = () => { + const blob = new Blob([markdown], { type: "text/markdown" }); + const url = URL.createObjectURL(blob); + const link = document.createElement("a"); + link.href = url; + link.download = "arquivo.md"; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + URL.revokeObjectURL(url); + } + return (
- - - - - - - - + + + + + + + + +
- +
); From f7f1c8198417afe3af62dda36226147b46d1c24c Mon Sep 17 00:00:00 2001 From: thekidisalright Date: Tue, 30 Apr 2024 14:08:24 -0300 Subject: [PATCH 048/173] Update Markdown component with new features and bug fixes --- app/src/components/app/markdown/MdEditor.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/components/app/markdown/MdEditor.jsx b/app/src/components/app/markdown/MdEditor.jsx index 2d67544..22b11dd 100644 --- a/app/src/components/app/markdown/MdEditor.jsx +++ b/app/src/components/app/markdown/MdEditor.jsx @@ -1,10 +1,10 @@ -import React from 'react' +import { useRef } from 'react' import PropTypes from 'prop-types' -const MdEditor = ({style, markdown, setMarkdown}) => { +const MdEditor = ({style, markdown, setMarkdown, textAreaRef}) => { return (
-