Skip to content

Commit

Permalink
update: create getNotificationAndUser query, update orgId page layout…
Browse files Browse the repository at this point in the history
… and menu option.
  • Loading branch information
yashdev9274 committed May 20, 2024
1 parent 7b647e6 commit 08e9ef1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/app/(main)/agency/[agencyId]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Unauthorized from '@/components/unauthorized'
import { verifyAndAcceptInvitation } from '@/lib/queries'
import { currentUser } from '@clerk/nextjs'
import { redirect } from "next/navigation"
Expand Down Expand Up @@ -25,11 +26,11 @@ const layout = async ({ children, params }: Props) => {
user.privateMetadata.role !== 'AGENCY_OWNER' &&
user.privateMetadata.role !== 'AGENCY_ADMIN'
)
// return <Unauthorized />
return <Unauthorized />

return (
<div>layout</div>
)
return (
<div>layout</div>
)
}

export default layout;
2 changes: 2 additions & 0 deletions src/components/sidebar/menu-options.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client"

import React from 'react'
import {
Agency,
Expand Down
15 changes: 15 additions & 0 deletions src/lib/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,19 @@ export const upsertAgency = async (agency: Agency, price?: Plan) => {
} catch (error) {
console.log(error)
}
}

export const getNotificationAndUser = async (agencyId: string) => {
try {
const response = await db.notification.findMany({
where: { agencyId },
include: { User: true },
orderBy: {
createdAt: 'desc'
}
})
return response
} catch (error) {
console.log(error)
}
}

0 comments on commit 08e9ef1

Please sign in to comment.