Chris Bitoy
12/20/2021, 3:05 PM//Error:
// 71 const template = await prisma.template.create({
// data: {
// objective: {
// create: undefined
// },
// creative: {
// create: {
// + brandName: String,
// + brandLogo: String,
// + headerImage: String,
// ? creative_format?: String,
// + projectName: String,
// + creativeUrl: String,
// + thumbnailUrl: String,
// ? minimum_secs?: Int,
// ? owner_id?: String,
// ? campaign_id?: String,
// ? parent_c_id?: String,
// ? createdAt?: DateTime,
// ? updatedAt?: DateTime,
// ? Campaign?: {
// ? create?: CampaignCreateWithoutCreativeInput | CampaignUncheckedCreateWithoutCreativeInput,
// ? connectOrCreate?: CampaignCreateOrConnectWithoutCreativeInput,
// ? connect?: CampaignWhereUniqueInput
// ? }
// }
// }
// },
// include: {
// objective: true,
// creative: true
// }
// })
// Argument brandLogo for data.creative.create.brandLogo is missing.
// Argument brandName for data.creative.create.brandName is missing.
// Argument projectName for data.creative.create.projectName is missing.
// Argument headerImage for data.creative.create.headerImage is missing.
// Argument creativeUrl for data.creative.create.creativeUrl is missing.
// Argument thumbnailUrl for data.creative.create.thumbnailUrl is missing.
// Note: Lines with + are required, lines with ? are optional.
I don’t want to flood this channel with copy/paste All the codes, but please find the schema model, routes, and test data
here on Codesandbox: https://codesandbox.io/s/crimson-pine-ipdd5?file=/src/schema.prismanikolasburk
// Argument brandLogo for data.creative.create.brandLogo is missing.
// Argument brandName for data.creative.create.brandName is missing.
// Argument projectName for data.creative.create.projectName is missing.
// Argument headerImage for data.creative.create.headerImage is missing.
// Argument creativeUrl for data.creative.create.creativeUrl is missing.
// Argument thumbnailUrl for data.creative.create.thumbnailUrl is missing.
Are you doing this currently? Can you share the sample data you’re using for the POST
request?Chris Bitoy
12/20/2021, 3:26 PM//postRoute
<http://router.post|router.post>("/templates", async (req, res) => {
const {
description, //From objective table
brandName,
brandLogo,
headerImage,
creative_format
} = req.body.data;
try {
const template = await prisma.template.create({
data: {
objective: {
create: description
},
creative: {
create: {
brandName,
brandLogo,
headerImage,
creative_format
}
}
},
include: {
objective: true,
creative: true
}
});
res.status(200).json({ data: template, error: "", status: 200 });
} catch (error) {
console.log(error);
res.status(500).json({ data: {}, error: error, status: 500 });
}
});
//Test data
{
"data": {
"objective": {
"description": "This is a test desc for obj"
},
"creative": {
"brandName": "This is a test brandname",
"brandLogo": "<http://www.testurl333.com/jpg|www.testurl333.com/jpg>",
"headerImage": "<http://www.testurl.com/jpg|www.testurl.com/jpg>",
"projectName": "TestProject",
"creative_format": "<http://www.testurl.com|www.testurl.com>",
"creativeUrl": "This is a test creativeURL",
"thumbnailUrl": "<http://www.testurl.com|www.testurl.com>",
"minimum_secs": 2
}
}
}
Chris Bitoy
12/20/2021, 10:13 PM