Spaces:
Runtime error
Runtime error
File size: 945 Bytes
7bb5991 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | "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;
}
|