Skip to content

Commit

Permalink
Merge pull request #1066 from amanbairagi30/github-link
Browse files Browse the repository at this point in the history
feat : Adds Github Link , makes code modular , improves  payout UI significantly
  • Loading branch information
hkirat authored Aug 30, 2024
2 parents 390d08c + 60f67d7 commit a999161
Show file tree
Hide file tree
Showing 16 changed files with 731 additions and 292 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ CACHE_EXPIRE_S = 10
ADMINS = "Random,[email protected]"
NEXT_PUBLIC_DISABLE_FEATURES = "featurea,featureb,featurec"
REDIS_URL=
GITHUB_ID=
GITHUB_SECRET=


COHORT3_DISCORD_ACCESS_KEY =
Expand Down
10 changes: 10 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'avatars.githubusercontent.com',
port: '',
pathname: '/**',
},
],
},
experimental: {
serverActions: {
allowedOrigins: ['localhost:3000', 'app.100xdevs.com', 'app2.100xdevs.com']
Expand Down
20 changes: 20 additions & 0 deletions prisma/migrations/20240828061415_add_github_link/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- CreateTable
CREATE TABLE "GitHubLink" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"githubId" TEXT NOT NULL,
"username" TEXT NOT NULL,
"avatarUrl" TEXT,
"access_token" TEXT NOT NULL,
"profileUrl" TEXT,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,

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

-- CreateIndex
CREATE UNIQUE INDEX "GitHubLink_userId_key" ON "GitHubLink"("userId");

-- AddForeignKey
ALTER TABLE "GitHubLink" ADD CONSTRAINT "GitHubLink_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
260 changes: 138 additions & 122 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ model Course {
content CourseContent[]
purchasedBy UserPurchases[]
certificate Certificate[]
certIssued Boolean @default(false)
certIssued Boolean @default(false)
}

model UserPurchases {
Expand Down Expand Up @@ -65,12 +65,12 @@ model CourseContent {
}

model Certificate {
id String @id @default(cuid())
slug String @default("certId")
user User @relation(fields: [userId], references: [id])
userId String
course Course @relation(fields: [courseId], references: [id])
courseId Int
id String @id @default(cuid())
slug String @default("certId")
user User @relation(fields: [userId], references: [id])
userId String
course Course @relation(fields: [courseId], references: [id])
courseId Int
@@unique([userId, courseId])
}
Expand All @@ -85,40 +85,40 @@ model NotionMetadata {
}

model VideoMetadata {
id Int @id @default(autoincrement())
contentId Int
video_1080p_mp4_1 String? // Link to 1080p mp4 quality video variant 1
video_1080p_mp4_2 String? // Link to 1080p mp4 quality video variant 2
video_1080p_mp4_3 String? // Link to 1080p mp4 quality video variant 3
video_1080p_mp4_4 String? // Link to 1080p mp4 quality video variant 4
video_1080p_1 String? // Link to 1080p quality video variant 1
video_1080p_2 String? // Link to 1080p quality video variant 2
video_1080p_3 String? // Link to 1080p quality video variant 3
video_1080p_4 String? // Link to 1080p quality video variant 4
video_720p_mp4_1 String? // Link to 720p mp4 quality video variant 1
video_720p_mp4_2 String? // Link to 720p mp4 quality video variant 2
video_720p_mp4_3 String? // Link to 720p mp4 quality video variant 3
video_720p_mp4_4 String? // Link to 720p mp4 quality video variant 4
video_720p_1 String? // Link to 720p quality video variant 1
video_720p_2 String? // Link to 720p quality video variant 2
video_720p_3 String? // Link to 720p quality video variant 3
video_720p_4 String? // Link to 720p quality video variant 4
video_360p_mp4_1 String? // Link to 360p mp4 quality video variant 1
video_360p_mp4_2 String? // Link to 360p mp4 quality video variant 2
video_360p_mp4_3 String? // Link to 360p mp4 quality video variant 3
video_360p_mp4_4 String? // Link to 360p mp4 quality video variant 4
video_360p_1 String? // Link to 360p quality video variant 1
video_360p_2 String? // Link to 360p quality video variant 2
video_360p_3 String? // Link to 360p quality video variant 3
video_360p_4 String? // Link to 360p quality video variant 4
subtitles String? // Link to subtitles file
segments Json?
content Content @relation(fields: [contentId], references: [id])
slides String? // link to slides
thumbnail_mosiac_url String?
duration Int?
migration_status MigrationStatus @default(NOT_MIGRATED)
migration_pickup_time DateTime?
id Int @id @default(autoincrement())
contentId Int
video_1080p_mp4_1 String? // Link to 1080p mp4 quality video variant 1
video_1080p_mp4_2 String? // Link to 1080p mp4 quality video variant 2
video_1080p_mp4_3 String? // Link to 1080p mp4 quality video variant 3
video_1080p_mp4_4 String? // Link to 1080p mp4 quality video variant 4
video_1080p_1 String? // Link to 1080p quality video variant 1
video_1080p_2 String? // Link to 1080p quality video variant 2
video_1080p_3 String? // Link to 1080p quality video variant 3
video_1080p_4 String? // Link to 1080p quality video variant 4
video_720p_mp4_1 String? // Link to 720p mp4 quality video variant 1
video_720p_mp4_2 String? // Link to 720p mp4 quality video variant 2
video_720p_mp4_3 String? // Link to 720p mp4 quality video variant 3
video_720p_mp4_4 String? // Link to 720p mp4 quality video variant 4
video_720p_1 String? // Link to 720p quality video variant 1
video_720p_2 String? // Link to 720p quality video variant 2
video_720p_3 String? // Link to 720p quality video variant 3
video_720p_4 String? // Link to 720p quality video variant 4
video_360p_mp4_1 String? // Link to 360p mp4 quality video variant 1
video_360p_mp4_2 String? // Link to 360p mp4 quality video variant 2
video_360p_mp4_3 String? // Link to 360p mp4 quality video variant 3
video_360p_mp4_4 String? // Link to 360p mp4 quality video variant 4
video_360p_1 String? // Link to 360p quality video variant 1
video_360p_2 String? // Link to 360p quality video variant 2
video_360p_3 String? // Link to 360p quality video variant 3
video_360p_4 String? // Link to 360p quality video variant 4
subtitles String? // Link to subtitles file
segments Json?
content Content @relation(fields: [contentId], references: [id])
slides String? // link to slides
thumbnail_mosiac_url String?
duration Int?
migration_status MigrationStatus @default(NOT_MIGRATED)
migration_pickup_time DateTime?
migrated_video_1080p_mp4_1 String?
migrated_video_360p_mp4_1 String?
migrated_video_720p_mp4_1 String?
Expand All @@ -135,43 +135,57 @@ model Session {
}

model User {
id String @id @default(cuid())
name String?
email String? @unique
token String?
sessions Session[]
purchases UserPurchases[]
videoProgress VideoProgress[]
comments Comment[]
votes Vote[]
discordConnect DiscordConnect?
disableDrm Boolean @default(false)
bunnyProxyEnabled Boolean @default(false)
bookmarks Bookmark[]
password String?
appxUserId String?
appxUsername String?
questions Question[]
answers Answer[]
certificate Certificate[]
upiIds UpiId[] @relation("UserUpiIds")
solanaAddresses SolanaAddress[] @relation("UserSolanaAddresses")
id String @id @default(cuid())
name String?
email String? @unique
token String?
sessions Session[]
purchases UserPurchases[]
videoProgress VideoProgress[]
comments Comment[]
votes Vote[]
discordConnect DiscordConnect?
disableDrm Boolean @default(false)
bunnyProxyEnabled Boolean @default(false)
bookmarks Bookmark[]
password String?
appxUserId String?
appxUsername String?
questions Question[]
answers Answer[]
certificate Certificate[]
upiIds UpiId[] @relation("UserUpiIds")
solanaAddresses SolanaAddress[] @relation("UserSolanaAddresses")
githubUser GitHubLink? @relation("UserGithub")
}

model GitHubLink {
id String @id @default(cuid())
userId String @unique
user User @relation("UserGithub", fields: [userId], references: [id], onDelete: Cascade)
githubId String
username String
avatarUrl String?
access_token String
profileUrl String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model UpiId {
id Int @id @default(autoincrement())
value String @db.VarChar(256)
userId String
user User @relation("UserUpiIds", fields: [userId], references: [id])
id Int @id @default(autoincrement())
value String @db.VarChar(256)
userId String
user User @relation("UserUpiIds", fields: [userId], references: [id])
@@unique([userId, value])
}

model SolanaAddress {
id Int @id @default(autoincrement())
value String @db.Char(44)
userId String
user User @relation("UserSolanaAddresses", fields: [userId], references: [id])
id Int @id @default(autoincrement())
value String @db.Char(44)
userId String
user User @relation("UserSolanaAddresses", fields: [userId], references: [id])
@@unique([userId, value])
}
Expand Down Expand Up @@ -234,90 +248,92 @@ model Comment {
votes Vote[]
isPinned Boolean @default(false)
}

model Question {
id Int @id @default(autoincrement())
title String
content String
slug String @unique
createdAt DateTime @default(now())
author User @relation(fields: [authorId], references: [id])
authorId String
upvotes Int @default(0)
downvotes Int @default(0)
id Int @id @default(autoincrement())
title String
content String
slug String @unique
createdAt DateTime @default(now())
author User @relation(fields: [authorId], references: [id])
authorId String
upvotes Int @default(0)
downvotes Int @default(0)
totalanswers Int @default(0)
answers Answer[]
votes Vote[]
tags String[]
updatedAt DateTime @updatedAt
answers Answer[]
votes Vote[]
tags String[]
updatedAt DateTime @updatedAt
@@index([authorId])
}

model Answer {
id Int @id @default(autoincrement())
content String
createdAt DateTime @default(now())
question Question @relation(fields: [questionId], references: [id])
questionId Int
author User @relation(fields: [authorId], references: [id])
authorId String
votes Vote[]
upvotes Int @default(0)
downvotes Int @default(0)
totalanswers Int @default(0)
parentId Int?
responses Answer[] @relation("AnswerToAnswer")
parent Answer? @relation("AnswerToAnswer", fields: [parentId], references: [id])
updatedAt DateTime @updatedAt
id Int @id @default(autoincrement())
content String
createdAt DateTime @default(now())
question Question @relation(fields: [questionId], references: [id])
questionId Int
author User @relation(fields: [authorId], references: [id])
authorId String
votes Vote[]
upvotes Int @default(0)
downvotes Int @default(0)
totalanswers Int @default(0)
parentId Int?
responses Answer[] @relation("AnswerToAnswer")
parent Answer? @relation("AnswerToAnswer", fields: [parentId], references: [id])
updatedAt DateTime @updatedAt
@@index([questionId])
@@index([authorId])
@@index([parentId])
}


model Vote {
id Int @id @default(autoincrement())
questionId Int?
question Question? @relation(fields: [questionId], references: [id])
answerId Int?
answer Answer? @relation(fields: [answerId], references: [id])
commentId Int?
comment Comment? @relation(fields: [commentId], references: [id])
userId String
user User @relation(fields: [userId], references: [id])
voteType VoteType
createdAt DateTime @default(now())
id Int @id @default(autoincrement())
questionId Int?
question Question? @relation(fields: [questionId], references: [id])
answerId Int?
answer Answer? @relation(fields: [answerId], references: [id])
commentId Int?
comment Comment? @relation(fields: [commentId], references: [id])
userId String
user User @relation(fields: [userId], references: [id])
voteType VoteType
createdAt DateTime @default(now())
@@unique([questionId, userId])
@@unique([answerId, userId])
@@unique([commentId, userId])
@@unique([questionId, userId])
@@unique([answerId, userId])
@@unique([commentId, userId])
}

model Event {
id Int @id @default(autoincrement())
title String
start DateTime
end DateTime
videoLink String?
notes String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
id Int @id @default(autoincrement())
title String
start DateTime
end DateTime
videoLink String?
notes String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}


enum VoteType {
UPVOTE
DOWNVOTE
}

enum PostType {
QUESTION
ANSWER
}

enum CommentType {
INTRO
DEFAULT
}

enum MigrationStatus {
NOT_MIGRATED
IN_PROGRESS
Expand Down
1 change: 1 addition & 0 deletions public/platform/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a999161

Please sign in to comment.