Spaces:
Runtime error
Runtime error
feat: Implement admin management for product requests and affiliate proposals, including new database migrations and expanded dashboard statistics.
7bb5991 | "use server"; | |
| import { db } from "@/lib/db"; | |
| import { | |
| productRequests, | |
| affiliateProposals, | |
| youtubeVideos, | |
| youtubeChannels, | |
| users, | |
| } from "@/lib/db/schema"; | |
| import { eq, desc, and } from "drizzle-orm"; | |
| export async function getAdminRequests() { | |
| const requests = await db.query.productRequests.findMany({ | |
| with: { | |
| video: { | |
| with: { | |
| channel: true | |
| } | |
| }, | |
| creator: true, | |
| }, | |
| orderBy: [desc(productRequests.createdAt)], | |
| }); | |
| return requests; | |
| } | |
| export async function getAdminProposals() { | |
| const proposals = await db.query.affiliateProposals.findMany({ | |
| with: { | |
| video: { | |
| with: { | |
| channel: true | |
| } | |
| }, | |
| creator: true, | |
| }, | |
| orderBy: [desc(affiliateProposals.createdAt)], | |
| }); | |
| return proposals; | |
| } | |