Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
janwerkhoven committed Feb 10, 2024
1 parent 411ee69 commit fdb3817
Show file tree
Hide file tree
Showing 128 changed files with 2,298 additions and 194 deletions.
9 changes: 7 additions & 2 deletions app/controllers/concerns/json_api_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,13 @@ def forbidden_filters
# allow_create
# end
#
def allow_create
resource = model_class.new(attributes_and_relationships)
def allow_create(controller_attributes)
hash = strong_attributes
.merge(strong_relationships)
.merge(controller_attributes)

resource = model_class.new(hash)

if resource.save!
json = serializer_class.new(resource).serializable_hash.to_json
render status: 201, json: json
Expand Down
84 changes: 84 additions & 0 deletions app/controllers/v1/admin/client_side_renders_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
module V1
module Admin
class ClientSideRendersController < ApplicationController
def index
allow_index
end

def show
allow_show
end

def create
forbidden
end

def update
forbidden
end

def destroy
forbidden
end

private

def model_class
ClientSideRender
end

def serializer_class
V1::Admin::ClientSideRenderSerializer
end

def creatable_attributes
%[]
# %i[
# name
# company
# email
# mobile
# message
# purpose
# source
# ip
# ip_region
# ip_city
# ]
end

def creatable_relationships
%[]
# %i[
# country
# ip_country
# ]
end

def permitted_filters
%[]
# %i[
# main_group_id
# sub_group_id
# ]
end

def permanent_filters
{}
# {
# public: true
# }
end

def permitted_includes
%[]
# %i[
# related_articles
# related_products
# related_products.main_group
# translations
# ]
end
end
end
end
84 changes: 84 additions & 0 deletions app/controllers/v1/admin/page_views_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
module V1
module Admin
class PageViewsController < ApplicationController
def index
allow_index
end

def show
allow_show
end

def create
forbidden
end

def update
forbidden
end

def destroy
forbidden
end

private

def model_class
PageView
end

def serializer_class
V1::Admin::PageViewSerializer
end

def creatable_attributes
%[]
# %i[
# name
# company
# email
# mobile
# message
# purpose
# source
# ip
# ip_region
# ip_city
# ]
end

def creatable_relationships
%[]
# %i[
# country
# ip_country
# ]
end

def permitted_filters
%[]
# %i[
# main_group_id
# sub_group_id
# ]
end

def permanent_filters
{}
# {
# public: true
# }
end

def permitted_includes
%[]
# %i[
# related_articles
# related_products
# related_products.main_group
# translations
# ]
end
end
end
end
84 changes: 84 additions & 0 deletions app/controllers/v1/admin/server_side_renders_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
module V1
module Admin
class ServerSideRendersController < ApplicationController
def index
allow_index
end

def show
allow_show
end

def create
forbidden
end

def update
forbidden
end

def destroy
forbidden
end

private

def model_class
ServerSideRender
end

def serializer_class
V1::Admin::ServerSideRenderSerializer
end

def creatable_attributes
%[]
# %i[
# name
# company
# email
# mobile
# message
# purpose
# source
# ip
# ip_region
# ip_city
# ]
end

def creatable_relationships
%[]
# %i[
# country
# ip_country
# ]
end

def permitted_filters
%[]
# %i[
# main_group_id
# sub_group_id
# ]
end

def permanent_filters
{}
# {
# public: true
# }
end

def permitted_includes
%[]
# %i[
# related_articles
# related_products
# related_products.main_group
# translations
# ]
end
end
end
end
84 changes: 84 additions & 0 deletions app/controllers/v1/admin/visits_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
module V1
module Admin
class VisitsController < ApplicationController
def index
allow_index
end

def show
allow_show
end

def create
forbidden
end

def update
forbidden
end

def destroy
forbidden
end

private

def model_class
Visit
end

def serializer_class
V1::Admin::VisitSerializer
end

def creatable_attributes
%[]
# %i[
# name
# company
# email
# mobile
# message
# purpose
# source
# ip
# ip_region
# ip_city
# ]
end

def creatable_relationships
%[]
# %i[
# country
# ip_country
# ]
end

def permitted_filters
%[]
# %i[
# main_group_id
# sub_group_id
# ]
end

def permanent_filters
{}
# {
# public: true
# }
end

def permitted_includes
%[]
# %i[
# related_articles
# related_products
# related_products.main_group
# translations
# ]
end
end
end
end
Loading

0 comments on commit fdb3817

Please sign in to comment.