Fixes bug with updating relationships when an item is added
This commit is contained in:
@@ -46,11 +46,6 @@ function RouteComponent() {
|
||||
sort: "-created",
|
||||
});
|
||||
|
||||
console.log("Previous session: ", {
|
||||
id: prevSession.id,
|
||||
created: prevSession.created,
|
||||
});
|
||||
|
||||
const newSession = await pb.collection("documents").create({
|
||||
campaign: campaign.id,
|
||||
type: "session",
|
||||
@@ -67,12 +62,7 @@ function RouteComponent() {
|
||||
filter: `primary = "${prevSession.id}"`,
|
||||
});
|
||||
|
||||
console.log(`Found ${prevRelations.length} previous relations`);
|
||||
|
||||
for (const relation of prevRelations) {
|
||||
console.log(
|
||||
`Adding ${relation.secondary.length} items to ${relation.type}`,
|
||||
);
|
||||
await pb.collection("relationships").create({
|
||||
primary: newSession.id,
|
||||
type: relation.type,
|
||||
|
||||
Reference in New Issue
Block a user