C
C#10mo ago
xml

Timeslaps and API Requests error

https://hastebin.skyra.pw/ikihibawiq.csharp https://hastebin.skyra.pw/uvujugukid.py my api model
if (existingActivity) {
const updatedActivity = await prismadb.activity.update({
where: { id: existingActivity.id },
data: {
timeslaps: existingActivity.timeslaps + timeslaps,
updatedAt
}
});
return res.status(200).json(updatedActivity);
} else {
const newActivity = await prismadb.activity.create({
data: {
title,
timeslaps,
isProductive,
createdAt,
updatedAt,
user : {
connect : {
macAddress : macAddress
}
}
}
});
return res.status(200).json(newActivity);
if (existingActivity) {
const updatedActivity = await prismadb.activity.update({
where: { id: existingActivity.id },
data: {
timeslaps: existingActivity.timeslaps + timeslaps,
updatedAt
}
});
return res.status(200).json(updatedActivity);
} else {
const newActivity = await prismadb.activity.create({
data: {
title,
timeslaps,
isProductive,
createdAt,
updatedAt,
user : {
connect : {
macAddress : macAddress
}
}
}
});
return res.status(200).json(newActivity);
model Activity { id String @id @default(auto()) @map("_id") @db.ObjectId title String @unique createdAt String? updatedAt String? timeslaps Float isProductive Boolean macAddress String user Employee @relation(fields: [macAddress], references: [macAddress], onDelete: Cascade) } When I first run the code, the popup window still shows 0 seconds when the request is sent, but the counter I set to test is 3 seconds. Also it gives 400 error when requesting the API, I have written the same code before using python and I am trying to write it in C# but there is a problem, what is the reason?
1 Reply
xml
xmlOP10mo ago
the api error is probably because it can't get the macAddress lol, I need to fix that too
Want results from more Discord servers?
Add your server