File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -62,10 +62,24 @@ async function main() {
62
62
}
63
63
64
64
const fileNameWithoutExtension = projectMdxFile . split ( "." ) [ 0 ] ;
65
+
65
66
const projectExists = (
66
67
await firestore . collection ( "projects" ) . doc ( fileNameWithoutExtension ) . get ( )
67
68
) . exists ;
68
69
70
+ const projectReactionsExists = (
71
+ await firestore
72
+ . collection ( "projectReactions" )
73
+ . doc ( fileNameWithoutExtension )
74
+ . get ( )
75
+ ) . exists ;
76
+
77
+ if ( ! projectReactionsExists ) {
78
+ await createProjectReactionsDoc ( {
79
+ projectName : fileNameWithoutExtension ,
80
+ } ) ;
81
+ }
82
+
69
83
const projectContent = fs . readFileSync (
70
84
path . resolve (
71
85
process . cwd ( ) ,
@@ -167,3 +181,11 @@ async function main() {
167
181
}
168
182
}
169
183
}
184
+
185
+ async function createProjectReactionsDoc ( { projectName } ) {
186
+ await firestore . collection ( "projectReactions" ) . doc ( projectName ) . set ( {
187
+ likes : 0 ,
188
+ shares : 0 ,
189
+ bookmarks : 0 ,
190
+ } ) ;
191
+ }
You can’t perform that action at this time.
0 commit comments