File tree Expand file tree Collapse file tree 4 files changed +38
-32
lines changed Expand file tree Collapse file tree 4 files changed +38
-32
lines changed Original file line number Diff line number Diff line change @@ -110,34 +110,35 @@ class CanvasHelper {
110
110
. filter ( assignment => typeof assignment . name !== 'undefined' )
111
111
. map ( ( assignment ) =>
112
112
( {
113
- "Assignment Name" : {
114
- type : "title" ,
115
- title : [ {
116
- type : "text" ,
117
- text : { content : assignment . name }
118
- } ]
119
- } ,
120
- "Due Date" : {
121
- type : "date" ,
122
- date : { start : assignment . due_at || '2020-09-10' }
123
- } ,
124
- "Course" : {
125
- select : {
126
- name : courseName
127
- }
128
- } ,
129
- "URL" : {
130
- type : "url" ,
131
- url : assignment . html_url
132
- } ,
133
- "ID" : {
134
- type : "number" ,
135
- number : assignment . id ,
136
- } ,
137
- } ) )
113
+ "Assignment Name" : {
114
+ type : "title" ,
115
+ title : [ {
116
+ type : "text" ,
117
+ text : { content : assignment . name }
118
+ } ]
119
+ } ,
120
+ "Due Date" : {
121
+ type : "date" ,
122
+ date : { start : assignment . due_at || '2020-09-10' }
123
+ } ,
124
+ "Course" : {
125
+ select : {
126
+ name : courseName
127
+ }
128
+ } ,
129
+ "URL" : {
130
+ type : "url" ,
131
+ url : assignment . html_url
132
+ } ,
133
+ "ID" : {
134
+ type : "number" ,
135
+ number : assignment . id ,
136
+ } ,
137
+ }
138
+ ) )
138
139
139
140
// list of assignments for the course
140
- return await assignment_list
141
+ return await assignment_list
141
142
}
142
143
}
143
144
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ const NotionClient = new Client({ auth: NotionHelp.api})
17
17
* If so, update the database, else create a new database.
18
18
*/
19
19
async function checkDatabase ( ) {
20
+ const courses = await CanvasHelp . getCourses ( )
20
21
try {
21
- const courses = await CanvasHelp . getCourses ( )
22
22
const response = await NotionClient . databases . query ( {
23
23
database_id : NotionHelp . database
24
24
} )
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ class NotionHelper {
69
69
70
70
return notion_pages
71
71
} catch ( error ) {
72
- console . log ( `ERROR: () did not run: ${ error } ` )
72
+ console . log ( `ERROR: getNotionPages () did not run: ${ error } ` )
73
73
}
74
74
}
75
75
@@ -174,7 +174,6 @@ class NotionHelper {
174
174
} ,
175
175
} )
176
176
console . log ( `SUCCESS: Database has been updated!` )
177
- // only add assignments for new courses -> less api calls
178
177
} catch ( error ) {
179
178
console . log ( `ERROR: Database could not be update! ${ error } ` )
180
179
}
@@ -191,12 +190,11 @@ class NotionHelper {
191
190
type : "database_id" ,
192
191
database_id : this . database
193
192
} ,
194
- properties : page_properties ,
193
+ properties : await page_properties ,
195
194
} )
196
195
console . log ( `SUCCESS: new page ${ page_properties . ID . number } has been created!` )
197
196
} catch ( error ) {
198
- console . log ( page_properties )
199
- console . log ( `ERROR: createPage failed!\n${ error } ` )
197
+ console . log ( `ERROR: createNotionPage failed!\n${ error } ` )
200
198
}
201
199
}
202
200
Original file line number Diff line number Diff line change @@ -26,4 +26,11 @@ function setEnvValue(key, value) {
26
26
fs . writeFileSync ( "./.env" , ENV_VARS . join ( os . EOL ) ) ;
27
27
}
28
28
29
+ /**
30
+ * Potential function for future use.
31
+ */
32
+ const htmlToNotion = ( ) => {
33
+
34
+ }
35
+
29
36
module . exports = { setEnvValue }
You can’t perform that action at this time.
0 commit comments