-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Class-member-create-allow-multiple-student-ids (#392)
## What's changed? - Additional class_members endpoint for batch creation - both create and create_batch use the same create concept - class members create methods first check for the students in profile via `SchoolStudent::List` - the create concept utilises the `student` instance over ID strings - the `student` attributes are nested in the `class_members` response - failed student class member creations are added to an `errors` object which is returned along with the successful creations
- Loading branch information
Showing
11 changed files
with
372 additions
and
184 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
json.call( | ||
class_member, | ||
:id, | ||
:school_class_id, | ||
:student_id, | ||
:created_at, | ||
:updated_at | ||
) | ||
|
||
if class_member.student.present? | ||
json.set! :student do | ||
json.call( | ||
class_member.student, | ||
:id, | ||
:username, | ||
: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 |
---|---|---|
@@ -1,15 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
class_member, student = @class_member_with_student | ||
|
||
json.call( | ||
class_member, | ||
:id, | ||
:school_class_id, | ||
:student_id, | ||
:created_at, | ||
:updated_at | ||
) | ||
|
||
json.student_username(student&.username) | ||
json.student_name(student&.name) | ||
if defined?(@class_members) | ||
json.array! @class_members do |class_member| | ||
json.partial! 'class_member', class_member: | ||
end | ||
elsif defined?(@class_member) | ||
json.class_member do | ||
json.partial! 'class_member', class_member: @class_member | ||
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
Oops, something went wrong.