From 331dc7f60760c16246e1885aefdb9dc4b950c965 Mon Sep 17 00:00:00 2001 From: jazzari Date: Mon, 2 Oct 2023 15:40:44 -0300 Subject: [PATCH] feat: creado modulo BaseService para opcion de auto_publicacion #13244 --- app/services/base_service.rb | 5 +++++ app/services/post_service.rb | 2 ++ app/services/site_service.rb | 2 ++ 3 files changed, 9 insertions(+) create mode 100644 app/services/base_service.rb 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