@@ -20,6 +20,9 @@ defmodule MastaniServer.CMS.Delegate.Seeds do
2020 @ default_threads [ "post" , "user" , "job" , "video" , "wiki" , "cheatsheet" , "repo" ]
2121 @ home_threads [ "post" , "user" , "news" , "city" , "share" , "job" ]
2222
23+ # those thread has tag list
24+ @ general_threads [ "post" , "job" , "repo" , "video" ]
25+
2326 @ pl_communities [ "javascript" , "scala" , "haskell" , "swift" , "typescript" , "lua" , "racket" ]
2427 @ default_categories [ "pl" , "front-end" , "back-end" , "ai" , "design" , "mobile" , "others" ]
2528
@@ -78,6 +81,9 @@ defmodule MastaniServer.CMS.Delegate.Seeds do
7881 { :ok , categories } <- seed_categories ( bot , :default ) ,
7982 { :ok , communities } <- seed_for_communities ( bot , :pl ) do
8083 threadify_communities ( communities . entries , threads )
84+ # tagfy_threads(communities.entries, threads)
85+
86+ # TODO: set tags for post, video, job, repo thread
8187 categorify_communities ( communities . entries , categories )
8288 end
8389 end
@@ -145,6 +151,18 @@ defmodule MastaniServer.CMS.Delegate.Seeds do
145151 end )
146152 end
147153
154+ # tagfy only post job repo and video
155+ defp tagfy_threads ( communities , threads ) when is_list ( communities ) do
156+ Enum . each ( communities , fn community ->
157+ Enum . each ( threads , fn thread ->
158+ case thread . raw in @ general_threads do
159+ true -> IO . inspect ( thread . raw , label: "set this thread" )
160+ false -> IO . inspect ( thread . raw , label: "not target" )
161+ end
162+ end )
163+ end )
164+ end
165+
148166 # set categories to given communities
149167 defp categorify_communities ( communities , categories ) do
150168 Enum . each ( communities , fn community ->
0 commit comments