Initial Paprika Next.js implementation
This commit is contained in:
26
lib/submissions.ts
Normal file
26
lib/submissions.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { prisma } from "@/lib/db";
|
||||
import type { SubmissionInput } from "@/lib/submission-schema";
|
||||
|
||||
export async function createSubmission(input: SubmissionInput) {
|
||||
return prisma.submission.create({
|
||||
data: {
|
||||
type: input.type,
|
||||
name: input.name,
|
||||
email: input.email,
|
||||
linkedin: input.linkedin,
|
||||
companyWebsite: input.type === "start" ? input.companyWebsite : undefined,
|
||||
currentRoleCompany: input.type === "start" ? input.currentRoleCompany : undefined,
|
||||
fieldOrIndustry: input.type === "start" ? input.fieldOrIndustry : undefined,
|
||||
reason: input.type === "start" ? input.reason : undefined,
|
||||
existingRecognition: input.type === "start" ? input.existingRecognition : undefined,
|
||||
timeline: input.type === "start" ? input.timeline : undefined,
|
||||
question: input.type === "ask" ? input.question : undefined,
|
||||
consentAccepted: input.consentAccepted,
|
||||
sourcePath: input.sourcePath
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user