diff --git a/app/services/base_service.rb b/app/services/base_service.rb new file mode 100644 index 00000000..2b46c415 --- /dev/null +++ b/app/services/base_service.rb @@ -0,0 +1,5 @@ +module BaseService + def auto_publish! + DeployJob.perform_later site if site.auto_publish? + end +end diff --git a/app/services/post_service.rb b/app/services/post_service.rb index dda7992d..b1863fbe 100644 --- a/app/services/post_service.rb +++ b/app/services/post_service.rb @@ -3,6 +3,8 @@ # Este servicio se encarga de crear artículos y guardarlos en git, # asignándoselos a une usuarie PostService = Struct.new(:site, :usuarie, :post, :params, keyword_init: true) do + include BaseService + # Crea un artículo nuevo # # @return Post diff --git a/app/services/site_service.rb b/app/services/site_service.rb index b1df3d10..b446e527 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -3,6 +3,8 @@ # Se encargar de guardar cambios en sitios # TODO: Implementar rollback en la configuración SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do + include BaseService + def deploy site.enqueue! DeployJob.perform_later site.id