Skip to content

Commit 9dfa0dc

Browse files
committed
refactor: update default values for user and bounty schemas
- Changed default fee percentage from 19 to 9 in the user schema. - Updated default visibility and bounty mode from :public to :community in the bounty schema. - Added a migration to reflect these changes in the database schema.
1 parent d582572 commit 9dfa0dc

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

lib/algora/accounts/schemas/user.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ defmodule Algora.Accounts.User do
3838
field :categories, {:array, :string}, default: []
3939
field :featured, :boolean, default: false
4040
field :priority, :integer, default: 0
41-
field :fee_pct, :integer, default: 19
41+
field :fee_pct, :integer, default: 9
4242
field :seeded, :boolean, default: false
4343
field :activated, :boolean, default: false
4444
field :max_open_attempts, :integer, default: 3
@@ -63,7 +63,7 @@ defmodule Algora.Accounts.User do
6363

6464
field :bounty_mode, Ecto.Enum,
6565
values: [:community, :exclusive, :public],
66-
default: :public
66+
default: :community
6767

6868
field :website_url, :string
6969
field :twitter_url, :string

lib/algora/bounties/schemas/bounty.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ defmodule Algora.Bounties.Bounty do
1212
field :status, Ecto.Enum, values: [:open, :cancelled, :paid]
1313
field :number, :integer, default: 0
1414
field :autopay_disabled, :boolean, default: false
15-
field :visibility, Ecto.Enum, values: [:community, :exclusive, :public], null: false, default: :public
15+
field :visibility, Ecto.Enum, values: [:community, :exclusive, :public], null: false, default: :community
1616
field :shared_with, {:array, :string}, null: false, default: []
1717

1818
belongs_to :ticket, Algora.Workspace.Ticket
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
defmodule Algora.Repo.Migrations.UpdateBountyDefaults do
2+
use Ecto.Migration
3+
4+
def up do
5+
alter table(:bounties) do
6+
modify :visibility, :string, default: "community"
7+
end
8+
9+
alter table(:users) do
10+
modify :bounty_mode, :string, default: "community"
11+
modify :fee_pct, :integer, null: false, default: 9
12+
end
13+
end
14+
15+
def down do
16+
alter table(:bounties) do
17+
modify :visibility, :string, default: "public"
18+
end
19+
20+
alter table(:users) do
21+
modify :bounty_mode, :string, default: "public"
22+
modify :fee_pct, :integer, null: false, default: 19
23+
end
24+
end
25+
end

test/support/factory.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ defmodule Algora.Factory do
6565
hourly_rate_max: Money.new!(150, :USD),
6666
hours_per_week: 40,
6767
featured: true,
68-
fee_pct: 19,
68+
fee_pct: 9,
6969
activated: true,
7070
website_url: "https://piedpiper.com",
7171
twitter_url: "https://twitter.com/piedpiper",

0 commit comments

Comments
 (0)