-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into portabilis-patch-2024-09-24
- Loading branch information
Showing
48 changed files
with
1,416 additions
and
548 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
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
29 changes: 29 additions & 0 deletions
29
app/controllers/api/v2/list_attendances_by_classroom_controller.rb
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,29 @@ | ||
module Api | ||
module V2 | ||
class ListAttendancesByClassroomController < Api::V2::BaseController | ||
respond_to :json | ||
|
||
def index | ||
required_params = %i[classrooms start_at end_at year] | ||
missing_params = validate_required_params(required_params) | ||
|
||
return if missing_params | ||
|
||
classrooms_api_code = params[:classrooms] | ||
start_at = params[:start_at] | ||
end_at = params[:end_at] | ||
year = params[:year] | ||
|
||
render json: ClassroomAttendanceService.call(classrooms_api_code, start_at, end_at, year) | ||
end | ||
|
||
def validate_required_params(required_params) | ||
missing_params = required_params.select { |param| params[param].blank? } | ||
|
||
return false unless missing_params.any? | ||
|
||
render json: { error: "Os seguintes parâmetros são obrigatórios: #{missing_params.join(', ')}" }, status: :unprocessable_entity | ||
end | ||
end | ||
end | ||
end |
30 changes: 30 additions & 0 deletions
30
app/controllers/api/v2/student_classroom_attendances_controller.rb
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,30 @@ | ||
module Api | ||
module V2 | ||
class StudentClassroomAttendancesController < Api::V2::BaseController | ||
respond_to :json | ||
def index | ||
required_params = %i[classroom_id start_at end_at year student_ids] | ||
missing_params = validate_required_params(required_params) | ||
|
||
return if missing_params | ||
classroom_api_code = params[:classroom_id] | ||
start_at = params[:start_at] | ||
end_at = params[:end_at] | ||
year = params[:year] | ||
students_api_code = params[:student_ids] | ||
|
||
render json: ListStudentAttendancesByClassroomService.call( | ||
classroom_api_code, start_at, end_at, year, students_api_code | ||
) | ||
end | ||
|
||
def validate_required_params(required_params) | ||
missing_params = required_params.select { |param| params[param].blank? } | ||
|
||
return false unless missing_params.any? | ||
|
||
render json: { error: "Os seguintes parâmetros são obrigatórios: #{missing_params.join(', ')}" }, status: :unprocessable_entity | ||
end | ||
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
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
Oops, something went wrong.