diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 4541b6a..ad58b29 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -119,3 +119,5 @@ model Order { user User @relation("UserOrders", fields: [userId], references: [id]) artefacts Artefact[] @relation("OrderArtefacts") } +// todo make user optional for if details aren't saved +// todo add email field to link order to user if created later on diff --git a/src/app/administrator/page.tsx b/src/app/administrator/page.tsx index 1e161e0..49fd4ec 100644 --- a/src/app/administrator/page.tsx +++ b/src/app/administrator/page.tsx @@ -16,8 +16,10 @@ type User = { createdAt: string; }; +// todo add fulfilling of requests // todo create api route to get users, with auth for only admin // todo add management of only junior scientists if senior scientist +// todo (optional) add display of each user's previous orders when selecting them const initialUsers: User[] = [ { email: "john@example.com", name: "John Doe", role: "ADMIN", password: "secret1", createdAt: "2024-06-21T09:15:01Z", id: 1 }, { email: "jane@example.com", name: "Jane Smith", role: "GUEST", password: "secret2", createdAt: "2024-06-21T10:01:09Z", id: 2 }, diff --git a/src/app/api/signup/route.ts b/src/app/api/signup/route.ts index e2d3c4d..a70c466 100644 --- a/src/app/api/signup/route.ts +++ b/src/app/api/signup/route.ts @@ -7,6 +7,8 @@ import { prisma } from "@utils/prisma"; import { findUserByEmail, passwordStrengthCheck, readUserCsv, User, writeUserCsv } from "../functions/csvReadWrite"; +// todo check if orders contain email and link if order previously made with email + export async function POST(req: Request) { try { const { email, password, name } = await req.json(); // Parse incoming JSON data diff --git a/src/app/profile/page.tsx b/src/app/profile/page.tsx index fbe18ce..f8a67c7 100644 --- a/src/app/profile/page.tsx +++ b/src/app/profile/page.tsx @@ -1,12 +1,14 @@ "use client"; -import axios, { AxiosError } from 'axios'; -import { useRouter } from 'next/navigation'; -import { useEffect, useState } from 'react'; -import { FaSignOutAlt } from 'react-icons/fa'; -import { FaUser } from 'react-icons/fa6'; +import axios, { AxiosError } from "axios"; +import { useRouter } from "next/navigation"; +import { useEffect, useState } from "react"; +import { FaSignOutAlt } from "react-icons/fa"; +import { FaUser } from "react-icons/fa6"; -import { User } from '@appTypes/Prisma'; -import { useStoreActions } from '@hooks/store'; +import { User } from "@appTypes/Prisma"; +import { useStoreActions } from "@hooks/store"; + +// todo add previous orders list export default function Profile() { const router = useRouter(); diff --git a/src/app/shop/page.tsx b/src/app/shop/page.tsx index 09dee39..3f768e8 100644 --- a/src/app/shop/page.tsx +++ b/src/app/shop/page.tsx @@ -181,7 +181,8 @@ export default function Shop() { } // todo create receiving api route // todo handle sending to api route - // todo add option to save details in new account + // todo only ask for email if the user is not signed in + // todo (optional) add create account button to auto-fill email in sign-up modal const genOrder = () => "#" + Math.random().toString(36).substring(2, 10).toUpperCase(); setOrderNumber(genOrder()); onClose();