Add remix method to parties controller
This commit is contained in:
parent
a3e76d53e7
commit
fa2962ae1c
1 changed files with 14 additions and 1 deletions
|
|
@ -55,6 +55,19 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def remix
|
def remix
|
||||||
|
new_party = @party.amoeba_dup
|
||||||
|
new_party.attributes = {
|
||||||
|
user: current_user,
|
||||||
|
|
||||||
|
source_party: @party
|
||||||
|
}
|
||||||
|
|
||||||
|
if new_party.save
|
||||||
|
render json: PartyBlueprint.render(new_party, view: :full, root: :party,
|
||||||
|
meta: { remix: true })
|
||||||
|
else
|
||||||
|
render_validation_error_response(new_party)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
|
@ -111,7 +124,7 @@ module Api
|
||||||
def build_conditions(params)
|
def build_conditions(params)
|
||||||
unless params['recency'].blank?
|
unless params['recency'].blank?
|
||||||
start_time = (DateTime.current - params['recency'].to_i.seconds)
|
start_time = (DateTime.current - params['recency'].to_i.seconds)
|
||||||
.to_datetime.beginning_of_day
|
.to_datetime.beginning_of_day
|
||||||
end
|
end
|
||||||
|
|
||||||
{}.tap do |hash|
|
{}.tap do |hash|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue