From 6c8a510d803c16cb66d75e9f5ea39d17d5e44007 Mon Sep 17 00:00:00 2001 From: Aaron William Po Date: Tue, 11 Apr 2023 20:22:21 -0400 Subject: [PATCH 1/5] Update seed Create new users updated to create a longer random value to prevent duplication when seeding db. Beer images now use a generated caption and alt text. --- prisma/seed/create/createNewBeerImages.ts | 7 ++- prisma/seed/create/createNewUsers.ts | 2 +- tailwind.config.js | 59 +++++++++++++++-------- 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/prisma/seed/create/createNewBeerImages.ts b/prisma/seed/create/createNewBeerImages.ts index 0642f4c..f28e3ee 100644 --- a/prisma/seed/create/createNewBeerImages.ts +++ b/prisma/seed/create/createNewBeerImages.ts @@ -20,12 +20,15 @@ const createNewBeerImages = async ({ for (let i = 0; i < numberOfImages; i++) { const beerPost = beerPosts[Math.floor(Math.random() * beerPosts.length)]; const user = users[Math.floor(Math.random() * users.length)]; + const caption = faker.lorem.sentence(); + const alt = faker.lorem.sentence(); + beerImagesPromises.push( prisma.beerImage.create({ data: { path: 'https://picsum.photos/5000/5000', - alt: 'Placeholder beer image.', - caption: 'Placeholder beer image caption.', + alt, + caption, beerPost: { connect: { id: beerPost.id } }, postedBy: { connect: { id: user.id } }, createdAt, diff --git a/prisma/seed/create/createNewUsers.ts b/prisma/seed/create/createNewUsers.ts index c34bf4e..62da73b 100644 --- a/prisma/seed/create/createNewUsers.ts +++ b/prisma/seed/create/createNewUsers.ts @@ -18,7 +18,7 @@ const createNewUsers = async ({ numberOfUsers }: CreateNewUsersArgs) => { // eslint-disable-next-line no-plusplus for (let i = 0; i < numberOfUsers; i++) { - const randomValue = crypto.randomBytes(8).toString('hex'); + const randomValue = crypto.randomBytes(10).toString('hex'); const firstName = faker.name.firstName(); const lastName = faker.name.lastName(); const username = `${firstName[0]}.${lastName}.${randomValue}`; diff --git a/tailwind.config.js b/tailwind.config.js index fe63a71..f26ad62 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,3 +1,42 @@ +//themes + +const myTheme = { + default: { + primary: 'hsl(227, 23%, 20%)', + secondary: 'hsl(255, 9%, 69%)', + error: 'hsl(9, 52%, 57%)', + accent: 'hsl(316, 96%, 60%)', + neutral: 'hsl(240, 11%, 8%)', + info: 'hsl(207, 100%, 50%)', + success: 'hsl(100, 57%, 53%)', + warning: 'hsl(50, 98%, 50%)', + 'primary-content': 'hsl(0, 0%, 98%)', + 'error-content': 'hsl(0, 0%, 98%)', + 'base-100': 'hsl(190, 4%, 9%)', + 'base-200': 'hsl(190, 4%, 8%)', + 'base-300': 'hsl(190, 4%, 5%)', + }, +}; + +const pastelTheme = { + default: { + primary: 'hsl(180, 28%, 65%)', + secondary: 'hsl(21, 54%, 83%)', + error: 'hsl(4, 87%, 74%)', + accent: 'hsl(93, 27%, 73%)', + neutral: 'hsl(38, 31%, 91%)', + info: 'hsl(163, 40%, 79%)', + success: 'hsl(93, 27%, 73%)', + warning: 'hsl(40, 76%, 73%)', + 'primary-content': 'hsl(0, 0%, 12%)', + 'error-content': 'hsl(0, 0%, 12%)', + 'base-100': 'hsl(0, 0%, 85%)', + 'base-200': 'hsl(0, 0%, 82%)', + 'base-300': 'hsl(0, 0%, 78%)', + 'base-400': 'hsl(0, 0%, 75%)', + }, +}; + /** @type {import('tailwindcss').Config} */ module.exports = { content: [ @@ -13,24 +52,6 @@ module.exports = { daisyui: { logs: false, - themes: [ - { - default: { - primary: 'hsl(227, 23%, 20%)', - secondary: '#ABA9C3', - error: '#c17c74', - accent: '#fe3bd9', - neutral: '#131520', - info: '#0A7CFF', - success: '#8ACE2B', - warning: '#F9D002', - 'primary-content': '#FAF9F6', - 'error-content': '#FAF9F6', - 'base-100': 'hsl(190, 4%, 9%)', - 'base-200': 'hsl(190, 4%, 8%)', - 'base-300': 'hsl(190, 4%, 5%)', - }, - }, - ], + themes: [myTheme], }, }; From ea3e8a002395a65a8b6297080c7b2d7220d0b27c Mon Sep 17 00:00:00 2001 From: Aaron William Po Date: Tue, 11 Apr 2023 20:23:55 -0400 Subject: [PATCH 2/5] Refactor beer comment section and incorporate image carousel Beer comment section now uses a ternary expression for isLoading. Image carousel implemented in beer by id page. --- .../BeerById/BeerPostCommentsSection.tsx | 137 +++--- components/BeerById/LoadingComponent.tsx | 22 + components/ui/Spinner.tsx | 17 +- package-lock.json | 419 +++++++++++++++++- package.json | 2 + pages/beers/[id]/index.tsx | 34 +- pages/beers/index.tsx | 14 +- 7 files changed, 563 insertions(+), 82 deletions(-) create mode 100644 components/BeerById/LoadingComponent.tsx diff --git a/components/BeerById/BeerPostCommentsSection.tsx b/components/BeerById/BeerPostCommentsSection.tsx index bfeb7c9..8d67709 100644 --- a/components/BeerById/BeerPostCommentsSection.tsx +++ b/components/BeerById/BeerPostCommentsSection.tsx @@ -8,36 +8,23 @@ import { z } from 'zod'; import useBeerPostComments from '@/hooks/useBeerPostComments'; import { useRouter } from 'next/router'; import { useInView } from 'react-intersection-observer'; +import { FaArrowUp } from 'react-icons/fa'; import BeerCommentForm from './BeerCommentForm'; import CommentCardBody from './CommentCardBody'; import NoCommentsCard from './NoCommentsCard'; -import CommentLoadingCardBody from './CommentLoadingCardBody'; -import Spinner from '../ui/Spinner'; +import LoadingComponent from './LoadingComponent'; interface BeerPostCommentsSectionProps { beerPost: z.infer; } -const LoadingComponent: FC<{ length: number }> = ({ length }) => { - return ( - <> - {Array.from({ length }).map((_, i) => ( - - ))} -
- -
- - ); -}; - const BeerPostCommentsSection: FC = ({ beerPost }) => { const { user } = useContext(UserContext); const router = useRouter(); const { id } = beerPost; const pageNum = parseInt(router.query.comments_page as string, 10) || 1; - const PAGE_SIZE = 6; + const PAGE_SIZE = 4; const { comments, isLoading, mutate, setSize, size, isLoadingMore, isAtEnd } = useBeerPostComments({ @@ -46,8 +33,11 @@ const BeerPostCommentsSection: FC = ({ beerPost }) pageSize: PAGE_SIZE, }); - const { ref } = useInView({ - delay: 3000, + const { ref: lastCommentRef } = useInView({ + /** + * When the last comment comes into view, call setSize from useBeerPostComments to + * load more comments. + */ onChange: (visible) => { if (!visible || isAtEnd) return; setSize(size + 1); @@ -58,7 +48,7 @@ const BeerPostCommentsSection: FC = ({ beerPost }) return (
-
+
{user ? ( ) : ( @@ -69,47 +59,80 @@ const BeerPostCommentsSection: FC = ({ beerPost })
- {comments && !!comments.length && !isLoading && ( -
- {comments.map((comment, index) => { - const isLastComment = index === comments.length - 1; + { + /** + * If the comments are loading, show a loading component. Otherwise, show the + * comments. + */ + isLoading ? ( +
+ +
+ ) : ( + <> + {!!comments.length && ( +
+ {comments.map((comment, index) => { + const isLastComment = index === comments.length - 1; - return ( -
- + /** + * Attach a ref to the last comment in the list. When it comes into + * view, the component will call setSize to load more comments. + */ + return ( +
+ +
+ ); + })} + + { + /** + * If there are more comments to load, show a loading component with a + * skeleton loader and a loading spinner. + */ + !!isLoadingMore && ( + + ) + } + + { + /** + * If the user has scrolled to the end of the comments, show a button + * that will scroll them back to the top of the comments section. + */ + !!isAtEnd && ( +
+
+ +
+
+ ) + }
- ); - })} + )} - {!!isLoadingMore && ( -
- -
- )} - - {isAtEnd && ( -
- -
- )} -
- )} - - {!comments?.length && !isLoading && } - - {isLoading && ( -
- -
- )} + {!comments.length && } + + ) + }
); }; diff --git a/components/BeerById/LoadingComponent.tsx b/components/BeerById/LoadingComponent.tsx new file mode 100644 index 0000000..5e09a28 --- /dev/null +++ b/components/BeerById/LoadingComponent.tsx @@ -0,0 +1,22 @@ +import { FC } from 'react'; +import Spinner from '../ui/Spinner'; +import CommentLoadingCardBody from './CommentLoadingCardBody'; + +interface LoadingComponentProps { + length: number; +} + +const LoadingComponent: FC = ({ length }) => { + return ( + <> + {Array.from({ length }).map((_, i) => ( + + ))} +
+ +
+ + ); +}; + +export default LoadingComponent; diff --git a/components/ui/Spinner.tsx b/components/ui/Spinner.tsx index df69177..d42f745 100644 --- a/components/ui/Spinner.tsx +++ b/components/ui/Spinner.tsx @@ -7,17 +7,22 @@ interface SpinnerProps { const Spinner: FC = ({ size = 'md' }) => { const spinnerWidths: Record, `w-[${number}px]`> = { xs: 'w-[45px]', - sm: 'w-[60px]', - md: 'w-[100px]', - lg: 'w-[150px]', - xl: 'w-[200px]', + sm: 'w-[90px]', + md: 'w-[135px]', + lg: 'w-[180px]', + xl: 'w-[225px]', }; return ( -
+
- {beerPost.beerImages[0] && ( - {beerPost.beerImages[0].alt} - )} + + {beerPost.beerImages.map((image, index) => ( +
+ {image.alt} +
+ ))} +
-
+
diff --git a/pages/beers/index.tsx b/pages/beers/index.tsx index 6be6a80..2471037 100644 --- a/pages/beers/index.tsx +++ b/pages/beers/index.tsx @@ -9,6 +9,9 @@ import BeerCard from '@/components/BeerIndex/BeerCard'; import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult'; import Head from 'next/head'; import { z } from 'zod'; +import Link from 'next/link'; +import UserContext from '@/contexts/userContext'; +import { useContext } from 'react'; interface BeerPageProps { initialBeerPosts: z.infer[]; @@ -19,6 +22,8 @@ const BeerPage: NextPage = ({ initialBeerPosts, pageCount }) => { const router = useRouter(); const { query } = router; + const { user } = useContext(UserContext); + const pageNum = parseInt(query.page_num as string, 10) || 1; return ( @@ -28,13 +33,20 @@ const BeerPage: NextPage = ({ initialBeerPosts, pageCount }) => {
-
+

The Biergarten Index

Page {pageNum} of {pageCount}

+ {!!user && ( +
+ + Create a new beer post + +
+ )}
{initialBeerPosts.map((post) => { From f5abc518a40f7c9e41773389c13a665b86fd5bbc Mon Sep 17 00:00:00 2001 From: Aaron William Po Date: Tue, 11 Apr 2023 20:24:27 -0400 Subject: [PATCH 3/5] Update register user form disable itself when loading Fix error where a user could click submit multiple times while the form is submitting. --- components/RegisterUserForm.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/components/RegisterUserForm.tsx b/components/RegisterUserForm.tsx index 140ad78..ab092ae 100644 --- a/components/RegisterUserForm.tsx +++ b/components/RegisterUserForm.tsx @@ -56,6 +56,7 @@ const RegisterUserForm: FC = () => { { { { { { { { />
- +
From 90f2cc2c0c85873f2590dcd5f544985e01b83b25 Mon Sep 17 00:00:00 2001 From: Aaron William Po Date: Tue, 11 Apr 2023 22:18:29 -0400 Subject: [PATCH 4/5] Begin work on tab components for beer by id page --- .../BeerById/BeerPostCommentsSection.tsx | 2 +- hooks/useMediaQuery.ts | 19 +++++++++ package-lock.json | 42 +++++++++++++++++++ package.json | 2 + pages/beers/[id]/index.tsx | 38 ++++++++++++++--- tailwind.config.js | 6 ++- 6 files changed, 102 insertions(+), 7 deletions(-) create mode 100644 hooks/useMediaQuery.ts diff --git a/components/BeerById/BeerPostCommentsSection.tsx b/components/BeerById/BeerPostCommentsSection.tsx index 8d67709..fa0bd32 100644 --- a/components/BeerById/BeerPostCommentsSection.tsx +++ b/components/BeerById/BeerPostCommentsSection.tsx @@ -46,7 +46,7 @@ const BeerPostCommentsSection: FC = ({ beerPost }) const sectionRef: MutableRefObject = useRef(null); return ( -
+
{user ? ( diff --git a/hooks/useMediaQuery.ts b/hooks/useMediaQuery.ts new file mode 100644 index 0000000..240629e --- /dev/null +++ b/hooks/useMediaQuery.ts @@ -0,0 +1,19 @@ +import { useState, useEffect } from 'react'; + +const useMediaQuery = (query: string) => { + const [matches, setMatches] = useState(false); + + useEffect(() => { + const media = window.matchMedia(query); + if (media.matches !== matches) { + setMatches(media.matches); + } + const listener = () => setMatches(media.matches); + window.addEventListener('resize', listener); + return () => window.removeEventListener('resize', listener); + }, [matches, query]); + + return matches; +}; + +export default useMediaQuery; diff --git a/package-lock.json b/package-lock.json index 479d77f..79eb09d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,8 @@ "version": "0.1.0", "dependencies": { "@hapi/iron": "^7.0.1", + "@headlessui/react": "^1.7.13", + "@headlessui/tailwindcss": "^0.1.2", "@hookform/resolvers": "^3.0.0", "@prisma/client": "^4.12.0", "@react-email/components": "^0.0.4", @@ -649,6 +651,32 @@ "@hapi/hoek": "^11.0.2" } }, + "node_modules/@headlessui/react": { + "version": "1.7.13", + "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.13.tgz", + "integrity": "sha512-9n+EQKRtD9266xIHXdY5MfiXPDfYwl7zBM7KOx2Ae3Gdgxy8QML1FkCMjq6AsOf0l6N9uvI4HcFtuFlenaldKg==", + "dependencies": { + "client-only": "^0.0.1" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": "^16 || ^17 || ^18", + "react-dom": "^16 || ^17 || ^18" + } + }, + "node_modules/@headlessui/tailwindcss": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@headlessui/tailwindcss/-/tailwindcss-0.1.2.tgz", + "integrity": "sha512-AQNESz+f1grCxifrocOE6hDMDFqhqY0g3xrSGOS0ocGkmVkssaBzXaAPAPNSs/nHmr4ZUhfl5THQpYrvaouWlQ==", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "tailwindcss": "^3.0" + } + }, "node_modules/@hookform/resolvers": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-3.0.0.tgz", @@ -10691,6 +10719,20 @@ "@hapi/hoek": "^11.0.2" } }, + "@headlessui/react": { + "version": "1.7.13", + "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-1.7.13.tgz", + "integrity": "sha512-9n+EQKRtD9266xIHXdY5MfiXPDfYwl7zBM7KOx2Ae3Gdgxy8QML1FkCMjq6AsOf0l6N9uvI4HcFtuFlenaldKg==", + "requires": { + "client-only": "^0.0.1" + } + }, + "@headlessui/tailwindcss": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@headlessui/tailwindcss/-/tailwindcss-0.1.2.tgz", + "integrity": "sha512-AQNESz+f1grCxifrocOE6hDMDFqhqY0g3xrSGOS0ocGkmVkssaBzXaAPAPNSs/nHmr4ZUhfl5THQpYrvaouWlQ==", + "requires": {} + }, "@hookform/resolvers": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@hookform/resolvers/-/resolvers-3.0.0.tgz", diff --git a/package.json b/package.json index 24e8223..754ac8d 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,8 @@ }, "dependencies": { "@hapi/iron": "^7.0.1", + "@headlessui/react": "^1.7.13", + "@headlessui/tailwindcss": "^0.1.2", "@hookform/resolvers": "^3.0.0", "@prisma/client": "^4.12.0", "@react-email/components": "^0.0.4", diff --git a/pages/beers/[id]/index.tsx b/pages/beers/[id]/index.tsx index 0c914c2..f4d4d81 100644 --- a/pages/beers/[id]/index.tsx +++ b/pages/beers/[id]/index.tsx @@ -17,6 +17,8 @@ import { z } from 'zod'; import 'react-responsive-carousel/lib/styles/carousel.min.css'; // requires a loader import { Carousel } from 'react-responsive-carousel'; +import useMediaQuery from '@/hooks/useMediaQuery'; +import { Tab } from '@headlessui/react'; interface BeerPageProps { beerPost: z.infer; @@ -27,6 +29,8 @@ interface BeerPageProps { } const BeerByIdPage: NextPage = ({ beerPost, beerRecommendations }) => { + const isMd = useMediaQuery('(min-width: 768px)'); + return ( <> @@ -59,12 +63,36 @@ const BeerByIdPage: NextPage = ({ beerPost, beerRecommendations }
-
- -
- + + {isMd ? ( +
+
+ +
+
+ +
-
+ ) : ( + + + + Comments + + + Recommendations + + + + + + + + + + + + )}
diff --git a/tailwind.config.js b/tailwind.config.js index f26ad62..ae86c8a 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -48,7 +48,11 @@ module.exports = { theme: { extend: {}, }, - plugins: [require('daisyui'), require('tailwindcss-animate')], + plugins: [ + require('@headlessui/tailwindcss'), + require('daisyui'), + require('tailwindcss-animate'), + ], daisyui: { logs: false, From 08422fe24efec0c77ecbf84aba88473cfc8eb330 Mon Sep 17 00:00:00 2001 From: Aaron William Po Date: Tue, 11 Apr 2023 23:32:06 -0400 Subject: [PATCH 5/5] Restructure codebase to use src directory --- package.json | 3 +++ {components => src/components}/BeerById/BeerCommentForm.tsx | 0 {components => src/components}/BeerById/BeerInfoHeader.tsx | 0 .../components}/BeerById/BeerPostCommentsSection.tsx | 0 {components => src/components}/BeerById/BeerPostLikeButton.tsx | 0 .../components}/BeerById/BeerRecommendations.tsx | 0 {components => src/components}/BeerById/CommentCardBody.tsx | 0 .../components}/BeerById/CommentLoadingCardBody.tsx | 0 {components => src/components}/BeerById/LoadingComponent.tsx | 0 {components => src/components}/BeerById/NoCommentsCard.tsx | 0 {components => src/components}/BeerIndex/BeerCard.tsx | 0 .../components}/BeerIndex/BeerIndexPaginationBar.tsx | 0 {components => src/components}/CreateBeerPostForm.tsx | 0 {components => src/components}/EditBeerPostForm.tsx | 0 {components => src/components}/Login/LoginForm.tsx | 0 {components => src/components}/RegisterUserForm.tsx | 0 {components => src/components}/ui/Layout.tsx | 0 {components => src/components}/ui/Navbar.tsx | 0 {components => src/components}/ui/Spinner.tsx | 0 {components => src/components}/ui/alerts/ErrorAlert.tsx | 0 {components => src/components}/ui/forms/Button.tsx | 0 {components => src/components}/ui/forms/FormError.tsx | 0 {components => src/components}/ui/forms/FormInfo.tsx | 0 {components => src/components}/ui/forms/FormLabel.tsx | 0 {components => src/components}/ui/forms/FormPageLayout.tsx | 0 {components => src/components}/ui/forms/FormSegment.tsx | 0 {components => src/components}/ui/forms/FormSelect.tsx | 0 {components => src/components}/ui/forms/FormTextArea.tsx | 0 {components => src/components}/ui/forms/FormTextInput.tsx | 0 {config => src/config}/auth/cookie.ts | 0 {config => src/config}/auth/localStrat.ts | 0 {config => src/config}/auth/passwordFns.ts | 0 {config => src/config}/auth/session.ts | 0 {config => src/config}/auth/types.ts | 0 {config => src/config}/cloudinary/index.ts | 0 {config => src/config}/env/index.ts | 0 {config => src/config}/jwt/index.ts | 0 {config => src/config}/nextConnect/NextConnectOptions.ts | 0 .../config}/nextConnect/middleware/checkIfBeerPostOwner.ts | 0 .../config}/nextConnect/middleware/getCurrentUser.ts | 0 .../config}/nextConnect/middleware/validateRequest.ts | 0 {config => src/config}/pino/logger.ts | 0 {config => src/config}/sparkpost/client.ts | 0 {config => src/config}/sparkpost/sendEmail.ts | 0 {config => src/config}/util/ServerError.ts | 0 {contexts => src/contexts}/userContext.ts | 0 {emails => src/emails}/Welcome.tsx | 0 .../getServerSideProps}/withPageAuthRequired.ts | 0 {hooks => src/hooks}/useBeerPostComments.ts | 0 {hooks => src/hooks}/useBeerPostSearch.ts | 0 {hooks => src/hooks}/useCheckIfUserLikesBeerPost.ts | 0 {hooks => src/hooks}/useGetLikeCount.ts | 0 {hooks => src/hooks}/useMediaQuery.ts | 0 {hooks => src/hooks}/useRedirectIfLoggedIn.ts | 0 {hooks => src/hooks}/useTimeDistance.ts | 0 {hooks => src/hooks}/useUser.ts | 0 {pages => src/pages}/404.tsx | 0 {pages => src/pages}/500.tsx | 0 {pages => src/pages}/_app.tsx | 0 {pages => src/pages}/_document.tsx | 0 {pages => src/pages}/account/index.tsx | 0 {pages => src/pages}/api/beer-comments/[id].tsx | 0 {pages => src/pages}/api/beers/[id]/comments/index.ts | 0 {pages => src/pages}/api/beers/[id]/images/index.ts | 0 {pages => src/pages}/api/beers/[id]/index.ts | 0 {pages => src/pages}/api/beers/[id]/like/index.ts | 0 {pages => src/pages}/api/beers/[id]/like/is-liked.ts | 0 {pages => src/pages}/api/beers/create.ts | 0 {pages => src/pages}/api/beers/search.ts | 0 {pages => src/pages}/api/users/confirm.ts | 0 {pages => src/pages}/api/users/current.ts | 0 {pages => src/pages}/api/users/login.ts | 0 {pages => src/pages}/api/users/logout.ts | 0 {pages => src/pages}/api/users/register.ts | 0 {pages => src/pages}/beers/[id]/edit.tsx | 0 {pages => src/pages}/beers/[id]/index.tsx | 0 {pages => src/pages}/beers/create.tsx | 0 {pages => src/pages}/beers/index.tsx | 0 {pages => src/pages}/beers/search.tsx | 0 {pages => src/pages}/breweries/[id].tsx | 0 {pages => src/pages}/breweries/index.tsx | 0 {pages => src/pages}/index.tsx | 0 {pages => src/pages}/login/index.tsx | 0 {pages => src/pages}/register/index.tsx | 0 {pages => src/pages}/user/current.tsx | 0 {prisma => src/prisma}/DBClient.ts | 2 +- {prisma => src/prisma}/ERD.svg | 0 .../prisma}/migrations/20230406013055_/migration.sql | 0 {prisma => src/prisma}/migrations/migration_lock.toml | 0 {prisma => src/prisma}/schema.prisma | 0 {prisma => src/prisma}/seed/clean/cleanDatabase.ts | 0 {prisma => src/prisma}/seed/create/createNewBeerImages.ts | 0 .../prisma}/seed/create/createNewBeerPostComments.ts | 0 {prisma => src/prisma}/seed/create/createNewBeerPostLikes.ts | 0 {prisma => src/prisma}/seed/create/createNewBeerPosts.ts | 0 {prisma => src/prisma}/seed/create/createNewBeerTypes.ts | 0 {prisma => src/prisma}/seed/create/createNewBreweryImages.ts | 0 .../prisma}/seed/create/createNewBreweryPostComments.ts | 0 {prisma => src/prisma}/seed/create/createNewBreweryPosts.ts | 0 {prisma => src/prisma}/seed/create/createNewUsers.ts | 0 {prisma => src/prisma}/seed/index.ts | 0 {requests => src/requests}/sendCreateBeerCommentRequest.ts | 0 {requests => src/requests}/sendCreateBeerPostRequest.ts | 0 {requests => src/requests}/sendEditBeerPostRequest.ts | 0 {requests => src/requests}/sendLikeRequest.ts | 0 {requests => src/requests}/sendLoginUserRequest.ts | 0 {requests => src/requests}/sendRegisterUserRequest.ts | 0 {services => src/services}/BeerComment/createNewBeerComment.ts | 0 {services => src/services}/BeerComment/getAllBeerComments.ts | 0 {services => src/services}/BeerComment/getBeerCommentCount.ts | 0 .../services}/BeerComment/schema/BeerCommentQueryResult.ts | 0 .../BeerComment/schema/CreateBeerCommentValidationSchema.ts | 0 {services => src/services}/BeerPost/createNewBeerPost.ts | 0 {services => src/services}/BeerPost/editBeerPostById.ts | 0 {services => src/services}/BeerPost/getAllBeerPosts.ts | 0 {services => src/services}/BeerPost/getBeerPostById.ts | 0 {services => src/services}/BeerPost/getBeerRecommendations.ts | 0 .../services}/BeerPost/schema/BeerPostQueryResult.ts | 0 .../services}/BeerPost/schema/BeerRecommendationQueryResult.ts | 0 .../BeerPost/schema/CreateBeerPostValidationSchema.ts | 0 .../services}/BeerPost/schema/EditBeerPostValidationSchema.ts | 0 {services => src/services}/BeerPostLike/createBeerPostLike.ts | 0 .../services}/BeerPostLike/findBeerPostLikeById.ts | 0 .../services}/BeerPostLike/getBeerPostLikeCount.ts | 0 .../services}/BeerPostLike/removeBeerPostLikeById.ts | 0 {services => src/services}/BreweryPost/getAllBreweryPosts.ts | 0 {services => src/services}/BreweryPost/getBreweryPostById.ts | 0 .../services}/BreweryPost/types/BreweryPostQueryResult.ts | 0 {services => src/services}/User/createNewUser.ts | 0 {services => src/services}/User/findUserByEmail.ts | 0 {services => src/services}/User/findUserById.ts | 0 {services => src/services}/User/findUserByUsername.ts | 0 .../services}/User/schema/CreateUserValidationSchema.ts | 0 {services => src/services}/User/schema/GetUserSchema.ts | 0 .../services}/User/schema/LoginValidationSchema.ts | 0 {services => src/services}/User/sendConfirmationEmail.ts | 0 {services => src/services}/User/updateUserToBeConfirmedById.ts | 0 {styles => src/styles}/globals.css | 0 {validation => src/validation}/APIResponseValidationSchema.ts | 0 tailwind.config.js | 3 +-- tsconfig.json | 2 +- 141 files changed, 6 insertions(+), 4 deletions(-) rename {components => src/components}/BeerById/BeerCommentForm.tsx (100%) rename {components => src/components}/BeerById/BeerInfoHeader.tsx (100%) rename {components => src/components}/BeerById/BeerPostCommentsSection.tsx (100%) rename {components => src/components}/BeerById/BeerPostLikeButton.tsx (100%) rename {components => src/components}/BeerById/BeerRecommendations.tsx (100%) rename {components => src/components}/BeerById/CommentCardBody.tsx (100%) rename {components => src/components}/BeerById/CommentLoadingCardBody.tsx (100%) rename {components => src/components}/BeerById/LoadingComponent.tsx (100%) rename {components => src/components}/BeerById/NoCommentsCard.tsx (100%) rename {components => src/components}/BeerIndex/BeerCard.tsx (100%) rename {components => src/components}/BeerIndex/BeerIndexPaginationBar.tsx (100%) rename {components => src/components}/CreateBeerPostForm.tsx (100%) rename {components => src/components}/EditBeerPostForm.tsx (100%) rename {components => src/components}/Login/LoginForm.tsx (100%) rename {components => src/components}/RegisterUserForm.tsx (100%) rename {components => src/components}/ui/Layout.tsx (100%) rename {components => src/components}/ui/Navbar.tsx (100%) rename {components => src/components}/ui/Spinner.tsx (100%) rename {components => src/components}/ui/alerts/ErrorAlert.tsx (100%) rename {components => src/components}/ui/forms/Button.tsx (100%) rename {components => src/components}/ui/forms/FormError.tsx (100%) rename {components => src/components}/ui/forms/FormInfo.tsx (100%) rename {components => src/components}/ui/forms/FormLabel.tsx (100%) rename {components => src/components}/ui/forms/FormPageLayout.tsx (100%) rename {components => src/components}/ui/forms/FormSegment.tsx (100%) rename {components => src/components}/ui/forms/FormSelect.tsx (100%) rename {components => src/components}/ui/forms/FormTextArea.tsx (100%) rename {components => src/components}/ui/forms/FormTextInput.tsx (100%) rename {config => src/config}/auth/cookie.ts (100%) rename {config => src/config}/auth/localStrat.ts (100%) rename {config => src/config}/auth/passwordFns.ts (100%) rename {config => src/config}/auth/session.ts (100%) rename {config => src/config}/auth/types.ts (100%) rename {config => src/config}/cloudinary/index.ts (100%) rename {config => src/config}/env/index.ts (100%) rename {config => src/config}/jwt/index.ts (100%) rename {config => src/config}/nextConnect/NextConnectOptions.ts (100%) rename {config => src/config}/nextConnect/middleware/checkIfBeerPostOwner.ts (100%) rename {config => src/config}/nextConnect/middleware/getCurrentUser.ts (100%) rename {config => src/config}/nextConnect/middleware/validateRequest.ts (100%) rename {config => src/config}/pino/logger.ts (100%) rename {config => src/config}/sparkpost/client.ts (100%) rename {config => src/config}/sparkpost/sendEmail.ts (100%) rename {config => src/config}/util/ServerError.ts (100%) rename {contexts => src/contexts}/userContext.ts (100%) rename {emails => src/emails}/Welcome.tsx (100%) rename {getServerSideProps => src/getServerSideProps}/withPageAuthRequired.ts (100%) rename {hooks => src/hooks}/useBeerPostComments.ts (100%) rename {hooks => src/hooks}/useBeerPostSearch.ts (100%) rename {hooks => src/hooks}/useCheckIfUserLikesBeerPost.ts (100%) rename {hooks => src/hooks}/useGetLikeCount.ts (100%) rename {hooks => src/hooks}/useMediaQuery.ts (100%) rename {hooks => src/hooks}/useRedirectIfLoggedIn.ts (100%) rename {hooks => src/hooks}/useTimeDistance.ts (100%) rename {hooks => src/hooks}/useUser.ts (100%) rename {pages => src/pages}/404.tsx (100%) rename {pages => src/pages}/500.tsx (100%) rename {pages => src/pages}/_app.tsx (100%) rename {pages => src/pages}/_document.tsx (100%) rename {pages => src/pages}/account/index.tsx (100%) rename {pages => src/pages}/api/beer-comments/[id].tsx (100%) rename {pages => src/pages}/api/beers/[id]/comments/index.ts (100%) rename {pages => src/pages}/api/beers/[id]/images/index.ts (100%) rename {pages => src/pages}/api/beers/[id]/index.ts (100%) rename {pages => src/pages}/api/beers/[id]/like/index.ts (100%) rename {pages => src/pages}/api/beers/[id]/like/is-liked.ts (100%) rename {pages => src/pages}/api/beers/create.ts (100%) rename {pages => src/pages}/api/beers/search.ts (100%) rename {pages => src/pages}/api/users/confirm.ts (100%) rename {pages => src/pages}/api/users/current.ts (100%) rename {pages => src/pages}/api/users/login.ts (100%) rename {pages => src/pages}/api/users/logout.ts (100%) rename {pages => src/pages}/api/users/register.ts (100%) rename {pages => src/pages}/beers/[id]/edit.tsx (100%) rename {pages => src/pages}/beers/[id]/index.tsx (100%) rename {pages => src/pages}/beers/create.tsx (100%) rename {pages => src/pages}/beers/index.tsx (100%) rename {pages => src/pages}/beers/search.tsx (100%) rename {pages => src/pages}/breweries/[id].tsx (100%) rename {pages => src/pages}/breweries/index.tsx (100%) rename {pages => src/pages}/index.tsx (100%) rename {pages => src/pages}/login/index.tsx (100%) rename {pages => src/pages}/register/index.tsx (100%) rename {pages => src/pages}/user/current.tsx (100%) rename {prisma => src/prisma}/DBClient.ts (89%) rename {prisma => src/prisma}/ERD.svg (100%) rename {prisma => src/prisma}/migrations/20230406013055_/migration.sql (100%) rename {prisma => src/prisma}/migrations/migration_lock.toml (100%) rename {prisma => src/prisma}/schema.prisma (100%) rename {prisma => src/prisma}/seed/clean/cleanDatabase.ts (100%) rename {prisma => src/prisma}/seed/create/createNewBeerImages.ts (100%) rename {prisma => src/prisma}/seed/create/createNewBeerPostComments.ts (100%) rename {prisma => src/prisma}/seed/create/createNewBeerPostLikes.ts (100%) rename {prisma => src/prisma}/seed/create/createNewBeerPosts.ts (100%) rename {prisma => src/prisma}/seed/create/createNewBeerTypes.ts (100%) rename {prisma => src/prisma}/seed/create/createNewBreweryImages.ts (100%) rename {prisma => src/prisma}/seed/create/createNewBreweryPostComments.ts (100%) rename {prisma => src/prisma}/seed/create/createNewBreweryPosts.ts (100%) rename {prisma => src/prisma}/seed/create/createNewUsers.ts (100%) rename {prisma => src/prisma}/seed/index.ts (100%) rename {requests => src/requests}/sendCreateBeerCommentRequest.ts (100%) rename {requests => src/requests}/sendCreateBeerPostRequest.ts (100%) rename {requests => src/requests}/sendEditBeerPostRequest.ts (100%) rename {requests => src/requests}/sendLikeRequest.ts (100%) rename {requests => src/requests}/sendLoginUserRequest.ts (100%) rename {requests => src/requests}/sendRegisterUserRequest.ts (100%) rename {services => src/services}/BeerComment/createNewBeerComment.ts (100%) rename {services => src/services}/BeerComment/getAllBeerComments.ts (100%) rename {services => src/services}/BeerComment/getBeerCommentCount.ts (100%) rename {services => src/services}/BeerComment/schema/BeerCommentQueryResult.ts (100%) rename {services => src/services}/BeerComment/schema/CreateBeerCommentValidationSchema.ts (100%) rename {services => src/services}/BeerPost/createNewBeerPost.ts (100%) rename {services => src/services}/BeerPost/editBeerPostById.ts (100%) rename {services => src/services}/BeerPost/getAllBeerPosts.ts (100%) rename {services => src/services}/BeerPost/getBeerPostById.ts (100%) rename {services => src/services}/BeerPost/getBeerRecommendations.ts (100%) rename {services => src/services}/BeerPost/schema/BeerPostQueryResult.ts (100%) rename {services => src/services}/BeerPost/schema/BeerRecommendationQueryResult.ts (100%) rename {services => src/services}/BeerPost/schema/CreateBeerPostValidationSchema.ts (100%) rename {services => src/services}/BeerPost/schema/EditBeerPostValidationSchema.ts (100%) rename {services => src/services}/BeerPostLike/createBeerPostLike.ts (100%) rename {services => src/services}/BeerPostLike/findBeerPostLikeById.ts (100%) rename {services => src/services}/BeerPostLike/getBeerPostLikeCount.ts (100%) rename {services => src/services}/BeerPostLike/removeBeerPostLikeById.ts (100%) rename {services => src/services}/BreweryPost/getAllBreweryPosts.ts (100%) rename {services => src/services}/BreweryPost/getBreweryPostById.ts (100%) rename {services => src/services}/BreweryPost/types/BreweryPostQueryResult.ts (100%) rename {services => src/services}/User/createNewUser.ts (100%) rename {services => src/services}/User/findUserByEmail.ts (100%) rename {services => src/services}/User/findUserById.ts (100%) rename {services => src/services}/User/findUserByUsername.ts (100%) rename {services => src/services}/User/schema/CreateUserValidationSchema.ts (100%) rename {services => src/services}/User/schema/GetUserSchema.ts (100%) rename {services => src/services}/User/schema/LoginValidationSchema.ts (100%) rename {services => src/services}/User/sendConfirmationEmail.ts (100%) rename {services => src/services}/User/updateUserToBeConfirmedById.ts (100%) rename {styles => src/styles}/globals.css (100%) rename {validation => src/validation}/APIResponseValidationSchema.ts (100%) diff --git a/package.json b/package.json index 754ac8d..3cfd4fe 100644 --- a/package.json +++ b/package.json @@ -77,5 +77,8 @@ "tailwindcss-animate": "^1.0.5", "ts-node": "^10.9.1", "typescript": "^5.0.3" + }, + "prisma": { + "schema": "./src/prisma/schema.prisma" } } diff --git a/components/BeerById/BeerCommentForm.tsx b/src/components/BeerById/BeerCommentForm.tsx similarity index 100% rename from components/BeerById/BeerCommentForm.tsx rename to src/components/BeerById/BeerCommentForm.tsx diff --git a/components/BeerById/BeerInfoHeader.tsx b/src/components/BeerById/BeerInfoHeader.tsx similarity index 100% rename from components/BeerById/BeerInfoHeader.tsx rename to src/components/BeerById/BeerInfoHeader.tsx diff --git a/components/BeerById/BeerPostCommentsSection.tsx b/src/components/BeerById/BeerPostCommentsSection.tsx similarity index 100% rename from components/BeerById/BeerPostCommentsSection.tsx rename to src/components/BeerById/BeerPostCommentsSection.tsx diff --git a/components/BeerById/BeerPostLikeButton.tsx b/src/components/BeerById/BeerPostLikeButton.tsx similarity index 100% rename from components/BeerById/BeerPostLikeButton.tsx rename to src/components/BeerById/BeerPostLikeButton.tsx diff --git a/components/BeerById/BeerRecommendations.tsx b/src/components/BeerById/BeerRecommendations.tsx similarity index 100% rename from components/BeerById/BeerRecommendations.tsx rename to src/components/BeerById/BeerRecommendations.tsx diff --git a/components/BeerById/CommentCardBody.tsx b/src/components/BeerById/CommentCardBody.tsx similarity index 100% rename from components/BeerById/CommentCardBody.tsx rename to src/components/BeerById/CommentCardBody.tsx diff --git a/components/BeerById/CommentLoadingCardBody.tsx b/src/components/BeerById/CommentLoadingCardBody.tsx similarity index 100% rename from components/BeerById/CommentLoadingCardBody.tsx rename to src/components/BeerById/CommentLoadingCardBody.tsx diff --git a/components/BeerById/LoadingComponent.tsx b/src/components/BeerById/LoadingComponent.tsx similarity index 100% rename from components/BeerById/LoadingComponent.tsx rename to src/components/BeerById/LoadingComponent.tsx diff --git a/components/BeerById/NoCommentsCard.tsx b/src/components/BeerById/NoCommentsCard.tsx similarity index 100% rename from components/BeerById/NoCommentsCard.tsx rename to src/components/BeerById/NoCommentsCard.tsx diff --git a/components/BeerIndex/BeerCard.tsx b/src/components/BeerIndex/BeerCard.tsx similarity index 100% rename from components/BeerIndex/BeerCard.tsx rename to src/components/BeerIndex/BeerCard.tsx diff --git a/components/BeerIndex/BeerIndexPaginationBar.tsx b/src/components/BeerIndex/BeerIndexPaginationBar.tsx similarity index 100% rename from components/BeerIndex/BeerIndexPaginationBar.tsx rename to src/components/BeerIndex/BeerIndexPaginationBar.tsx diff --git a/components/CreateBeerPostForm.tsx b/src/components/CreateBeerPostForm.tsx similarity index 100% rename from components/CreateBeerPostForm.tsx rename to src/components/CreateBeerPostForm.tsx diff --git a/components/EditBeerPostForm.tsx b/src/components/EditBeerPostForm.tsx similarity index 100% rename from components/EditBeerPostForm.tsx rename to src/components/EditBeerPostForm.tsx diff --git a/components/Login/LoginForm.tsx b/src/components/Login/LoginForm.tsx similarity index 100% rename from components/Login/LoginForm.tsx rename to src/components/Login/LoginForm.tsx diff --git a/components/RegisterUserForm.tsx b/src/components/RegisterUserForm.tsx similarity index 100% rename from components/RegisterUserForm.tsx rename to src/components/RegisterUserForm.tsx diff --git a/components/ui/Layout.tsx b/src/components/ui/Layout.tsx similarity index 100% rename from components/ui/Layout.tsx rename to src/components/ui/Layout.tsx diff --git a/components/ui/Navbar.tsx b/src/components/ui/Navbar.tsx similarity index 100% rename from components/ui/Navbar.tsx rename to src/components/ui/Navbar.tsx diff --git a/components/ui/Spinner.tsx b/src/components/ui/Spinner.tsx similarity index 100% rename from components/ui/Spinner.tsx rename to src/components/ui/Spinner.tsx diff --git a/components/ui/alerts/ErrorAlert.tsx b/src/components/ui/alerts/ErrorAlert.tsx similarity index 100% rename from components/ui/alerts/ErrorAlert.tsx rename to src/components/ui/alerts/ErrorAlert.tsx diff --git a/components/ui/forms/Button.tsx b/src/components/ui/forms/Button.tsx similarity index 100% rename from components/ui/forms/Button.tsx rename to src/components/ui/forms/Button.tsx diff --git a/components/ui/forms/FormError.tsx b/src/components/ui/forms/FormError.tsx similarity index 100% rename from components/ui/forms/FormError.tsx rename to src/components/ui/forms/FormError.tsx diff --git a/components/ui/forms/FormInfo.tsx b/src/components/ui/forms/FormInfo.tsx similarity index 100% rename from components/ui/forms/FormInfo.tsx rename to src/components/ui/forms/FormInfo.tsx diff --git a/components/ui/forms/FormLabel.tsx b/src/components/ui/forms/FormLabel.tsx similarity index 100% rename from components/ui/forms/FormLabel.tsx rename to src/components/ui/forms/FormLabel.tsx diff --git a/components/ui/forms/FormPageLayout.tsx b/src/components/ui/forms/FormPageLayout.tsx similarity index 100% rename from components/ui/forms/FormPageLayout.tsx rename to src/components/ui/forms/FormPageLayout.tsx diff --git a/components/ui/forms/FormSegment.tsx b/src/components/ui/forms/FormSegment.tsx similarity index 100% rename from components/ui/forms/FormSegment.tsx rename to src/components/ui/forms/FormSegment.tsx diff --git a/components/ui/forms/FormSelect.tsx b/src/components/ui/forms/FormSelect.tsx similarity index 100% rename from components/ui/forms/FormSelect.tsx rename to src/components/ui/forms/FormSelect.tsx diff --git a/components/ui/forms/FormTextArea.tsx b/src/components/ui/forms/FormTextArea.tsx similarity index 100% rename from components/ui/forms/FormTextArea.tsx rename to src/components/ui/forms/FormTextArea.tsx diff --git a/components/ui/forms/FormTextInput.tsx b/src/components/ui/forms/FormTextInput.tsx similarity index 100% rename from components/ui/forms/FormTextInput.tsx rename to src/components/ui/forms/FormTextInput.tsx diff --git a/config/auth/cookie.ts b/src/config/auth/cookie.ts similarity index 100% rename from config/auth/cookie.ts rename to src/config/auth/cookie.ts diff --git a/config/auth/localStrat.ts b/src/config/auth/localStrat.ts similarity index 100% rename from config/auth/localStrat.ts rename to src/config/auth/localStrat.ts diff --git a/config/auth/passwordFns.ts b/src/config/auth/passwordFns.ts similarity index 100% rename from config/auth/passwordFns.ts rename to src/config/auth/passwordFns.ts diff --git a/config/auth/session.ts b/src/config/auth/session.ts similarity index 100% rename from config/auth/session.ts rename to src/config/auth/session.ts diff --git a/config/auth/types.ts b/src/config/auth/types.ts similarity index 100% rename from config/auth/types.ts rename to src/config/auth/types.ts diff --git a/config/cloudinary/index.ts b/src/config/cloudinary/index.ts similarity index 100% rename from config/cloudinary/index.ts rename to src/config/cloudinary/index.ts diff --git a/config/env/index.ts b/src/config/env/index.ts similarity index 100% rename from config/env/index.ts rename to src/config/env/index.ts diff --git a/config/jwt/index.ts b/src/config/jwt/index.ts similarity index 100% rename from config/jwt/index.ts rename to src/config/jwt/index.ts diff --git a/config/nextConnect/NextConnectOptions.ts b/src/config/nextConnect/NextConnectOptions.ts similarity index 100% rename from config/nextConnect/NextConnectOptions.ts rename to src/config/nextConnect/NextConnectOptions.ts diff --git a/config/nextConnect/middleware/checkIfBeerPostOwner.ts b/src/config/nextConnect/middleware/checkIfBeerPostOwner.ts similarity index 100% rename from config/nextConnect/middleware/checkIfBeerPostOwner.ts rename to src/config/nextConnect/middleware/checkIfBeerPostOwner.ts diff --git a/config/nextConnect/middleware/getCurrentUser.ts b/src/config/nextConnect/middleware/getCurrentUser.ts similarity index 100% rename from config/nextConnect/middleware/getCurrentUser.ts rename to src/config/nextConnect/middleware/getCurrentUser.ts diff --git a/config/nextConnect/middleware/validateRequest.ts b/src/config/nextConnect/middleware/validateRequest.ts similarity index 100% rename from config/nextConnect/middleware/validateRequest.ts rename to src/config/nextConnect/middleware/validateRequest.ts diff --git a/config/pino/logger.ts b/src/config/pino/logger.ts similarity index 100% rename from config/pino/logger.ts rename to src/config/pino/logger.ts diff --git a/config/sparkpost/client.ts b/src/config/sparkpost/client.ts similarity index 100% rename from config/sparkpost/client.ts rename to src/config/sparkpost/client.ts diff --git a/config/sparkpost/sendEmail.ts b/src/config/sparkpost/sendEmail.ts similarity index 100% rename from config/sparkpost/sendEmail.ts rename to src/config/sparkpost/sendEmail.ts diff --git a/config/util/ServerError.ts b/src/config/util/ServerError.ts similarity index 100% rename from config/util/ServerError.ts rename to src/config/util/ServerError.ts diff --git a/contexts/userContext.ts b/src/contexts/userContext.ts similarity index 100% rename from contexts/userContext.ts rename to src/contexts/userContext.ts diff --git a/emails/Welcome.tsx b/src/emails/Welcome.tsx similarity index 100% rename from emails/Welcome.tsx rename to src/emails/Welcome.tsx diff --git a/getServerSideProps/withPageAuthRequired.ts b/src/getServerSideProps/withPageAuthRequired.ts similarity index 100% rename from getServerSideProps/withPageAuthRequired.ts rename to src/getServerSideProps/withPageAuthRequired.ts diff --git a/hooks/useBeerPostComments.ts b/src/hooks/useBeerPostComments.ts similarity index 100% rename from hooks/useBeerPostComments.ts rename to src/hooks/useBeerPostComments.ts diff --git a/hooks/useBeerPostSearch.ts b/src/hooks/useBeerPostSearch.ts similarity index 100% rename from hooks/useBeerPostSearch.ts rename to src/hooks/useBeerPostSearch.ts diff --git a/hooks/useCheckIfUserLikesBeerPost.ts b/src/hooks/useCheckIfUserLikesBeerPost.ts similarity index 100% rename from hooks/useCheckIfUserLikesBeerPost.ts rename to src/hooks/useCheckIfUserLikesBeerPost.ts diff --git a/hooks/useGetLikeCount.ts b/src/hooks/useGetLikeCount.ts similarity index 100% rename from hooks/useGetLikeCount.ts rename to src/hooks/useGetLikeCount.ts diff --git a/hooks/useMediaQuery.ts b/src/hooks/useMediaQuery.ts similarity index 100% rename from hooks/useMediaQuery.ts rename to src/hooks/useMediaQuery.ts diff --git a/hooks/useRedirectIfLoggedIn.ts b/src/hooks/useRedirectIfLoggedIn.ts similarity index 100% rename from hooks/useRedirectIfLoggedIn.ts rename to src/hooks/useRedirectIfLoggedIn.ts diff --git a/hooks/useTimeDistance.ts b/src/hooks/useTimeDistance.ts similarity index 100% rename from hooks/useTimeDistance.ts rename to src/hooks/useTimeDistance.ts diff --git a/hooks/useUser.ts b/src/hooks/useUser.ts similarity index 100% rename from hooks/useUser.ts rename to src/hooks/useUser.ts diff --git a/pages/404.tsx b/src/pages/404.tsx similarity index 100% rename from pages/404.tsx rename to src/pages/404.tsx diff --git a/pages/500.tsx b/src/pages/500.tsx similarity index 100% rename from pages/500.tsx rename to src/pages/500.tsx diff --git a/pages/_app.tsx b/src/pages/_app.tsx similarity index 100% rename from pages/_app.tsx rename to src/pages/_app.tsx diff --git a/pages/_document.tsx b/src/pages/_document.tsx similarity index 100% rename from pages/_document.tsx rename to src/pages/_document.tsx diff --git a/pages/account/index.tsx b/src/pages/account/index.tsx similarity index 100% rename from pages/account/index.tsx rename to src/pages/account/index.tsx diff --git a/pages/api/beer-comments/[id].tsx b/src/pages/api/beer-comments/[id].tsx similarity index 100% rename from pages/api/beer-comments/[id].tsx rename to src/pages/api/beer-comments/[id].tsx diff --git a/pages/api/beers/[id]/comments/index.ts b/src/pages/api/beers/[id]/comments/index.ts similarity index 100% rename from pages/api/beers/[id]/comments/index.ts rename to src/pages/api/beers/[id]/comments/index.ts diff --git a/pages/api/beers/[id]/images/index.ts b/src/pages/api/beers/[id]/images/index.ts similarity index 100% rename from pages/api/beers/[id]/images/index.ts rename to src/pages/api/beers/[id]/images/index.ts diff --git a/pages/api/beers/[id]/index.ts b/src/pages/api/beers/[id]/index.ts similarity index 100% rename from pages/api/beers/[id]/index.ts rename to src/pages/api/beers/[id]/index.ts diff --git a/pages/api/beers/[id]/like/index.ts b/src/pages/api/beers/[id]/like/index.ts similarity index 100% rename from pages/api/beers/[id]/like/index.ts rename to src/pages/api/beers/[id]/like/index.ts diff --git a/pages/api/beers/[id]/like/is-liked.ts b/src/pages/api/beers/[id]/like/is-liked.ts similarity index 100% rename from pages/api/beers/[id]/like/is-liked.ts rename to src/pages/api/beers/[id]/like/is-liked.ts diff --git a/pages/api/beers/create.ts b/src/pages/api/beers/create.ts similarity index 100% rename from pages/api/beers/create.ts rename to src/pages/api/beers/create.ts diff --git a/pages/api/beers/search.ts b/src/pages/api/beers/search.ts similarity index 100% rename from pages/api/beers/search.ts rename to src/pages/api/beers/search.ts diff --git a/pages/api/users/confirm.ts b/src/pages/api/users/confirm.ts similarity index 100% rename from pages/api/users/confirm.ts rename to src/pages/api/users/confirm.ts diff --git a/pages/api/users/current.ts b/src/pages/api/users/current.ts similarity index 100% rename from pages/api/users/current.ts rename to src/pages/api/users/current.ts diff --git a/pages/api/users/login.ts b/src/pages/api/users/login.ts similarity index 100% rename from pages/api/users/login.ts rename to src/pages/api/users/login.ts diff --git a/pages/api/users/logout.ts b/src/pages/api/users/logout.ts similarity index 100% rename from pages/api/users/logout.ts rename to src/pages/api/users/logout.ts diff --git a/pages/api/users/register.ts b/src/pages/api/users/register.ts similarity index 100% rename from pages/api/users/register.ts rename to src/pages/api/users/register.ts diff --git a/pages/beers/[id]/edit.tsx b/src/pages/beers/[id]/edit.tsx similarity index 100% rename from pages/beers/[id]/edit.tsx rename to src/pages/beers/[id]/edit.tsx diff --git a/pages/beers/[id]/index.tsx b/src/pages/beers/[id]/index.tsx similarity index 100% rename from pages/beers/[id]/index.tsx rename to src/pages/beers/[id]/index.tsx diff --git a/pages/beers/create.tsx b/src/pages/beers/create.tsx similarity index 100% rename from pages/beers/create.tsx rename to src/pages/beers/create.tsx diff --git a/pages/beers/index.tsx b/src/pages/beers/index.tsx similarity index 100% rename from pages/beers/index.tsx rename to src/pages/beers/index.tsx diff --git a/pages/beers/search.tsx b/src/pages/beers/search.tsx similarity index 100% rename from pages/beers/search.tsx rename to src/pages/beers/search.tsx diff --git a/pages/breweries/[id].tsx b/src/pages/breweries/[id].tsx similarity index 100% rename from pages/breweries/[id].tsx rename to src/pages/breweries/[id].tsx diff --git a/pages/breweries/index.tsx b/src/pages/breweries/index.tsx similarity index 100% rename from pages/breweries/index.tsx rename to src/pages/breweries/index.tsx diff --git a/pages/index.tsx b/src/pages/index.tsx similarity index 100% rename from pages/index.tsx rename to src/pages/index.tsx diff --git a/pages/login/index.tsx b/src/pages/login/index.tsx similarity index 100% rename from pages/login/index.tsx rename to src/pages/login/index.tsx diff --git a/pages/register/index.tsx b/src/pages/register/index.tsx similarity index 100% rename from pages/register/index.tsx rename to src/pages/register/index.tsx diff --git a/pages/user/current.tsx b/src/pages/user/current.tsx similarity index 100% rename from pages/user/current.tsx rename to src/pages/user/current.tsx diff --git a/prisma/DBClient.ts b/src/prisma/DBClient.ts similarity index 89% rename from prisma/DBClient.ts rename to src/prisma/DBClient.ts index bcdb365..219576e 100644 --- a/prisma/DBClient.ts +++ b/src/prisma/DBClient.ts @@ -1,5 +1,5 @@ import { PrismaClient } from '@prisma/client'; -import { NODE_ENV } from '../config/env'; +import { NODE_ENV } from '@/config/env'; const globalForPrisma = global as unknown as { prisma: PrismaClient }; diff --git a/prisma/ERD.svg b/src/prisma/ERD.svg similarity index 100% rename from prisma/ERD.svg rename to src/prisma/ERD.svg diff --git a/prisma/migrations/20230406013055_/migration.sql b/src/prisma/migrations/20230406013055_/migration.sql similarity index 100% rename from prisma/migrations/20230406013055_/migration.sql rename to src/prisma/migrations/20230406013055_/migration.sql diff --git a/prisma/migrations/migration_lock.toml b/src/prisma/migrations/migration_lock.toml similarity index 100% rename from prisma/migrations/migration_lock.toml rename to src/prisma/migrations/migration_lock.toml diff --git a/prisma/schema.prisma b/src/prisma/schema.prisma similarity index 100% rename from prisma/schema.prisma rename to src/prisma/schema.prisma diff --git a/prisma/seed/clean/cleanDatabase.ts b/src/prisma/seed/clean/cleanDatabase.ts similarity index 100% rename from prisma/seed/clean/cleanDatabase.ts rename to src/prisma/seed/clean/cleanDatabase.ts diff --git a/prisma/seed/create/createNewBeerImages.ts b/src/prisma/seed/create/createNewBeerImages.ts similarity index 100% rename from prisma/seed/create/createNewBeerImages.ts rename to src/prisma/seed/create/createNewBeerImages.ts diff --git a/prisma/seed/create/createNewBeerPostComments.ts b/src/prisma/seed/create/createNewBeerPostComments.ts similarity index 100% rename from prisma/seed/create/createNewBeerPostComments.ts rename to src/prisma/seed/create/createNewBeerPostComments.ts diff --git a/prisma/seed/create/createNewBeerPostLikes.ts b/src/prisma/seed/create/createNewBeerPostLikes.ts similarity index 100% rename from prisma/seed/create/createNewBeerPostLikes.ts rename to src/prisma/seed/create/createNewBeerPostLikes.ts diff --git a/prisma/seed/create/createNewBeerPosts.ts b/src/prisma/seed/create/createNewBeerPosts.ts similarity index 100% rename from prisma/seed/create/createNewBeerPosts.ts rename to src/prisma/seed/create/createNewBeerPosts.ts diff --git a/prisma/seed/create/createNewBeerTypes.ts b/src/prisma/seed/create/createNewBeerTypes.ts similarity index 100% rename from prisma/seed/create/createNewBeerTypes.ts rename to src/prisma/seed/create/createNewBeerTypes.ts diff --git a/prisma/seed/create/createNewBreweryImages.ts b/src/prisma/seed/create/createNewBreweryImages.ts similarity index 100% rename from prisma/seed/create/createNewBreweryImages.ts rename to src/prisma/seed/create/createNewBreweryImages.ts diff --git a/prisma/seed/create/createNewBreweryPostComments.ts b/src/prisma/seed/create/createNewBreweryPostComments.ts similarity index 100% rename from prisma/seed/create/createNewBreweryPostComments.ts rename to src/prisma/seed/create/createNewBreweryPostComments.ts diff --git a/prisma/seed/create/createNewBreweryPosts.ts b/src/prisma/seed/create/createNewBreweryPosts.ts similarity index 100% rename from prisma/seed/create/createNewBreweryPosts.ts rename to src/prisma/seed/create/createNewBreweryPosts.ts diff --git a/prisma/seed/create/createNewUsers.ts b/src/prisma/seed/create/createNewUsers.ts similarity index 100% rename from prisma/seed/create/createNewUsers.ts rename to src/prisma/seed/create/createNewUsers.ts diff --git a/prisma/seed/index.ts b/src/prisma/seed/index.ts similarity index 100% rename from prisma/seed/index.ts rename to src/prisma/seed/index.ts diff --git a/requests/sendCreateBeerCommentRequest.ts b/src/requests/sendCreateBeerCommentRequest.ts similarity index 100% rename from requests/sendCreateBeerCommentRequest.ts rename to src/requests/sendCreateBeerCommentRequest.ts diff --git a/requests/sendCreateBeerPostRequest.ts b/src/requests/sendCreateBeerPostRequest.ts similarity index 100% rename from requests/sendCreateBeerPostRequest.ts rename to src/requests/sendCreateBeerPostRequest.ts diff --git a/requests/sendEditBeerPostRequest.ts b/src/requests/sendEditBeerPostRequest.ts similarity index 100% rename from requests/sendEditBeerPostRequest.ts rename to src/requests/sendEditBeerPostRequest.ts diff --git a/requests/sendLikeRequest.ts b/src/requests/sendLikeRequest.ts similarity index 100% rename from requests/sendLikeRequest.ts rename to src/requests/sendLikeRequest.ts diff --git a/requests/sendLoginUserRequest.ts b/src/requests/sendLoginUserRequest.ts similarity index 100% rename from requests/sendLoginUserRequest.ts rename to src/requests/sendLoginUserRequest.ts diff --git a/requests/sendRegisterUserRequest.ts b/src/requests/sendRegisterUserRequest.ts similarity index 100% rename from requests/sendRegisterUserRequest.ts rename to src/requests/sendRegisterUserRequest.ts diff --git a/services/BeerComment/createNewBeerComment.ts b/src/services/BeerComment/createNewBeerComment.ts similarity index 100% rename from services/BeerComment/createNewBeerComment.ts rename to src/services/BeerComment/createNewBeerComment.ts diff --git a/services/BeerComment/getAllBeerComments.ts b/src/services/BeerComment/getAllBeerComments.ts similarity index 100% rename from services/BeerComment/getAllBeerComments.ts rename to src/services/BeerComment/getAllBeerComments.ts diff --git a/services/BeerComment/getBeerCommentCount.ts b/src/services/BeerComment/getBeerCommentCount.ts similarity index 100% rename from services/BeerComment/getBeerCommentCount.ts rename to src/services/BeerComment/getBeerCommentCount.ts diff --git a/services/BeerComment/schema/BeerCommentQueryResult.ts b/src/services/BeerComment/schema/BeerCommentQueryResult.ts similarity index 100% rename from services/BeerComment/schema/BeerCommentQueryResult.ts rename to src/services/BeerComment/schema/BeerCommentQueryResult.ts diff --git a/services/BeerComment/schema/CreateBeerCommentValidationSchema.ts b/src/services/BeerComment/schema/CreateBeerCommentValidationSchema.ts similarity index 100% rename from services/BeerComment/schema/CreateBeerCommentValidationSchema.ts rename to src/services/BeerComment/schema/CreateBeerCommentValidationSchema.ts diff --git a/services/BeerPost/createNewBeerPost.ts b/src/services/BeerPost/createNewBeerPost.ts similarity index 100% rename from services/BeerPost/createNewBeerPost.ts rename to src/services/BeerPost/createNewBeerPost.ts diff --git a/services/BeerPost/editBeerPostById.ts b/src/services/BeerPost/editBeerPostById.ts similarity index 100% rename from services/BeerPost/editBeerPostById.ts rename to src/services/BeerPost/editBeerPostById.ts diff --git a/services/BeerPost/getAllBeerPosts.ts b/src/services/BeerPost/getAllBeerPosts.ts similarity index 100% rename from services/BeerPost/getAllBeerPosts.ts rename to src/services/BeerPost/getAllBeerPosts.ts diff --git a/services/BeerPost/getBeerPostById.ts b/src/services/BeerPost/getBeerPostById.ts similarity index 100% rename from services/BeerPost/getBeerPostById.ts rename to src/services/BeerPost/getBeerPostById.ts diff --git a/services/BeerPost/getBeerRecommendations.ts b/src/services/BeerPost/getBeerRecommendations.ts similarity index 100% rename from services/BeerPost/getBeerRecommendations.ts rename to src/services/BeerPost/getBeerRecommendations.ts diff --git a/services/BeerPost/schema/BeerPostQueryResult.ts b/src/services/BeerPost/schema/BeerPostQueryResult.ts similarity index 100% rename from services/BeerPost/schema/BeerPostQueryResult.ts rename to src/services/BeerPost/schema/BeerPostQueryResult.ts diff --git a/services/BeerPost/schema/BeerRecommendationQueryResult.ts b/src/services/BeerPost/schema/BeerRecommendationQueryResult.ts similarity index 100% rename from services/BeerPost/schema/BeerRecommendationQueryResult.ts rename to src/services/BeerPost/schema/BeerRecommendationQueryResult.ts diff --git a/services/BeerPost/schema/CreateBeerPostValidationSchema.ts b/src/services/BeerPost/schema/CreateBeerPostValidationSchema.ts similarity index 100% rename from services/BeerPost/schema/CreateBeerPostValidationSchema.ts rename to src/services/BeerPost/schema/CreateBeerPostValidationSchema.ts diff --git a/services/BeerPost/schema/EditBeerPostValidationSchema.ts b/src/services/BeerPost/schema/EditBeerPostValidationSchema.ts similarity index 100% rename from services/BeerPost/schema/EditBeerPostValidationSchema.ts rename to src/services/BeerPost/schema/EditBeerPostValidationSchema.ts diff --git a/services/BeerPostLike/createBeerPostLike.ts b/src/services/BeerPostLike/createBeerPostLike.ts similarity index 100% rename from services/BeerPostLike/createBeerPostLike.ts rename to src/services/BeerPostLike/createBeerPostLike.ts diff --git a/services/BeerPostLike/findBeerPostLikeById.ts b/src/services/BeerPostLike/findBeerPostLikeById.ts similarity index 100% rename from services/BeerPostLike/findBeerPostLikeById.ts rename to src/services/BeerPostLike/findBeerPostLikeById.ts diff --git a/services/BeerPostLike/getBeerPostLikeCount.ts b/src/services/BeerPostLike/getBeerPostLikeCount.ts similarity index 100% rename from services/BeerPostLike/getBeerPostLikeCount.ts rename to src/services/BeerPostLike/getBeerPostLikeCount.ts diff --git a/services/BeerPostLike/removeBeerPostLikeById.ts b/src/services/BeerPostLike/removeBeerPostLikeById.ts similarity index 100% rename from services/BeerPostLike/removeBeerPostLikeById.ts rename to src/services/BeerPostLike/removeBeerPostLikeById.ts diff --git a/services/BreweryPost/getAllBreweryPosts.ts b/src/services/BreweryPost/getAllBreweryPosts.ts similarity index 100% rename from services/BreweryPost/getAllBreweryPosts.ts rename to src/services/BreweryPost/getAllBreweryPosts.ts diff --git a/services/BreweryPost/getBreweryPostById.ts b/src/services/BreweryPost/getBreweryPostById.ts similarity index 100% rename from services/BreweryPost/getBreweryPostById.ts rename to src/services/BreweryPost/getBreweryPostById.ts diff --git a/services/BreweryPost/types/BreweryPostQueryResult.ts b/src/services/BreweryPost/types/BreweryPostQueryResult.ts similarity index 100% rename from services/BreweryPost/types/BreweryPostQueryResult.ts rename to src/services/BreweryPost/types/BreweryPostQueryResult.ts diff --git a/services/User/createNewUser.ts b/src/services/User/createNewUser.ts similarity index 100% rename from services/User/createNewUser.ts rename to src/services/User/createNewUser.ts diff --git a/services/User/findUserByEmail.ts b/src/services/User/findUserByEmail.ts similarity index 100% rename from services/User/findUserByEmail.ts rename to src/services/User/findUserByEmail.ts diff --git a/services/User/findUserById.ts b/src/services/User/findUserById.ts similarity index 100% rename from services/User/findUserById.ts rename to src/services/User/findUserById.ts diff --git a/services/User/findUserByUsername.ts b/src/services/User/findUserByUsername.ts similarity index 100% rename from services/User/findUserByUsername.ts rename to src/services/User/findUserByUsername.ts diff --git a/services/User/schema/CreateUserValidationSchema.ts b/src/services/User/schema/CreateUserValidationSchema.ts similarity index 100% rename from services/User/schema/CreateUserValidationSchema.ts rename to src/services/User/schema/CreateUserValidationSchema.ts diff --git a/services/User/schema/GetUserSchema.ts b/src/services/User/schema/GetUserSchema.ts similarity index 100% rename from services/User/schema/GetUserSchema.ts rename to src/services/User/schema/GetUserSchema.ts diff --git a/services/User/schema/LoginValidationSchema.ts b/src/services/User/schema/LoginValidationSchema.ts similarity index 100% rename from services/User/schema/LoginValidationSchema.ts rename to src/services/User/schema/LoginValidationSchema.ts diff --git a/services/User/sendConfirmationEmail.ts b/src/services/User/sendConfirmationEmail.ts similarity index 100% rename from services/User/sendConfirmationEmail.ts rename to src/services/User/sendConfirmationEmail.ts diff --git a/services/User/updateUserToBeConfirmedById.ts b/src/services/User/updateUserToBeConfirmedById.ts similarity index 100% rename from services/User/updateUserToBeConfirmedById.ts rename to src/services/User/updateUserToBeConfirmedById.ts diff --git a/styles/globals.css b/src/styles/globals.css similarity index 100% rename from styles/globals.css rename to src/styles/globals.css diff --git a/validation/APIResponseValidationSchema.ts b/src/validation/APIResponseValidationSchema.ts similarity index 100% rename from validation/APIResponseValidationSchema.ts rename to src/validation/APIResponseValidationSchema.ts diff --git a/tailwind.config.js b/tailwind.config.js index ae86c8a..d797873 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -40,8 +40,7 @@ const pastelTheme = { /** @type {import('tailwindcss').Config} */ module.exports = { content: [ - './pages/**/*.{js,ts,jsx,tsx}', - './components/**/*.{js,ts,jsx,tsx}', + './src/**/*.{js,ts,jsx,tsx}', 'node_modules/daisyui/dist/**/*.js', 'node_modules/react-daisyui/dist/**/*.js', ], diff --git a/tsconfig.json b/tsconfig.json index ff7df8d..5596200 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,7 @@ "incremental": true, "baseUrl": ".", "paths": { - "@/*": ["./*"] + "@/*": ["./src/*"] } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],