removed final unused folder
This commit is contained in:
parent
8201781015
commit
36b1df4ff4
BIN
Websites/.DS_Store
vendored
BIN
Websites/.DS_Store
vendored
Binary file not shown.
BIN
Websites/UnusedPages/.DS_Store
vendored
BIN
Websites/UnusedPages/.DS_Store
vendored
Binary file not shown.
@ -1,15 +0,0 @@
|
|||||||
"use client";
|
|
||||||
// import React from 'react'
|
|
||||||
|
|
||||||
const AddToCart = () => {
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
{/* <button onClick={() => console.log('Click')}>Add to Cart</button> normal button */}
|
|
||||||
|
|
||||||
{/* Button using DaisyUi */}
|
|
||||||
<button className="btn btn-primary" onClick={() => console.log('Click')}>Add to Cart</button>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export default AddToCart
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
.card {
|
|
||||||
padding: 1rem;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
// import React from 'react';
|
|
||||||
// import AddToCart from '../AddToCart';
|
|
||||||
// // import styles from './ProductCard.module.css';
|
|
||||||
|
|
||||||
// const ProductCard = () => {
|
|
||||||
// return (
|
|
||||||
// // <div className={styles.card}> style using css file
|
|
||||||
|
|
||||||
// // style using tailwind
|
|
||||||
// // <div className='p-5 my-5 bg-sky-400 text-white text-xl hover:bg-sky-600'>
|
|
||||||
// // <AddToCart />
|
|
||||||
// // </div>
|
|
||||||
|
|
||||||
// // style using daisyUi component instead
|
|
||||||
// <div>
|
|
||||||
// <AddToCart />
|
|
||||||
// </div>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default ProductCard
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
import React, { FormEvent } from "react";
|
|
||||||
import { Input } from "@/components/ui/input";
|
|
||||||
import { Button } from "@/components/ui/button";
|
|
||||||
|
|
||||||
export default async function Admin() {
|
|
||||||
const handleSubmit = async (e: FormEvent<HTMLFormElement>) => {
|
|
||||||
e.preventDefault();
|
|
||||||
const formData = new FormData(e.currentTarget);
|
|
||||||
const response = await fetch(`/api/auth/admin`, {
|
|
||||||
method: "POST",
|
|
||||||
body: JSON.stringify({
|
|
||||||
email: formData.get("email"),
|
|
||||||
password: formData.get("password"),
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
console.log({ response });
|
|
||||||
};
|
|
||||||
return (
|
|
||||||
<form
|
|
||||||
onSubmit={handleSubmit}
|
|
||||||
className="flex flex-col gap-2 mx-auto max-w-md mt-20"
|
|
||||||
>
|
|
||||||
<Input type="email" placeholder="email" />
|
|
||||||
<Input type="password" placeholder="password" />
|
|
||||||
<Button className="bg-blue-500 text-white text-lg">Submit</Button>
|
|
||||||
</form>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
BIN
Websites/UnusedPages/api/.DS_Store
vendored
BIN
Websites/UnusedPages/api/.DS_Store
vendored
Binary file not shown.
@ -1,27 +0,0 @@
|
|||||||
// import { NextRequest, NextResponse } from "next/server";
|
|
||||||
// import { z } from 'zod';
|
|
||||||
// import prisma from "@/prisma/client";
|
|
||||||
|
|
||||||
// // validate the request with zod
|
|
||||||
// const createIssueSchema = z.object({
|
|
||||||
// title: z.string().min(1).max(255), // confirms string is between 1-255 characters
|
|
||||||
// description: z.string().min(1), // confirms string has min length of 1
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // send request
|
|
||||||
// export async function POST(request: NextRequest) {
|
|
||||||
// // return request with a promise
|
|
||||||
// const body = await request.json();
|
|
||||||
|
|
||||||
// // validate the data
|
|
||||||
// const validation = createIssueSchema.safeParse(body);
|
|
||||||
// if (!validation.success)
|
|
||||||
// return NextResponse.json(validation.error.errors, {status: 400}) // Send error 400 if data is invalid
|
|
||||||
|
|
||||||
// const newIssue = await prisma.issue.create({
|
|
||||||
// data: { title: body.title, description: body.description }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // return the issue to the client
|
|
||||||
// return NextResponse.json(newIssue, {status: 201}); // status 201 means an object was created
|
|
||||||
// }
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
import NextAuth from "next-auth";
|
|
||||||
import CredentialsProvider from "next-auth/providers/credentials";
|
|
||||||
import { compare } from "bcrypt";
|
|
||||||
import { DrizzleAdapter } from "@auth/drizzle-adapter";
|
|
||||||
import { db, connection } from "@/db/db";
|
|
||||||
import { users } from "@/db/schema";
|
|
||||||
import { eq } from "drizzle-orm";
|
|
||||||
|
|
||||||
|
|
||||||
const handler = NextAuth({
|
|
||||||
// adapter: DrizzleAdapter(db),
|
|
||||||
session: {
|
|
||||||
strategy: "jwt",
|
|
||||||
},
|
|
||||||
providers: [
|
|
||||||
CredentialsProvider({
|
|
||||||
// The name to display on the sign in form (e.g. "Sign in with...")
|
|
||||||
name: "Credentials",
|
|
||||||
// `credentials` is used to generate a form on the sign in page.
|
|
||||||
// You can specify which fields should be submitted, by adding keys to the `credentials` object.
|
|
||||||
// e.g. domain, username, password, 2FA token, etc.
|
|
||||||
// You can pass any HTML attribute to the <input> tag through the object.
|
|
||||||
credentials: {
|
|
||||||
email: {},
|
|
||||||
password: {},
|
|
||||||
},
|
|
||||||
async authorize(credentials, req) {
|
|
||||||
// Check if input email is in the database and return user
|
|
||||||
const response = await db
|
|
||||||
.select()
|
|
||||||
.from(users)
|
|
||||||
.where(eq(users.email, `${credentials?.email}`));
|
|
||||||
|
|
||||||
if (!response) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// compare hashed password with password entered
|
|
||||||
const passwordCheck = await compare(
|
|
||||||
`${credentials?.password}` || "",
|
|
||||||
response[0].password
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log({ passwordCheck });
|
|
||||||
|
|
||||||
if (passwordCheck) {
|
|
||||||
return {
|
|
||||||
id: response[0].id,
|
|
||||||
email: response[0].email,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
export { handler as GET, handler as POST };
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
import "dotenv/config";
|
|
||||||
|
|
||||||
export default async function POST(request: Request) {
|
|
||||||
try {
|
|
||||||
const { email, password } = await request.json();
|
|
||||||
// validate email and password
|
|
||||||
if (email != process.env.ADMIN_EMAIL && password != process.env.ADMIN_PWD) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
console.log({ email, password });
|
|
||||||
} catch (e) {
|
|
||||||
console.log({ e });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
import { hash } from "bcrypt";
|
|
||||||
import "dotenv/config";
|
|
||||||
import { db, connection } from "@/db/db";
|
|
||||||
import { users } from "@/db/schema";
|
|
||||||
import { NextResponse } from "next/server";
|
|
||||||
|
|
||||||
export async function POST(request: Request) {
|
|
||||||
try {
|
|
||||||
const { email, password } = await request.json();
|
|
||||||
// validate email and password(temporarily hard coded)
|
|
||||||
if (
|
|
||||||
email === process.env.ADMIN_EMAIL &&
|
|
||||||
password === process.env.ADMIN_PWD
|
|
||||||
) {
|
|
||||||
console.log({ message: "success!" });
|
|
||||||
console.log({ email, password });
|
|
||||||
}
|
|
||||||
// return if not admin
|
|
||||||
else {
|
|
||||||
console.log({ message: "Incorrect credentials for admin!" });
|
|
||||||
console.log({ email, password });
|
|
||||||
return NextResponse.json({ message: "failed" });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use Bcrypt to hash password
|
|
||||||
const hashedPassword = await hash(password, 10);
|
|
||||||
// console.log({message:'hash is', hashedPassword})
|
|
||||||
|
|
||||||
const response = await db.insert(users).values({
|
|
||||||
id: '1',
|
|
||||||
email: email,
|
|
||||||
password: hashedPassword,
|
|
||||||
});
|
|
||||||
} catch (e) {
|
|
||||||
console.log({ e });
|
|
||||||
}
|
|
||||||
return NextResponse.json({ message: "pass" });
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
// "use client";
|
|
||||||
// import React from "react";
|
|
||||||
// import SimpleMDE from "react-simplemde-editor";
|
|
||||||
// import "easymde/dist/easymde.min.css";
|
|
||||||
// import { useForm, Controller } from "react-hook-form";
|
|
||||||
// import { FormEvent } from "react";
|
|
||||||
|
|
||||||
// interface IssueForm {
|
|
||||||
// title: string;
|
|
||||||
// description: string;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const NewIssuePage = () => {
|
|
||||||
// const { register, control, handleSubmit } = useForm<IssueForm>();
|
|
||||||
// // console.log(register('title'))
|
|
||||||
|
|
||||||
// // handle form submit
|
|
||||||
// async function onSubmit(event: FormEvent<HTMLFormElement>) {
|
|
||||||
// event.preventDefault();
|
|
||||||
|
|
||||||
// const formData = new FormData(event.currentTarget);
|
|
||||||
// const response = await fetch("/api/issues", {
|
|
||||||
// method: "POST",
|
|
||||||
// body: formData,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// // Handle response if necessary
|
|
||||||
// // const data = await response.json();
|
|
||||||
// // ...
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <form
|
|
||||||
// className="max-w-xl"
|
|
||||||
// // onSubmit={handleSubmit((data) => console.log(data))}
|
|
||||||
// onSubmit={onSubmit}
|
|
||||||
// >
|
|
||||||
// <input
|
|
||||||
// type="text"
|
|
||||||
// placeholder="Type Here"
|
|
||||||
// className="input w-full border-zinc-300 mb-2"
|
|
||||||
// {...register("title")}
|
|
||||||
// />
|
|
||||||
// <Controller
|
|
||||||
// name="description"
|
|
||||||
// control={control}
|
|
||||||
// render={({ field }) => (
|
|
||||||
// <SimpleMDE placeholder="Description" {...field}></SimpleMDE>
|
|
||||||
// )}
|
|
||||||
// />
|
|
||||||
// <button className="btn bg-emerald-400 text-black hover:bg-white">
|
|
||||||
// Submit Ticket
|
|
||||||
// </button>
|
|
||||||
// </form>
|
|
||||||
// );
|
|
||||||
// };
|
|
||||||
|
|
||||||
// export default NewIssuePage;
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
// import Link from 'next/link'
|
|
||||||
// import React from 'react'
|
|
||||||
// import type { NextApiRequest, NextApiResponse } from 'next'
|
|
||||||
|
|
||||||
// const IssuesPage = () => {
|
|
||||||
// async function handler(
|
|
||||||
// req: NextApiRequest,
|
|
||||||
// res: NextApiResponse,
|
|
||||||
// ) {
|
|
||||||
// const data = req.body
|
|
||||||
// console.log(...data)
|
|
||||||
// res.redirect(307, '/issues')
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <div>
|
|
||||||
// <button className='btn bg-emerald-400 text-black hover:bg-white'><Link href='/issues/new'>New Ticket</Link></button>
|
|
||||||
// </div>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default IssuesPage
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
// import { PrismaClient } from '@prisma/client'
|
|
||||||
|
|
||||||
// // ensures there is only one instance of prisma at any given moment
|
|
||||||
|
|
||||||
// const prismaClientSingleton = () => {
|
|
||||||
// return new PrismaClient()
|
|
||||||
// }
|
|
||||||
|
|
||||||
// type PrismaClientSingleton = ReturnType<typeof prismaClientSingleton>
|
|
||||||
|
|
||||||
// const globalForPrisma = globalThis as unknown as {
|
|
||||||
// prisma: PrismaClientSingleton | undefined
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const prisma = globalForPrisma.prisma ?? prismaClientSingleton()
|
|
||||||
|
|
||||||
// export default prisma
|
|
||||||
|
|
||||||
// if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
-- CreateTable
|
|
||||||
CREATE TABLE `Issue` (
|
|
||||||
`id` INTEGER NOT NULL AUTO_INCREMENT,
|
|
||||||
`title` VARCHAR(255) NOT NULL,
|
|
||||||
`description` TEXT NOT NULL,
|
|
||||||
`status` ENUM('OPEN', 'IN_PROGRESS', 'CLOSED') NOT NULL DEFAULT 'OPEN',
|
|
||||||
`createdAT` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
|
||||||
`updatedAt` DATETIME(3) NOT NULL,
|
|
||||||
|
|
||||||
PRIMARY KEY (`id`)
|
|
||||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
# Please do not edit this file manually
|
|
||||||
# It should be added in your version-control system (i.e. Git)
|
|
||||||
provider = "mysql"
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
// This is your Prisma schema file,
|
|
||||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
||||||
|
|
||||||
generator client {
|
|
||||||
provider = "prisma-client-js"
|
|
||||||
}
|
|
||||||
|
|
||||||
datasource db {
|
|
||||||
// provider = "postgresql"
|
|
||||||
provider = "mysql"
|
|
||||||
url = env("DATABASE_URL")
|
|
||||||
}
|
|
||||||
|
|
||||||
model Issue {
|
|
||||||
id Int @id @default(autoincrement()) // auto increasing id number for issues
|
|
||||||
title String @db.VarChar(255) // change varchar(variable character limit to 255)
|
|
||||||
description String @db.Text // issue description
|
|
||||||
status Status @default(OPEN) // stating issue is open
|
|
||||||
createdAT DateTime @default(now()) // creation time
|
|
||||||
updatedAt DateTime @updatedAt // updated time
|
|
||||||
}
|
|
||||||
|
|
||||||
// issue status, or ticket status
|
|
||||||
// supported in mysql, but possibly not other db's
|
|
||||||
enum Status {
|
|
||||||
OPEN
|
|
||||||
IN_PROGRESS
|
|
||||||
CLOSED
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
"prisma": {
|
|
||||||
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
|
|
||||||
}
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
// import { PrismaClient } from "@prisma/client";
|
|
||||||
// const prisma = new PrismaClient();
|
|
||||||
// async function main() {
|
|
||||||
// const alice = await prisma.user.upsert({
|
|
||||||
// where: { email: "alice@prisma.io" },
|
|
||||||
// update: {},
|
|
||||||
// create: {
|
|
||||||
// email: "alice@prisma.io",
|
|
||||||
// name: "Alice",
|
|
||||||
// posts: {
|
|
||||||
// create: {
|
|
||||||
// title: "Check out Prisma with Next.js",
|
|
||||||
// content: "https://www.prisma.io/nextjs",
|
|
||||||
// published: true,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// const bob = await prisma.user.upsert({
|
|
||||||
// where: { email: "bob@prisma.io" },
|
|
||||||
// update: {},
|
|
||||||
// create: {
|
|
||||||
// email: "bob@prisma.io",
|
|
||||||
// name: "Bob",
|
|
||||||
// posts: {
|
|
||||||
// create: [
|
|
||||||
// {
|
|
||||||
// title: "Follow Prisma on Twitter",
|
|
||||||
// content: "https://twitter.com/prisma",
|
|
||||||
// published: true,
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// title: "Follow Nexus on Twitter",
|
|
||||||
// content: "https://twitter.com/nexusgql",
|
|
||||||
// published: true,
|
|
||||||
// },
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// });
|
|
||||||
// console.log({ alice, bob });
|
|
||||||
// }
|
|
||||||
// main()
|
|
||||||
// .then(async () => {
|
|
||||||
// await prisma.$disconnect();
|
|
||||||
// })
|
|
||||||
// .catch(async (e) => {
|
|
||||||
// console.error(e);
|
|
||||||
// await prisma.$disconnect();
|
|
||||||
// process.exit(1);
|
|
||||||
// });
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
// import React from 'react'
|
|
||||||
|
|
||||||
// const Nested = () => {
|
|
||||||
// return (
|
|
||||||
// <div>Nested</div>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default Nested
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
// import { userInfo } from 'os';
|
|
||||||
// import React, { useState, useEffect } from 'react'
|
|
||||||
|
|
||||||
// interface User {
|
|
||||||
// id: number;
|
|
||||||
// name: string;
|
|
||||||
// email: string;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// const UsersPage = async () => {
|
|
||||||
// // Get the json file
|
|
||||||
// const res = await fetch(
|
|
||||||
// 'https://jsonplaceholder.typicode.com/users',
|
|
||||||
// // Option to disable caching entirely, useful for data that changes frequently.
|
|
||||||
// {cache: 'no-store'}
|
|
||||||
|
|
||||||
// // Option to store the data within the cache for a certain period of time
|
|
||||||
// // { next: { revalidate: 10 }} // get fresh data every 10 seconds
|
|
||||||
// );
|
|
||||||
// // Create an object that will hold the users within the json file
|
|
||||||
// const users: User[] = await res.json();
|
|
||||||
// // Create a cache in order to hold the data for later(useful for tokens)
|
|
||||||
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <>
|
|
||||||
// <h1>Users</h1>
|
|
||||||
// {/* <p>{new Date().toLocaleTimeString()}</p> */}
|
|
||||||
// {/* instead of an unordered list, we'll use a table
|
|
||||||
// <ul>
|
|
||||||
// {users.map(user => <li key={user.id}>{user.name}</li>)}
|
|
||||||
// </ul> */}
|
|
||||||
// <table className='table table-bordered'>
|
|
||||||
// <thead>
|
|
||||||
// <tr>
|
|
||||||
// <th>Name</th>
|
|
||||||
// <th>Email</th>
|
|
||||||
// </tr>
|
|
||||||
// </thead>
|
|
||||||
// <tbody>
|
|
||||||
// {users.map(user=> <tr key={user.id}>
|
|
||||||
// <td>{user.name}</td>
|
|
||||||
// <td>{user.email}</td>
|
|
||||||
// </tr>)}
|
|
||||||
// </tbody>
|
|
||||||
// </table>
|
|
||||||
// </>
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default UsersPage
|
|
||||||
Loading…
Reference in New Issue
Block a user