web

package
v0.0.0-...-8391151 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrGroupNameDuplicate = connect.NewError(connect.CodeAlreadyExists, errors.New("group name already in use"))
	ErrGroupNameTooLong   = connect.NewError(connect.CodeInvalidArgument, errors.New("group name is too long"))
	ErrGroupNameInvalid   = connect.NewError(connect.CodeInvalidArgument, errors.New("group name contains invalid characters"))
	ErrUserNotInGroup     = connect.NewError(connect.CodeNotFound, errors.New("user is not in group"))
)
View Source
var ErrContextCanceled = errors.New("context canceled because the github interaction took too long. Please try again later")

ErrContextCanceled indicates that method failed because of scm interaction that took longer than expected and not because of some application error

Functions

func MockClient

MockClient returns a QuickFeed client for invoking RPCs.

Types

type BaseHookOptions

type BaseHookOptions struct {
	BaseURL string
	Secret  string
}

BaseHookOptions store the application's callback url and secret

type QuickFeedService

type QuickFeedService struct {
	qfconnect.UnimplementedQuickFeedServiceHandler
	// contains filtered or unexported fields
}

QuickFeedService holds references to the database and other shared data structures.

func NewQuickFeedService

func NewQuickFeedService(logger *zap.Logger, db database.Database, mgr *scm.Manager, bh BaseHookOptions, runner ci.Runner) *QuickFeedService

NewQuickFeedService returns a QuickFeedService object.

func (*QuickFeedService) CreateBenchmark

CreateBenchmark adds a new grading benchmark for an assignment.

func (*QuickFeedService) CreateCourse

CreateCourse creates a new course.

func (*QuickFeedService) CreateCriterion

CreateCriterion adds a new grading criterion for an assignment.

func (*QuickFeedService) CreateEnrollment

CreateEnrollment enrolls a new student for the course specified in the request.

func (*QuickFeedService) CreateGroup

CreateGroup creates a new group in the database. Access policy: Any User enrolled in course and specified as member of the group or a course teacher.

func (*QuickFeedService) CreateReview

CreateReview adds a new submission review.

func (*QuickFeedService) DeleteBenchmark

DeleteBenchmark removes a grading benchmark.

func (*QuickFeedService) DeleteCriterion

DeleteCriterion removes a grading criterion for an assignment.

func (*QuickFeedService) DeleteGroup

DeleteGroup removes group record from the database.

func (*QuickFeedService) GetAssignments

GetAssignments returns a list of all assignments for the given course.

func (*QuickFeedService) GetCourse

GetCourse returns course information for the given course.

func (*QuickFeedService) GetCourses

GetCourses returns a list of all courses.

func (*QuickFeedService) GetEnrollments

GetEnrollments returns all enrollments for the given course ID or user ID and enrollment status.

func (*QuickFeedService) GetGroup

GetGroup returns information about the given group ID, or the given user's course group if group ID is 0.

func (*QuickFeedService) GetGroupsByCourse

GetGroupsByCourse returns groups created for the given course.

func (*QuickFeedService) GetOrganization

GetOrganization fetches a github organization by name.

func (*QuickFeedService) GetRepositories

GetRepositories returns URL strings for repositories of given type for the given course.

func (*QuickFeedService) GetSubmission

GetSubmission returns a fully populated submission matching the given submission ID if it exists for the given course ID. Used in the frontend to fetch a full submission for a given submission ID and course ID.

func (*QuickFeedService) GetSubmissions

GetSubmissions returns the submissions matching the query encoded in the action request.

func (*QuickFeedService) GetSubmissionsByCourse

GetSubmissionsByCourse returns a map of submissions for the given course ID. The map is keyed by either the group ID or enrollment ID depending on request type. SubmissionRequest_GROUP returns a map keyed by group ID. SubmissionRequest_ALL and SubmissionRequest_USER return a map keyed by enrollment ID. The map values are lists of all submissions for the given group or enrollment.

func (*QuickFeedService) GetUser

GetUser will return current user with active course enrollments to use in separating teacher and admin roles

func (*QuickFeedService) GetUsers

GetUsers returns a list of all users. Frontend note: This method is called from AdminPage.

func (*QuickFeedService) IsEmptyRepo

IsEmptyRepo ensures that group repository is empty and can be deleted.

func (*QuickFeedService) NewQuickFeedHandler

func (s *QuickFeedService) NewQuickFeedHandler(tm *auth.TokenManager) (string, http.Handler)

func (*QuickFeedService) RebuildSubmissions

RebuildSubmissions re-runs the tests for the given assignment and course. A single submission is executed again if the request specifies a submission ID or all submissions if no submission ID is specified.

func (*QuickFeedService) RegisterRouter

func (s *QuickFeedService) RegisterRouter(tm *auth.TokenManager, authConfig *oauth2.Config, public string) *http.ServeMux

RegisterRouter registers http endpoints for authentication API and scm provider webhooks.

func (*QuickFeedService) SubmissionStream

SubmissionStream adds the the created stream to the stream service. The stream may be used to send the submission results to the frontend. The stream is closed when the client disconnects.

func (*QuickFeedService) UpdateAssignments

func (s *QuickFeedService) UpdateAssignments(ctx context.Context, in *connect.Request[qf.CourseRequest]) (*connect.Response[qf.Void], error)

UpdateAssignments updates the course's assignments record in the database by fetching assignment information from the course's test repository.

func (*QuickFeedService) UpdateBenchmark

UpdateBenchmark edits a grading benchmark for an assignment.

func (*QuickFeedService) UpdateCourse

func (s *QuickFeedService) UpdateCourse(ctx context.Context, in *connect.Request[qf.Course]) (*connect.Response[qf.Void], error)

UpdateCourse changes the course information details.

func (*QuickFeedService) UpdateCourseVisibility

func (s *QuickFeedService) UpdateCourseVisibility(ctx context.Context, in *connect.Request[qf.Enrollment]) (*connect.Response[qf.Void], error)

UpdateCourseVisibility allows to edit what courses are visible in the sidebar.

func (*QuickFeedService) UpdateCriterion

UpdateCriterion edits a grading criterion for an assignment.

func (*QuickFeedService) UpdateEnrollments

func (s *QuickFeedService) UpdateEnrollments(ctx context.Context, in *connect.Request[qf.Enrollments]) (*connect.Response[qf.Void], error)

UpdateEnrollments changes status of all pending enrollments for the specified course to approved. If the request contains a single enrollment, it will be updated to the specified status.

func (*QuickFeedService) UpdateGroup

UpdateGroup updates group information, and returns the updated group.

func (*QuickFeedService) UpdateReview

UpdateReview updates a submission review.

func (*QuickFeedService) UpdateSubmission

UpdateSubmission is called to approve the given submission or to undo approval.

func (*QuickFeedService) UpdateSubmissions

UpdateSubmissions approves and/or releases all manual reviews for student submission for the given assignment with the given score.

func (*QuickFeedService) UpdateUser

UpdateUser updates the current users's information and returns the updated user. This function can also promote a user to admin or demote a user.

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewDevelopmentServer

func NewDevelopmentServer(addr string, handler http.Handler) (*Server, error)

func NewProductionServer

func NewProductionServer(addr string, handler http.Handler) (*Server, error)

func (*Server) Serve

func (srv *Server) Serve() error

Serve starts the underlying http server and redirect server, if any. This is a blocking call and must be called last.

func (*Server) Shutdown

func (srv *Server) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the server.

type ServerType

type ServerType func(addr string, handler http.Handler) (*Server, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL