Skip to content
Snippets Groups Projects
Commit d5949c06 authored by Treadway, Ross T (UG - Computer Science)'s avatar Treadway, Ross T (UG - Computer Science)
Browse files

Adding email microservice docker image, and implementing reminder helper method

parent 6f8de0f3
No related branches found
No related tags found
No related merge requests found
...@@ -61,6 +61,18 @@ log_out is a method that sends a delete http request containing the JWT token of ...@@ -61,6 +61,18 @@ log_out is a method that sends a delete http request containing the JWT token of
session[:logged_in] is set to false by this method session[:logged_in] is set to false by this method
## Mailer Microservice
The Mailer Microservice is run inside a docker container that is booted up by using [this](#creating-the-image) command.
### Helper Methods
There are a few Helper Methods that in the ApplicationController.rb file, which means the methods are available to any controller that inherits from ApplicationController (i.e most controllers).
#### reminder_email
reminder_email(emails, reminder) is a method that takes two inputs, emails and reminder, emails is a list of emails that the reminder needs to be sent to, and the reminder input is a reminder object (currently no model exists, need to implement when reminders are added to the database).
## Adding to the readme ## Adding to the readme
When editing use this as a guide: https://guides.github.com/features/mastering-markdown/ When editing use this as a guide: https://guides.github.com/features/mastering-markdown/
......
...@@ -65,4 +65,15 @@ class ApplicationController < ActionController::Base ...@@ -65,4 +65,15 @@ class ApplicationController < ActionController::Base
redirect_to root_path redirect_to root_path
end end
def reminder_email(emails, reminder)
email = HTTParty.post('http://172.17.0.1:3002/reminder', :body => {
:emails => emails,
:event => {
:title => reminder["title"],
:description => reminder["description"]
}
})
redirect_to root_path
end
end end
...@@ -28,6 +28,13 @@ class HomeController < ApplicationController ...@@ -28,6 +28,13 @@ class HomeController < ApplicationController
def test_auth def test_auth
auth auth
end end
def reminder_email_test
email = ["rtreadwaynest@gmail.com", "ross@alantreadway.net"]
reminder = {"title" => "this is a test", "description" => "this is a test description"}
reminder_email(email, reminder)
end
end end
\ No newline at end of file
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<body> <body>
<%= yield %> <%= yield %>
<%= link_to "Reminder", home_reminder_email_test_path, class: 'btn btn-warning btn-md' %>
<% if session[:logged_in] %> <% if session[:logged_in] %>
<%= link_to "Logout", home_test_log_out_path, class: 'btn btn-warning btn-md' %> <%= link_to "Logout", home_test_log_out_path, class: 'btn btn-warning btn-md' %>
<% else %> <% else %>
......
...@@ -16,5 +16,6 @@ Rails.application.routes.draw do ...@@ -16,5 +16,6 @@ Rails.application.routes.draw do
post 'sign_up/send', to: 'registrations#sign_up' post 'sign_up/send', to: 'registrations#sign_up'
get 'login', to: 'sessions#new' get 'login', to: 'sessions#new'
post 'login/send', to: 'sessions#login' post 'login/send', to: 'sessions#login'
get 'home/reminder_email_test', to: 'home#reminder_email_test'
end end
...@@ -3,8 +3,6 @@ version: "3.7" ...@@ -3,8 +3,6 @@ version: "3.7"
services: services:
db_primary: db_primary:
image: mysql:5.7 image: mysql:5.7
# volumes:
# - db_data:/var/lib/mysql
restart: always restart: always
environment: environment:
MYSQL_DATABASE: docker_dev MYSQL_DATABASE: docker_dev
...@@ -46,3 +44,7 @@ services: ...@@ -46,3 +44,7 @@ services:
- db_auth - db_auth
links: links:
- db_auth - db_auth
mailer:
image: driftydirt/group24mailer:0.0.3
ports:
- "3002:3000"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment