From f1c365015891b561886b746b46ce309b61a409ca Mon Sep 17 00:00:00 2001 From: RoshanKarthikRajesh Date: Tue, 2 Jul 2024 13:20:48 -0400 Subject: [PATCH 1/3] Added userId and organizationId fields to Tasks table. --- amplify/data/resource.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/amplify/data/resource.ts b/amplify/data/resource.ts index c73ee18..44cea53 100644 --- a/amplify/data/resource.ts +++ b/amplify/data/resource.ts @@ -26,6 +26,7 @@ const schema = a.schema({ organization: a.belongsTo("Organization", "organizationId"), courses: a.hasMany("Course", "userId"), pathways: a.hasMany("Pathway", "userId"), + tasks: a.hasMany("Tasks", "userId"), }) .authorization((allow) => [allow.guest()]), Course: a @@ -70,6 +71,8 @@ const schema = a.schema({ Tasks: a .model({ TaskId: a.id(), + userId: a.id(), + organizationId: a.id(), title: a.string(), details: a.string(), date: a.date(), From 43e9a912fc41f6d0c06750f02ff9acbc51e3a389 Mon Sep 17 00:00:00 2001 From: RoshanKarthikRajesh Date: Tue, 2 Jul 2024 13:32:02 -0400 Subject: [PATCH 2/3] Added a.belongsto() for organization in the tasks table. --- amplify/data/resource.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/amplify/data/resource.ts b/amplify/data/resource.ts index 44cea53..cc4ed69 100644 --- a/amplify/data/resource.ts +++ b/amplify/data/resource.ts @@ -73,6 +73,7 @@ const schema = a.schema({ TaskId: a.id(), userId: a.id(), organizationId: a.id(), + organization: a.belongsTo("Organization", "organizationId"), title: a.string(), details: a.string(), date: a.date(), From 81b494ae437b35713975dace4b063d2fedd36509 Mon Sep 17 00:00:00 2001 From: RoshanKarthikRajesh Date: Tue, 2 Jul 2024 13:37:14 -0400 Subject: [PATCH 3/3] also added user.belongsTo() --- amplify/data/resource.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/amplify/data/resource.ts b/amplify/data/resource.ts index cc4ed69..84e68e7 100644 --- a/amplify/data/resource.ts +++ b/amplify/data/resource.ts @@ -72,6 +72,7 @@ const schema = a.schema({ .model({ TaskId: a.id(), userId: a.id(), + user: a.belongsTo("User", "userId"), organizationId: a.id(), organization: a.belongsTo("Organization", "organizationId"), title: a.string(),