Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit444c79b

Browse files
authored
chore(cms): remove video staff (#314)
* refactor(rm-video): remove video tests* refactor(rm-video): remove db table, relate-code, fix tests* chore(rm-video): fmt
1 parentdc2f95b commit444c79b

File tree

78 files changed

+54
-3764
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+54
-3764
lines changed

‎lib/groupher_server/accounts/delegates/favorite_category.ex‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,20 @@ defmodule GroupherServer.Accounts.Delegate.FavoriteCategory do
4141
with{:ok,category}<-FavoriteCategory|>ORM.find_by(~m(id user_id)a)do
4242
Multi.new()
4343
|>Multi.run(:downgrade_achievement,fn_,_->
44-
# find user favvoried-contents(posts & jobs & videos) 's author,
44+
# find user favvoried-contents(posts & jobs) 's author,
4545
# and downgrade their's acieveents
4646
# NOTE: this is too fucking violent and should be refactor later
47-
# we find favroted posts/jobs/videos author_ids then doengrade their achievement
47+
# we find favroted posts/jobs author_ids then doengrade their achievement
4848
# this implentment is limited, if the user have lots contents in a favoreted-category
4949
# ant those contents have diffenert author each, it may be fucked
5050
# should be in a queue job or sth
5151
{:ok,post_author_ids}=affected_author_ids(:post,CMS.PostFavorite,category)
5252
{:ok,job_author_ids}=affected_author_ids(:job,CMS.JobFavorite,category)
53-
{:ok,video_author_ids}=affected_author_ids(:video,CMS.VideoFavorite,category)
5453
{:ok,repo_author_ids}=affected_author_ids(:repo,CMS.RepoFavorite,category)
5554

5655
# author_ids_list = count_words(total_author_ids) |> Map.to_list
5756
author_ids_list=
58-
(post_author_ids++job_author_ids++video_author_ids++repo_author_ids)
57+
(post_author_ids++job_author_ids++repo_author_ids)
5958
|>count_words
6059
|>Map.to_list()
6160

@@ -76,7 +75,7 @@ defmodule GroupherServer.Accounts.Delegate.FavoriteCategory do
7675
end
7776

7877
# NOTE: this is too fucking violent and should be refactor later
79-
# we find favroted posts/jobs/videos author_ids then doengrade their achievement
78+
# we find favroted posts/jobs author_ids then doengrade their achievement
8079
# this implentment is limited, if the user have lots contents in a favoreted-category
8180
# ant those contents have diffenert author each, it may be fucked
8281
defpaffected_author_ids(thread,queryable,category)do
@@ -136,7 +135,7 @@ defmodule GroupherServer.Accounts.Delegate.FavoriteCategory do
136135
end
137136

138137
@doc"""
139-
set category for favorited content (post, job, video ...)
138+
set category for favorited content (post, job ...)
140139
"""
141140
defset_favorites(%User{}=user,thread,content_id,category_id)do
142141
with{:ok,favorite_category}<-
@@ -238,9 +237,6 @@ defmodule GroupherServer.Accounts.Delegate.FavoriteCategory do
238237
defpfind_content_favorite(:job,content_id,user_id),
239238
do:JobFavorite|>ORM.find_by(%{job_id:content_id,user_id:user_id})
240239

241-
defpfind_content_favorite(:video,content_id,user_id),
242-
do:VideoFavorite|>ORM.find_by(%{video_id:content_id,user_id:user_id})
243-
244240
defpfind_content_favorite(:repo,content_id,user_id),
245241
do:RepoFavorite|>ORM.find_by(%{repo_id:content_id,user_id:user_id})
246242

‎lib/groupher_server/accounts/delegates/reacted_contents.ex‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmoduleGroupherServer.Accounts.Delegate.ReactedContentsdo
22
@moduledoc"""
3-
get contents(posts, jobs, videos ...) that user reacted (star, favorite ..)
3+
get contents(posts, jobs ...) that user reacted (star, favorite ..)
44
"""
55
importGroupherServer.CMS.Utils.Matcher
66
importEcto.Query,warn:false

‎lib/groupher_server/accounts/user.ex‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,10 @@ defmodule GroupherServer.Accounts.User do
5757
# stared contents
5858
has_many(:stared_posts,{"posts_stars",CMS.PostStar})
5959
has_many(:stared_jobs,{"jobs_stars",CMS.JobStar})
60-
has_many(:stared_videos,{"videos_stars",CMS.VideoStar})
6160

6261
# favorited contents
6362
has_many(:favorited_posts,{"posts_favorites",CMS.PostFavorite})
6463
has_many(:favorited_jobs,{"jobs_favorites",CMS.JobFavorite})
65-
has_many(:favorited_videos,{"videos_favorites",CMS.VideoFavorite})
6664
has_many(:favorited_repos,{"repos_favorites",CMS.RepoFavorite})
6765

6866
has_many(:favorite_categories,{"favorite_categories",FavoriteCategory})

‎lib/groupher_server/accounts/utils/loader.ex‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ defmodule GroupherServer.Accounts.Utils.Loader do
5050
CMS.JobStar|>count_contents
5151
end
5252

53-
defquery({"videos_stars",CMS.VideoStar},%{count:_})do
54-
CMS.VideoStar|>count_contents
55-
end
56-
5753
# favorited contents count
5854
defquery({"posts_favorites",CMS.PostFavorite},%{count:_})do
5955
CMS.PostFavorite|>count_contents
@@ -63,10 +59,6 @@ defmodule GroupherServer.Accounts.Utils.Loader do
6359
CMS.JobFavorite|>count_contents
6460
end
6561

66-
defquery({"videos_favorites",CMS.VideoFavorite},%{count:_})do
67-
CMS.VideoFavorite|>count_contents
68-
end
69-
7062
defquery({"repos_favorites",CMS.RepoFavorite},%{count:_})do
7163
CMS.RepoFavorite|>count_contents
7264
end

‎lib/groupher_server/cms/community.ex‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ defmodule GroupherServer.CMS.Community do
6161
join_keys:[community_id::id,post_id::id]
6262
)
6363

64-
many_to_many(
65-
:videos,
66-
Video,
67-
join_through:"communities_videos",
68-
join_keys:[community_id::id,video_id::id]
69-
)
70-
7164
many_to_many(
7265
:repos,
7366
Repo,
@@ -85,10 +78,8 @@ defmodule GroupherServer.CMS.Community do
8578
# posts_managers
8679
# jobs_managers
8780
# tuts_managers
88-
# videos_managers
8981
#
9082
# posts_block_list ...
91-
# videos_block_list ...
9283
timestamps(type::utc_datetime)
9384
end
9485

‎lib/groupher_server/cms/delegates/article_curd.ex‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmoduleGroupherServer.CMS.Delegate.ArticleCURDdo
22
@moduledoc"""
3-
CURD operation on post/job/video ...
3+
CURD operation on post/job ...
44
"""
55
importEcto.Query,warn:false
66
importGroupherServer.CMS.Utils.Matcher
@@ -243,16 +243,6 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
243243
end)
244244
end
245245

246-
defpdomain_filter_query(CMS.Video=queryable,filter)do
247-
Enum.reduce(filter,queryable,fn
248-
{:source,source},queryable->
249-
queryable|>where([content],content.source==^source)
250-
251-
{_,_},queryable->
252-
queryable
253-
end)
254-
end
255-
256246
defpdomain_filter_query(CMS.Repo=queryable,filter)do
257247
Enum.reduce(filter,queryable,fn
258248
{:sort,:most_github_star},queryable->
@@ -327,10 +317,6 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
327317
merge_pin_contents(contents,:job,CMS.PinedJob,filter)
328318
end
329319

330-
defpadd_pin_contents_ifneed(contents,CMS.Video,%{community:_community}=filter)do
331-
merge_pin_contents(contents,:video,CMS.PinedVideo,filter)
332-
end
333-
334320
defpadd_pin_contents_ifneed(contents,CMS.Repo,%{community:_community}=filter)do
335321
merge_pin_contents(contents,:repo,CMS.PinedRepo,filter)
336322
end
@@ -441,7 +427,6 @@ defmodule GroupherServer.CMS.Delegate.ArticleCURD do
441427
defpcontent_id(:post,id),do:%{post_id:id}
442428
defpcontent_id(:job,id),do:%{job_id:id}
443429
defpcontent_id(:repo,id),do:%{repo_id:id}
444-
defpcontent_id(:video,id),do:%{video_id:id}
445430

446431
# for create content step in Multi.new
447432
defpexec_create_content(target,attrs,%Author{id:aid},%Community{id:cid})do

‎lib/groupher_server/cms/delegates/article_operation.ex‎

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ defmodule GroupherServer.CMS.Delegate.ArticleOperation do
1717
Job,
1818
JobCommunityFlag,
1919
RepoCommunityFlag,
20-
Video,
21-
VideoCommunityFlag,
2220
Tag,
2321
Topic,
2422
PinedPost,
2523
PinedJob,
26-
PinedVideo,
2724
PinedRepo
2825
}
2926

@@ -50,14 +47,6 @@ defmodule GroupherServer.CMS.Delegate.ArticleOperation do
5047
end
5148
end
5249

53-
defpin_content(%Video{id:video_id},%Community{id:community_id})do
54-
attrs=~m(video_id community_id)a
55-
56-
with{:ok,pined}<-ORM.findby_or_insert(PinedVideo,attrs,attrs)do
57-
Video|>ORM.find(pined.video_id)
58-
end
59-
end
60-
6150
defpin_content(%CMSRepo{id:repo_id},%Community{id:community_id})do
6251
attrs=~m(repo_id community_id)a
6352

@@ -81,13 +70,6 @@ defmodule GroupherServer.CMS.Delegate.ArticleOperation do
8170
end
8271
end
8372

84-
defundo_pin_content(%Video{id:video_id},%Community{id:community_id})do
85-
with{:ok,pined}<-ORM.find_by(PinedVideo,~m(video_id community_id)a),
86-
{:ok,deleted}<-ORM.delete(pined)do
87-
Video|>ORM.find(deleted.video_id)
88-
end
89-
end
90-
9173
defundo_pin_content(%CMSRepo{id:repo_id},%Community{id:community_id})do
9274
with{:ok,pined}<-ORM.find_by(PinedRepo,~m(repo_id community_id)a),
9375
{:ok,deleted}<-ORM.delete(pined)do
@@ -128,11 +110,6 @@ defmodule GroupherServer.CMS.Delegate.ArticleOperation do
128110
RepoCommunityFlag|>ORM.upsert_by(clauses,Map.merge(attrs,clauses))
129111
end
130112

131-
defpinsert_flag_record(%Video{id:video_id},community_id,attrs)do
132-
clauses=~m(video_id community_id)a
133-
VideoCommunityFlag|>ORM.upsert_by(clauses,Map.merge(attrs,clauses))
134-
end
135-
136113
@doc"""
137114
set content to diffent community
138115
"""
@@ -159,7 +136,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleOperation do
159136
end
160137

161138
@doc"""
162-
set general tag for post / tuts/ videos...
139+
set general tag for post / tuts ...
163140
refined tag can't set by this func, use set_refined_tag instead
164141
"""
165142
# check community first

‎lib/groupher_server/cms/delegates/article_reaction.ex‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
defmoduleGroupherServer.CMS.Delegate.ArticleReactiondo
22
@moduledoc"""
3-
reaction[favorite, star, watch ...] on article [post, job, video...]
3+
reaction[favorite, star, watch ...] on article [post, job...]
44
"""
55
importHelper.Utils,only:[done:1,done:2]
66
importGroupherServer.CMS.Utils.Matcher
@@ -14,7 +14,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleReaction do
1414
aliasEcto.Multi
1515

1616
@doc"""
17-
favorite / star / watch CMS contents like post / tuts/ video...
17+
favorite / star / watch CMS contents like post / tuts ...
1818
"""
1919
defreaction(thread,react,content_id,%User{id:user_id})do
2020
with{:ok,action}<-match_action(thread,react),
@@ -56,7 +56,7 @@ defmodule GroupherServer.CMS.Delegate.ArticleReaction do
5656

5757
# ------
5858
@doc"""
59-
unfavorite / unstar / unwatch CMS contents like post / tuts/ video...
59+
unfavorite / unstar / unwatch CMS contents like post / tuts ...
6060
"""
6161
defundo_reaction(thread,react,content_id,%User{id:user_id})do
6262
with{:ok,action}<-match_action(thread,react),
@@ -108,10 +108,6 @@ defmodule GroupherServer.CMS.Delegate.ArticleReaction do
108108
dynamic([p],p.job_id==^idand^user_where)
109109
end
110110

111-
defpdynamic_reaction_where(:video,id,user_where)do
112-
dynamic([p],p.video_id==^idand^user_where)
113-
end
114-
115111
defpdynamic_reaction_where(:repo,id,user_where)do
116112
dynamic([p],p.repo_id==^idand^user_where)
117113
end

‎lib/groupher_server/cms/delegates/comment_curd.ex‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ defmodule GroupherServer.CMS.Delegate.CommentCURD do
1515
aliasGroupherServer.CMS.{
1616
PostCommentReply,
1717
JobCommentReply,
18-
VideoCommentReply,
1918
RepoCommentReply
2019
}
2120

@@ -213,17 +212,6 @@ defmodule GroupherServer.CMS.Delegate.CommentCURD do
213212
end
214213
end
215214

216-
defpbridge_reply(:video,queryable,comment,attrs)do
217-
with{:ok,reply}<-ORM.create(queryable,attrs)do
218-
ORM.update(reply,%{reply_id:comment.id})
219-
220-
{:ok,_}=
221-
VideoCommentReply|>ORM.create(%{video_comment_id:comment.id,reply_id:reply.id})
222-
223-
queryable|>ORM.find(reply.id)
224-
end
225-
end
226-
227215
defpbridge_reply(:repo,queryable,comment,attrs)do
228216
with{:ok,reply}<-ORM.create(queryable,attrs)do
229217
ORM.update(reply,%{reply_id:comment.id})
@@ -256,27 +244,21 @@ defmodule GroupherServer.CMS.Delegate.CommentCURD do
256244
# merge_comment_attrs when create comemnt
257245
defpmerge_comment_attrs(:post,attrs,id),do:attrs|>Map.merge(%{post_id:id})
258246
defpmerge_comment_attrs(:job,attrs,id),do:attrs|>Map.merge(%{job_id:id})
259-
defpmerge_comment_attrs(:video,attrs,id),do:attrs|>Map.merge(%{video_id:id})
260247
defpmerge_comment_attrs(:repo,attrs,id),do:attrs|>Map.merge(%{repo_id:id})
261248

262249
defpmerge_reply_attrs(:post,attrs,comment),
263250
do:attrs|>Map.merge(%{post_id:comment.post_id})
264251

265252
defpmerge_reply_attrs(:job,attrs,comment),do:attrs|>Map.merge(%{job_id:comment.job_id})
266253

267-
defpmerge_reply_attrs(:video,attrs,comment),
268-
do:attrs|>Map.merge(%{video_id:comment.video_id})
269-
270254
defpmerge_reply_attrs(:repo,attrs,comment),
271255
do:attrs|>Map.merge(%{repo_id:comment.repo_id})
272256

273257
defpdynamic_comment_where(:post,id),do:dynamic([c],c.post_id==^id)
274258
defpdynamic_comment_where(:job,id),do:dynamic([c],c.job_id==^id)
275-
defpdynamic_comment_where(:video,id),do:dynamic([c],c.video_id==^id)
276259
defpdynamic_comment_where(:repo,id),do:dynamic([c],c.repo_id==^id)
277260

278261
defpdynamic_reply_where(:post,comment),do:dynamic([c],c.post_id==^comment.post_id)
279262
defpdynamic_reply_where(:job,comment),do:dynamic([c],c.job_id==^comment.job_id)
280-
defpdynamic_reply_where(:video,comment),do:dynamic([c],c.video_id==^comment.video_id)
281263
defpdynamic_reply_where(:repo,comment),do:dynamic([c],c.repo_id==^comment.repo_id)
282264
end

‎lib/groupher_server/cms/delegates/comment_reaction.ex‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ defmodule GroupherServer.CMS.Delegate.CommentReaction do
2222

2323
defpmerge_thread_comment_id(:post_comment,comment_id),do:%{post_comment_id:comment_id}
2424
defpmerge_thread_comment_id(:job_comment,comment_id),do:%{job_comment_id:comment_id}
25-
defpmerge_thread_comment_id(:video_comment,comment_id),do:%{video_comment_id:comment_id}
2625
defpmerge_thread_comment_id(:repo_comment,comment_id),do:%{repo_comment_id:comment_id}
2726

2827
defpfeel_comment(thread,comment_id,user_id,feeling)do

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp