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.

Commitc9dee45

Browse files
committed
chore: wip
1 parent4766d38 commitc9dee45

File tree

10 files changed

+24
-14
lines changed

10 files changed

+24
-14
lines changed

‎lib/groupher_server/cms/delegates/Seeds/domain.ex‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ defmodule GroupherServer.CMS.Delegate.Seeds.Domain do
2929
defseed_community(:home)do
3030
with{:error,_}<-ORM.find_by(Community,%{raw:"home"}),
3131
{:ok,bot}<-seed_bot(),
32-
{:ok,threads}<-seed_threads(:home),
33-
{:ok,categories}<-seed_categories_ifneed(bot)do
32+
{:ok,threads}<-seed_threads(:home)do
3433
args=%{
3534
title:"coderplanets",
3635
desc:"the most sexy community for developers, ever.",

‎lib/groupher_server/cms/delegates/Seeds/helper.ex‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,12 @@ defmodule GroupherServer.CMS.Delegate.Seeds.Helper do
6565
threads=Seeds.Threads.get(type)
6666
threads_list=threads|>Enum.map(&&1.raw)
6767

68-
with{:error,_}<-ORM.find_by(Thread,%{raw:"post"})do
69-
threads|>Enum.each(&CMS.create_thread(&1))
70-
end
68+
threads
69+
|>Enum.each(fnthread->
70+
with{:error,_}<-ORM.find_by(Thread,%{raw:thread.raw})do
71+
CMS.create_thread(thread)
72+
end
73+
end)
7174

7275
Thread
7376
|>where([t],t.rawin^threads_list)

‎lib/groupher_server/cms/delegates/Seeds/tags.ex‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ defmodule GroupherServer.CMS.Delegate.Seeds.Tags do
1111
defrandom_color(),do:@tag_colors|>Enum.random()|>String.to_atom()
1212

1313
defget(_,:users,_),do:[]
14+
defget(_,:cper,_),do:[]
1415
defget(_,:setting,_),do:[]
1516
defget(_,:team,_),do:[]
1617

‎lib/groupher_server/cms/delegates/Seeds/threads.ex‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ defmodule GroupherServer.CMS.Delegate.Seeds.Threads do
2323
},
2424
%{
2525
title:"CPer",
26-
raw:"users",
26+
raw:"cper",
2727
index:5
2828
},
2929
%{

‎lib/groupher_server_web/schema/Helper/fields.ex‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ defmodule GroupherServerWeb.Schema.Helper.Fields do
22
@moduledoc"""
33
general fields used in GraphQL schema definition
44
"""
5-
importHelper.Utils,only:[get_config:2]
5+
importHelper.Utils,only:[get_config:2,plural:1]
66
importAbsinthe.Resolution.Helpers,only:[dataloader:2]
77

88
aliasGroupherServer.CMS
@@ -201,7 +201,7 @@ defmodule GroupherServerWeb.Schema.Helper.Fields do
201201
@article_threads
202202
|>Enum.map(
203203
&quotedo
204-
field(unquote(:"#{&1}s_count"),:integer)
204+
field(unquote(:"#{plural(&1)}_count"),:integer)
205205
end
206206
)
207207
end

‎priv/mock/debug_seeds.exs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
aliasGroupherServer.CMS
2+
aliasHelper.ORM
3+
4+
# ORM.delete_all(CMS.Model.Thread, :if_exist)
25

36
CMS.clean_up_community(:home)
47
{:ok,community}=CMS.seed_community(:home)
8+
9+
hello=ORM.find(CMS.Model.Community,community.id)
10+
11+
# IO.inspect(hello, label: "hello -> ")
12+
513
CMS.seed_articles(community,:post,5)

‎test/groupher_server/seeds/articles_test.exs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ defmodule GroupherServer.Test.Seeds.Articles do
33
useGroupherServer.TestTools
44

55
# alias GroupherServer.Accounts.Model.User
6-
aliasGroupherServer.{CMS,Repo}
6+
aliasGroupherServer.CMS
77

88
aliasCMS.Model.Post
99
# alias CMS.Delegate.SeedsConfig
1010

1111
aliasHelper.ORM
1212

1313
describe"[posts seed]"do
14-
@tag:wip
1514
test"can clean up a community"do
1615
{:ok,community}=CMS.seed_community(:home)
1716
CMS.seed_articles(community,:post,5)

‎test/groupher_server/seeds/clean_up_test.exs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ defmodule GroupherServer.Test.Seeds.CommunitySeed do
2020
end
2121

2222
describe"[community clean up]"do
23-
@tag:wip
2423
test"can clean up a community",~m(user post_attrs)ado
2524
{:ok,community}=CMS.seed_community(:home)
2625
{:ok,post}=CMS.create_article(community,:post,post_attrs,user)

‎test/groupher_server/seeds/community_seed_test.exs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ defmodule GroupherServer.Test.Seeds.CommunitySeed do
44
useGroupherServer.TestTools
55

66
aliasGroupherServer.CMS
7-
aliasCMS.Model.{Community}
7+
aliasCMS.Model.Community
88
aliasHelper.ORM
99

1010
describe"[special communities seeds]"do
11+
@tag:wip
1112
test"can seed home community"do
1213
{:ok,community}=CMS.seed_community(:home)
1314
{:ok,found}=ORM.find(Community,community.id,preload:[threads::thread])

‎test/support/factory.ex‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ defmodule GroupherServer.Support.Factory do
8989
%{
9090
meta:@default_article_meta,
9191
title:String.slice(text,1,49),
92-
body:mock_rich_text(),
93-
digest:String.slice(text,1,150),
92+
body:mock_rich_text(text),
93+
digest:String.slice(text,100,150),
9494
solution_digest:String.slice(text,1,150),
9595
length:String.length(text),
9696
author:mock(:author),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp