-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from fga-gpp-mds/development
Release Sprint 10
- Loading branch information
Showing
48 changed files
with
1,116 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
service_name: travis-ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,14 @@ | ||
sudo: required | ||
|
||
language: ruby | ||
rvm: | ||
- 2.3.1 | ||
|
||
before_script: | ||
- psql -c 'create database "inclucare-api_test";' -U postgres | ||
|
||
language: ruby | ||
script: | ||
- bundle exec rake | ||
|
||
after_success: | ||
- CI=true TRAVIS=true coveralls --verboose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
class ApplicationController < ActionController::API | ||
include DeviseTokenAuth::Concerns::SetUserByToken | ||
|
||
before_action :configure_permitted_parameters, if: :devise_controller? | ||
|
||
protected | ||
|
||
def configure_permitted_parameters | ||
devise_parameter_sanitizer.permit(:sign_up, keys: [:name]) | ||
devise_parameter_sanitizer.permit(:account_update, keys: [:name]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
class DailyLogsController < ApplicationController | ||
before_action :set_daily_log, only: [:show, :update, :destroy] | ||
|
||
# GET /daily_logs | ||
def index | ||
@daily_logs = DailyLog.all | ||
|
||
render json: @daily_logs | ||
end | ||
|
||
# GET /daily_logs/1 | ||
def show | ||
render json: @daily_log | ||
end | ||
|
||
# POST /daily_logs | ||
def create | ||
@daily_log = DailyLog.new(daily_log_params) | ||
|
||
if @daily_log.save | ||
render json: @daily_log, status: :created, location: @daily_log | ||
else | ||
render json: @daily_log.errors, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# PATCH/PUT /daily_logs/1 | ||
def update | ||
if @daily_log.update(daily_log_params) | ||
render json: @daily_log | ||
else | ||
render json: @daily_log.errors, status: :unprocessable_entity | ||
end | ||
end | ||
|
||
# DELETE /daily_logs/1 | ||
def destroy | ||
@daily_log.destroy | ||
end | ||
|
||
private | ||
# Use callbacks to share common setup or constraints between actions. | ||
def set_daily_log | ||
@daily_log = DailyLog.find(params[:id]) | ||
end | ||
|
||
# Only allow a trusted parameter "white list" through. | ||
def daily_log_params | ||
params.require(:daily_log).permit(:date, :activity, :note, :student_id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class DailyLog < ApplicationRecord | ||
belongs_to :student | ||
|
||
validates_presence_of :note, presence: true, message: 'can t be left blank' | ||
validates_presence_of :activity, presence: true, message: 'can t be left blank' | ||
validates_presence_of :date, presence: true, message: 'can t be left blank' | ||
validates_presence_of :student_id, presence: true, message: 'can t be left blank' | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
class Student < ApplicationRecord | ||
validates_presence_of :name, presence: true, message: 'can t be left blank' | ||
validates_presence_of :birth_date, presence: true, message: 'can t be left blank' | ||
validates_presence_of :age, presence: true, message: 'can t be left blank' | ||
validates_presence_of :nationality, presence: true, message: 'can t be left blank' | ||
validates_presence_of :year, presence: true, message: 'can t be left blank' | ||
validates_presence_of :student_class, presence: true, message: 'can t be left blank' | ||
validates_presence_of :shift, presence: true, message: 'can t be left blank' | ||
validates_presence_of :father_name, presence: true, message: 'can t be left blank' | ||
validates_presence_of :mother_name, presence: true, message: 'can t be left blank' | ||
validates_presence_of :address, presence: true, message: 'can t be left blank' | ||
validates_presence_of :parent_telephone, presence: true, length: { is: 11 }, message: 'can t be left blank' | ||
validates_presence_of :parent_email, presence: true, email: true, message: 'can t be left blank' | ||
validates_presence_of :teacher_name, presence: true, message: 'can t be left blank' | ||
|
||
validates_length_of :name, minimum: 5, message: 'at least 5 characters' | ||
validates_length_of :nationality, maximum: 14, message: 'deve possuir no maximo 15 caracteres' | ||
validates_length_of :year, maximum: 2, message: 'deve possuir no maximo 3 digitos' | ||
validates_length_of :student_class, minimum: 1, message: 'at least 1 characters' | ||
validates_length_of :shift, minimum: 1, message: 'at least 1 characters' | ||
validates_length_of :father_name, minimum: 5, message: 'at least 5 characters' | ||
validates_length_of :mother_name,minimum: 5, message: 'at least 5 characters' | ||
validates_length_of :address, minimum: 7, message: 'at least 7 characters' | ||
|
||
validates_numericality_of :age, message: 'need to be number' | ||
validates_numericality_of :parent_telephone, message: 'need to be number' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class DailyLogSerializer < ActiveModel::Serializer | ||
attributes :id, :date, :activity, :note | ||
has_one :student | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddTeacherNameToStudent < ActiveRecord::Migration[5.1] | ||
def change | ||
add_column :students, :teacher_name, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class CreateDailyLogs < ActiveRecord::Migration[5.1] | ||
def change | ||
create_table :daily_logs do |t| | ||
t.date :date | ||
t.text :activity | ||
t.string :note | ||
t.belongs_to :student, index: true | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
rake db:drop | ||
rake db:create | ||
rake db:create | ||
rails s |
Oops, something went wrong.