-
Notifications
You must be signed in to change notification settings - Fork 3
Organization
##OrganizationAction.prototype.addResourceToSection
To add a resource to a section. Resources must be added to a section,
if the user wants to try to add them to a course they will be default be
in the default section by calling addResourceToDefault.
We are going in with the precondition that the default section exists
for the course.
args = {
section : UUID of the section
material : UUID of the resource
}
The newly added resource UUID. If there is an error we return an empty string
and we log the error into the server console.
##OrganizationAction.prototype.removeResourceFromSection
When we want to remove a resource from a section. We need to make sure
that the courseMaterial exists before we try to destroy it.
args = {
section : UUID of the section
material : UUID of the resource
}
returns the default section uuid for that course. If this does not exist we
log the error in the server console and return an empty string.
##OrganizationAction.prototype.updateResourceFromSectionToSection
We want to update a courseMaterial so this general means that we want to move
a material from one section to another. I am assuming because we have both the
UUIDs of the sectin and the new section to move to that both Sections exist in
the Sections table and we really only care about the relationship at this point
between the material and the section.
args = {
section : UUID of the section
newsection : UUID of the section
material : UUID of the resource
}
returns the UUID of the new section. If there was an error we return an empty string
and we log the error into the server console.
##OrganizationAction.prototype.addSection
In order to create a section, we first need to go through and see that the course section
doesnt already exist. Unfortunately at this time we can only really compare sections by
title which is not good but at this time I cant think of anything better ( July 13 ).
args = {
title : Name of the section if this is "default", no section will be made
course: UUID of the course
app : enumerated type of the application, refer to enumerated types in docs
}
returns the UUID of the new section. If there is an error we return an empty string
we then log the issue into the server console.
##OrganizationAction.prototype.removeSection
Removing a section means that if it exists in a course section, the course section
will be removed and any section materials associated with this section will be removed.
In order for a CourseSection to have been created it would have to be associated with
a course so if the courseSection has no knowledge of this relationship we should stop
right away when removing a section. Resources associated with this section are optional
so if there are reasources we need to disassociate on the sectionmaterials table.
At the very end we must remove the section entry in the sections table.
args = {
section : UUID of section to remove
}
returns the UUID of the deleted section. If there was an error we return an empty
string and log the error into the server console.
OrganizationAction.prototype.updateSection
Get all of the sections in a course
args = {
course: UUID of course
}
Returns an array of all the sections associated with the course. If there was an error
we return an empty array and we log the error into the server log.
OrganizationAction.prototype.sectionsInCourse
To get all of the resources in a section args = { appType : (for ES) section : UUID of section } Returns the resources in a section. If there was an error we return an empty array and log the error in the console.
OrganizationAction.prototype.resourcesInSection
Gets count of all of the resources in particular course.
args = {
course : UUID of course
}
Returns number of materials in resource. If there was an error we will return -1.
We will then write the error to the server console.
OrganizationAction.prototype.numberOfResourcesInCourse
This will return the name of the section which owns the indicated resource UUID
args = {
material : UUID of the resource
}
This will return a string which represents the title. If there was an error, an empty
string will be returned and an error will be logged in the server console.
OrganizationAction.prototype.getSectionTitleByResourceUUID
Gets list of all of the resources in particular course.
args = {
course : UUID of course
}
Returns the of list of resource. If there was an error, we return an empty array
and log an error into the server console.
OrganizationAction.prototype.getResourcesByCourseUUID
module.exports = new OrganizationAction;