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
2 changes: 1 addition & 1 deletion components/layout/SidebarLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const SidebarLogo = () => {
hover:bg-opacity-10
cursor-pointer
">
<PiSpiralFill size={35} color="white" />
<PiSpiralFill size={31} color="white" />
</div>
);
};
Expand Down
1 change: 0 additions & 1 deletion pages/api/users/[userId].ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { NextApiRequest, NextApiResponse } from "next";

import prisma from '@/libs/prismadb';

export default async function handler(req: NextApiRequest, res: NextApiResponse) {
Expand Down
46 changes: 23 additions & 23 deletions pages/notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ import { getSession } from "next-auth/react";

//adding protecion so that no one can tamper the url and enter the app without login
export async function getServerSideProps(context: NextPageContext) {
const session = await getSession(context);

if (!session) {
return {
redirect: {
destination: '/',
permanent: false,
}
}
}

const session = await getSession(context);

if (!session) {
return {
props: {
session
redirect: {
destination: '/',
permanent: false,
}
}
}

const Notifications = () => {
return (
<>
<Header showBackArrow label="Notifications" />
<NotificationsFeed />
</>
);

return {
props: {
session
}
}

export default Notifications;
}

const Notifications = () => {
return (
<>
<Header showBackArrow label="Notifications" />
<NotificationsFeed />
</>
);
}

export default Notifications;
46 changes: 23 additions & 23 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ datasource db {
}

model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
id String @id @default(auto()) @map("_id") @db.ObjectId
name String?
username String? @unique
bio String?
Expand All @@ -21,9 +21,9 @@ model User {
coverImage String?
profileImage String?
hashedPassword String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
followingIds String[] @db.ObjectId
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
followingIds String[] @db.ObjectId
hasNotification Boolean?

posts Post[]
Expand All @@ -32,36 +32,36 @@ model User {
}

model Post {
id String @id @default(auto()) @map("_id") @db.ObjectId
body String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String @db.ObjectId
likedIds String[] @db.ObjectId
image String?
id String @id @default(auto()) @map("_id") @db.ObjectId
body String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String @db.ObjectId
likedIds String[] @db.ObjectId
image String?

user User @relation(fields: [userId], references: [id], onDelete: Cascade)

comments Comment[]
comments Comment[]
}

model Comment {
id String @id @default(auto()) @map("_id") @db.ObjectId
body String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String @db.ObjectId
postId String @db.ObjectId
id String @id @default(auto()) @map("_id") @db.ObjectId
body String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String @db.ObjectId
postId String @db.ObjectId

user User @relation(fields: [userId], references: [id], onDelete: Cascade)
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
}

model Notification {
id String @id @default(auto()) @map("_id") @db.ObjectId
body String
userId String @db.ObjectId
createdAt DateTime @default(now())
id String @id @default(auto()) @map("_id") @db.ObjectId
body String
userId String @db.ObjectId
createdAt DateTime @default(now())

user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
}