Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ const nextConfig = {
protocol: "https",
hostname: "lh3.googleusercontent.com",
},
{
protocol: "https",
hostname: "utfs.io",
},
],
},
};
Expand Down
1,617 changes: 1,570 additions & 47 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"production:build": "npx prisma generate && npx prisma migrate deploy && next build"
},
"dependencies": {
"@ant-design/icons": "^5.4.0",
"@auth/prisma-adapter": "^1.0.1",
"@next-auth/prisma-adapter": "^0.4.4-canary.81",
"@prisma/client": "^5.2.0",
Expand All @@ -24,9 +25,11 @@
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-tooltip": "^1.1.2",
"@types/node": "20.5.7",
"@types/react": "18.2.21",
"@types/react-dom": "18.2.7",
"@uploadthing/react": "^6.7.2",
"autoprefixer": "10.4.15",
"axios": "^1.5.0",
"class-variance-authority": "^0.7.0",
Expand All @@ -36,7 +39,9 @@
"formik": "^2.4.5",
"framer-motion": "^11.0.28",
"lucide-react": "^0.367.0",
"moment": "^2.30.1",
"mongoose": "^8.3.0",
"multiselect-react-dropdown": "^2.0.25",
"next": "13.4.19",
"next-auth": "^4.23.1",
"next-themes": "^0.3.0",
Expand All @@ -45,12 +50,16 @@
"razorpay": "^2.9.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-player": "^2.16.0",
"react-resizable-panels": "^2.0.22",
"react-simple-star-rating": "^5.1.7",
"sonner": "^1.4.41",
"tailwind-merge": "^2.2.2",
"tailwindcss": "3.3.3",
"tailwindcss-animate": "^1.0.7",
"typescript": "5.2.2",
"zod": "^3.22.4"
"uploadthing": "^6.13.2",
"zod": "^3.23.8"
},
"devDependencies": {
"dotenv-cli": "^7.3.0",
Expand Down
80 changes: 80 additions & 0 deletions prisma/migrations/20240730110007_rework_on_the_app/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
Warnings:

- You are about to drop the column `gh_app_access_token` on the `Account` table. All the data in the column will be lost.
- You are about to drop the column `gh_app_access_token_expires_at` on the `Account` table. All the data in the column will be lost.
- You are about to drop the column `gh_app_refresh_token` on the `Account` table. All the data in the column will be lost.
- You are about to drop the column `gh_app_refresh_token_expires_at` on the `Account` table. All the data in the column will be lost.
- You are about to drop the column `cost` on the `Repo` table. All the data in the column will be lost.
- You are about to drop the column `description` on the `Repo` table. All the data in the column will be lost.
- You are about to drop the `Post` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `_RequestRepo` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `_StudentRepo` table. If the table is not empty, all the data it contains will be lost.

*/
-- DropForeignKey
ALTER TABLE "Post" DROP CONSTRAINT "Post_authorId_fkey";

-- DropForeignKey
ALTER TABLE "_RequestRepo" DROP CONSTRAINT "_RequestRepo_A_fkey";

-- DropForeignKey
ALTER TABLE "_RequestRepo" DROP CONSTRAINT "_RequestRepo_B_fkey";

-- DropForeignKey
ALTER TABLE "_StudentRepo" DROP CONSTRAINT "_StudentRepo_A_fkey";

-- DropForeignKey
ALTER TABLE "_StudentRepo" DROP CONSTRAINT "_StudentRepo_B_fkey";

-- AlterTable
ALTER TABLE "Account" DROP COLUMN "gh_app_access_token",
DROP COLUMN "gh_app_access_token_expires_at",
DROP COLUMN "gh_app_refresh_token",
DROP COLUMN "gh_app_refresh_token_expires_at";

-- AlterTable
ALTER TABLE "Repo" DROP COLUMN "cost",
DROP COLUMN "description";

-- DropTable
DROP TABLE "Post";

-- DropTable
DROP TABLE "_RequestRepo";

-- DropTable
DROP TABLE "_StudentRepo";

-- CreateTable
CREATE TABLE "RepoMetadata" (
"id" TEXT NOT NULL,
"repoId" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT NOT NULL,
"thumbnail" TEXT NOT NULL,
"videoUrl" TEXT,
"cost" INTEGER NOT NULL DEFAULT 10000,

CONSTRAINT "RepoMetadata_pkey" PRIMARY KEY ("id")
);

-- CreateTable
CREATE TABLE "section" (
"id" TEXT NOT NULL,
"title" TEXT NOT NULL,
"description" TEXT,
"url" TEXT NOT NULL,
"repoId" TEXT NOT NULL,

CONSTRAINT "section_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE UNIQUE INDEX "RepoMetadata_repoId_key" ON "RepoMetadata"("repoId");

-- AddForeignKey
ALTER TABLE "RepoMetadata" ADD CONSTRAINT "RepoMetadata_repoId_fkey" FOREIGN KEY ("repoId") REFERENCES "Repo"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "section" ADD CONSTRAINT "section_repoId_fkey" FOREIGN KEY ("repoId") REFERENCES "RepoMetadata"("repoId") ON DELETE CASCADE ON UPDATE CASCADE;
24 changes: 24 additions & 0 deletions prisma/migrations/20240804180909_add_some_more_feats/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- AlterTable
ALTER TABLE "RepoMetadata" ADD COLUMN "tags" TEXT[];

-- AlterTable
ALTER TABLE "section" ADD COLUMN "sectionNotesUrl" TEXT;

-- CreateTable
CREATE TABLE "Rating" (
"id" TEXT NOT NULL,
"rating" INTEGER NOT NULL,
"review" TEXT,
"userId" TEXT NOT NULL,
"repoMetadataId" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

CONSTRAINT "Rating_pkey" PRIMARY KEY ("id")
);

-- AddForeignKey
ALTER TABLE "Rating" ADD CONSTRAINT "Rating_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

-- AddForeignKey
ALTER TABLE "Rating" ADD CONSTRAINT "Rating_repoMetadataId_fkey" FOREIGN KEY ("repoMetadataId") REFERENCES "RepoMetadata"("id") ON DELETE CASCADE ON UPDATE CASCADE;
66 changes: 42 additions & 24 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,14 @@

generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextSearch"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model Post {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
content String? @db.Text
authorId String
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
}

enum Role {
USER
CREATOR
Expand All @@ -28,7 +19,7 @@ model Post {

model Account {
id String @id @default(cuid())
userId String
userId String
type String
provider String
providerAccountId String
Expand All @@ -39,10 +30,6 @@ model Account {
scope String?
id_token String? @db.Text
session_state String?
gh_app_access_token String? @db.Text
gh_app_refresh_token String? @db.Text
gh_app_access_token_expires_at DateTime?
gh_app_refresh_token_expires_at DateTime?
gh_installation_ids String[]
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
Expand All @@ -64,14 +51,12 @@ model User {
image String?
accounts Account[]
sessions Session[]
posts Post[]
role Role @default(USER)
uploadedRepos Repo[]
paymentGatewayAccountId String?
paymentGatewayAccountOnBoarded Boolean @default(false)
learningRepos Repo[] @relation("StudentRepo")
requestedRepos Repo[] @relation("RequestRepo")
buys Buyer[]
buys Buyer[]
ratings Rating[]
}

model VerificationToken {
Expand All @@ -87,12 +72,9 @@ model Repo {
url String
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
ownerId String
students User[] @relation("StudentRepo")
requesters User[] @relation("RequestRepo")
repoOrg String?
buyers Buyer[]
cost Int @default(0)
description String @default("Example Repo")
metadata RepoMetadata?
}

model Buyer {
Expand All @@ -104,7 +86,7 @@ model Buyer {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
orderId String?
order Order?
order Order?
}

model Order {
Expand All @@ -131,3 +113,39 @@ model Payment {
updatedAt DateTime @updatedAt
order Order @relation(fields: [orderId], references: [id], onDelete: Cascade)
}

model Rating {
id String @id @default(cuid())
rating Int
review String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String
repoMetadata RepoMetadata @relation(fields: [repoMetadataId], references: [id], onDelete: Cascade)
repoMetadataId String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model RepoMetadata {
id String @id @default(cuid())
repoId String @unique
repo Repo @relation(fields: [repoId], references: [id], onDelete: Cascade)
title String
description String
thumbnail String
videoUrl String?
cost Int @default(10000)
sections section[]
ratings Rating[]
tags String[]
}

model section {
id String @id @default(cuid())
title String
description String?
url String
repo RepoMetadata @relation(fields: [repoId], references: [repoId], onDelete: Cascade)
repoId String
sectionNotesUrl String?
}
Binary file added public/images/buyer.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/hero.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/seller.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 0 additions & 36 deletions src/app/addrepo/page.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/api/auth/[...nextauth]/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,9 @@ import { PrismaAdapter } from "@auth/prisma-adapter";
import { NextAuthOptions } from "next-auth";
import { Adapter } from "next-auth/adapters";
import Github from "next-auth/providers/github";
import GoogleProvider from "next-auth/providers/google";

export const options1: NextAuthOptions = {
providers: [
GoogleProvider({
clientId: process.env.GOOGLE_ID ?? "",
clientSecret: process.env.GOOGLE_SECRET ?? "",
}),
Github({
clientId: process.env.GITHUB_ID ?? "",
clientSecret: process.env.GITHUB_SECRET ?? "",
Expand Down
Loading