openapi

package
v0.0.0-...-4938e52 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

README

Go API Server for openapi

This API descripes the online evaluation service, as accessed by the user and organizers.

Overview

This server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • API version: 1.0
  • Build date: 2020-05-16T21:31:58.933464+02:00[Europe/Berlin]
Running the server

To run the server, follow these simple steps:

go run main.go

To run the server in a docker container

docker build --network=host -t openapi .

Once the image is built, just run

docker run --rm -it openapi 
Known Issue

Endpoints sharing a common path may result in issues. For example, /v2/pet/findByTags and /v2/pet/:petId will result in an issue with the Gin framework. For more information about this known limitation, please refer to gin-gonic/gin#388 for more information.

A workaround is to manually update the path and handler. Please refer to gin-gonic/gin/issues/205#issuecomment-296155497 for more information.

Documentation

Index

Constants

View Source
const MIN_QUESTIONAIRES int = 5

Variables

This section is empty.

Functions

func FormQuestionsToMap

func FormQuestionsToMap(form Form) map[uuid.UUID]Question

func Index

func Index(c *gin.Context)

Index is the index handler.

func NewRouter

func NewRouter(Db *gorm.DB) *gin.Engine

NewRouter returns a new router.

Types

type AbstractForm

type AbstractForm struct {
	Base
	FormId uuid.UUID `gorm:"type:uuid;" json:"-"`
	Pages  []Page    `gorm:"foreignkey:AbstractFormId" json:"pages"`
}

AbstractForm - Describes an abstract form

type Answer

type Answer struct {
	QuestionaireId uuid.UUID `gorm:"type:uuid;" json:"questionaireId"`

	QuestionId uuid.UUID `gorm:"type:uuid;index:idx_answer" json:"questionId"`
	//BUG(henrik): Concerns must be integrated into the api
	Concerns uuid.UUID `gorm:"type:uuid;index:idx_answer" json:"concerns"`

	NotApplicable bool `json:"notApplicable"`

	Values []string `gorm:"-" json:"values"`
}

type Base

type Base struct {
	Id uuid.UUID `gorm:"type:uuid;primary_key;" json:"id,omitempty"`
}

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(scope *gorm.Scope) error

BeforeCreate will set a UUID rather than numeric ID.

type Cartridge

type Cartridge struct {
	Title           string `xml:"blti:title"`
	Description     string `xml:"blti:description"`
	LaunchUrl       string `xml:"blti:launch_url"`
	SecureLaunchUrl string `xml:"blti:secure_launch_url"`
	Icon            string `xml:"blti:icon"`
}

type Course

type Course struct {
	Base

	ModuleId uuid.UUID `gorm:"type:uuid;" json:"moduleId"`

	FormId uuid.UUID `gorm:"type:uuid;" json:"formId"`

	TermId uuid.UUID `gorm:"type:uuid;" json:"termId"`

	Location string `json:"location"`

	NumberOfStudents int32 `json:"numberOfStudents"`

	Language string `json:"language"`

	// Third-party Key, that identifies a course
	ThirdPartyKey string `json:"thirdPartyKey,omitempty"`

	// current status for sent mails for this course
	Progress string `json:"progress"`

	// Describes whether, this course is published to profs and tutors.
	Clearance string `json:"clearance"`

	Tutors []Tutor `json:"tutors"` //BUG(henrik): Autoload them via GORM
}

type CourseProf

type CourseProf struct {
	Base

	CourseId uuid.UUID `gorm:"type:uuid;" json:"courseId"`

	ProfId uuid.UUID `gorm:"type:uuid;" json:"profId"`
}

CourseProf - creates a link between courses and prof

type CourseProfReport

type CourseProfReport struct {
	Base

	CourseProfId uuid.UUID `gorm:"type:uuid;" json:"courseProfId,omitempty"`

	CourseId uuid.UUID `gorm:"type:uuid;" json:"courseId,omitempty"`

	Generated time.Time `json:"generated,omitempty"`

	CourseReport CourseReport `json:"courseReport,omitempty"`

	// contains results only concerning courseProf
	Sections []ResultSection `json:"sections,omitempty"`
}

type CourseReport

type CourseReport struct {
	Base

	CourseId uuid.UUID `gorm:"type:uuid;" json:"courseId,omitempty"`

	Generated time.Time `json:"generated,omitempty"`

	TutorReports []TutorReport `json:"tutorReports,omitempty"`

	// contains results only concerning course
	Sections []ResultSection `json:"sections,omitempty"`
}

type CourseStats

type CourseStats struct {
	Questionnaires int32 `json:"questionnaires"`
}

type Data

type Data struct {
	BaseUrl       string   `json:"baseUrl"`
	Invitations   []string `json:"invitations"`
	ThirdPartyKey string   `json:"thirdPartyKey"`
	Begin         string   `json:"begin"`
	End           string   `json:"end"`
	Force         int32    `form:"force" json:"force"`
}

type EmptyForm

type EmptyForm struct {
	Base

	Profs []Prof `json:"profs,omitempty"`

	Tutors []Tutor `json:"tutors,omitempty"`

	AbstractForm AbstractForm `json:"abstractForm,omitempty"`

	Course     Course `json:"course,omitempty"`
	ModuleName string `json:"moduleName"`
}

EmptyForm - Empty Form to be completed by student.

type EvalAPI

type EvalAPI struct {
	EvalService EvalService
}

func ProvideEvalAPI

func ProvideEvalAPI(ev EvalService) EvalAPI

func (*EvalAPI) CourseCourseIdStatsGet

func (ev *EvalAPI) CourseCourseIdStatsGet(c *gin.Context)

func (*EvalAPI) CourseprofsCourseProfIdDelete

func (ev *EvalAPI) CourseprofsCourseProfIdDelete(c *gin.Context)

CourseprofsCourseProfIdDelete - Deletes a module by ID

func (*EvalAPI) CourseprofsCourseProfIdGet

func (ev *EvalAPI) CourseprofsCourseProfIdGet(c *gin.Context)

CourseprofsCourseProfIdGet - Get a courseprof by ID

func (*EvalAPI) CourseprofsCourseProfIdPatch

func (ev *EvalAPI) CourseprofsCourseProfIdPatch(c *gin.Context)

CourseprofsCourseProfIdPatch - Change a courseprof by ID

func (*EvalAPI) CourseprofsCourseProfIdReportGet

func (ev *EvalAPI) CourseprofsCourseProfIdReportGet(c *gin.Context)

CourseprofsCourseProfIdReportGet - Get a courseProf report

func (*EvalAPI) CourseprofsGet

func (ev *EvalAPI) CourseprofsGet(c *gin.Context)

CourseprofsGet -

func (*EvalAPI) CourseprofsPost

func (ev *EvalAPI) CourseprofsPost(c *gin.Context)

CourseprofsPost -

func (*EvalAPI) CoursesCourseIdDelete

func (ev *EvalAPI) CoursesCourseIdDelete(c *gin.Context)

CoursesCourseIdDelete - Deletes a module by ID

func (*EvalAPI) CoursesCourseIdGet

func (ev *EvalAPI) CoursesCourseIdGet(c *gin.Context)

CoursesCourseIdGet - Get a course by ID

func (*EvalAPI) CoursesCourseIdInvitationsGet

func (ev *EvalAPI) CoursesCourseIdInvitationsGet(c *gin.Context)

CoursesCourseIdInvitationsGet -

func (*EvalAPI) CoursesCourseIdInvitationsSendPost

func (ev *EvalAPI) CoursesCourseIdInvitationsSendPost(c *gin.Context)

CoursesCourseIdInvitationsSendPost -

func (*EvalAPI) CoursesCourseIdPatch

func (ev *EvalAPI) CoursesCourseIdPatch(c *gin.Context)

CoursesCourseIdPatch - Change a course by ID

func (*EvalAPI) CoursesCourseIdReportGet

func (ev *EvalAPI) CoursesCourseIdReportGet(c *gin.Context)

CoursesCourseIdReportGet - Get a course report

func (*EvalAPI) CoursesCourseIdTutorsGet

func (ev *EvalAPI) CoursesCourseIdTutorsGet(c *gin.Context)

CoursesCourseIdTutorsGet -

func (*EvalAPI) CoursesCourseIdTutorsPost

func (ev *EvalAPI) CoursesCourseIdTutorsPost(c *gin.Context)

CoursesCourseIdTutorsPost -

func (*EvalAPI) CoursesCourseIdTutorsTutorIdDelete

func (ev *EvalAPI) CoursesCourseIdTutorsTutorIdDelete(c *gin.Context)

CoursesCourseIdTutorsTutorIdDelete - Deletes a tutor by ID

func (*EvalAPI) CoursesCourseIdTutorsTutorIdGet

func (ev *EvalAPI) CoursesCourseIdTutorsTutorIdGet(c *gin.Context)

CoursesCourseIdTutorsTutorIdGet - Get a tutor by ID

func (*EvalAPI) CoursesCourseIdTutorsTutorIdPatch

func (ev *EvalAPI) CoursesCourseIdTutorsTutorIdPatch(c *gin.Context)

CoursesCourseIdTutorsTutorIdPatch - Change a tutor by ID

func (*EvalAPI) CoursesCourseIdTutorsTutorIdReportGet

func (ev *EvalAPI) CoursesCourseIdTutorsTutorIdReportGet(c *gin.Context)

CoursesCourseIdTutorsTutorIdReportGet - Get a tutor report

func (*EvalAPI) CoursesGet

func (ev *EvalAPI) CoursesGet(c *gin.Context)

CoursesGet -

func (*EvalAPI) CoursesPost

func (ev *EvalAPI) CoursesPost(c *gin.Context)

CoursesPost -

func (*EvalAPI) CreateUserPost

func (ev *EvalAPI) CreateUserPost(c *gin.Context)

func (*EvalAPI) FacultiesFacultyIdGet

func (ev *EvalAPI) FacultiesFacultyIdGet(c *gin.Context)

FacultiesFacultyIdGet - Get a faculty by ID

func (*EvalAPI) FacultiesFacultyIdPatch

func (ev *EvalAPI) FacultiesFacultyIdPatch(c *gin.Context)

FacultiesFacultyIdPatch - Change a faculty by ID

func (*EvalAPI) FacultiesGet

func (ev *EvalAPI) FacultiesGet(c *gin.Context)

FacultiesGet -

func (*EvalAPI) FacultiesPost

func (ev *EvalAPI) FacultiesPost(c *gin.Context)

FacultiesPost -

func (*EvalAPI) FormsFormIdGet

func (ev *EvalAPI) FormsFormIdGet(c *gin.Context)

FormsFormIdGet - Get a form by ID

func (*EvalAPI) FormsFormIdPatch

func (ev *EvalAPI) FormsFormIdPatch(c *gin.Context)

FormsFormIdPatch - Change a form by ID

func (*EvalAPI) FormsGet

func (ev *EvalAPI) FormsGet(c *gin.Context)

FormsGet -

func (*EvalAPI) FormsPost

func (ev *EvalAPI) FormsPost(c *gin.Context)

FormsPost -

func (*EvalAPI) LTIConfig

func (ev *EvalAPI) LTIConfig(c *gin.Context)

func (*EvalAPI) LTILaunch

func (ev *EvalAPI) LTILaunch(c *gin.Context)

LTILaunch Performs a search in database for a course with the given ID and returns a invitation.

func (*EvalAPI) ModulesGet

func (ev *EvalAPI) ModulesGet(c *gin.Context)

ModulesGet -

func (*EvalAPI) ModulesModuleIdDelete

func (ev *EvalAPI) ModulesModuleIdDelete(c *gin.Context)

ModulesModuleIdDelete - Deletes a module by ID

func (*EvalAPI) ModulesModuleIdGet

func (ev *EvalAPI) ModulesModuleIdGet(c *gin.Context)

ModulesModuleIdGet - Get a module by ID

func (*EvalAPI) ModulesModuleIdPatch

func (ev *EvalAPI) ModulesModuleIdPatch(c *gin.Context)

ModulesModuleIdPatch - Change a module by ID

func (*EvalAPI) ModulesPost

func (ev *EvalAPI) ModulesPost(c *gin.Context)

ModulesPost -

func (*EvalAPI) ProfsGet

func (ev *EvalAPI) ProfsGet(c *gin.Context)

ProfsGet -

func (*EvalAPI) ProfsPost

func (ev *EvalAPI) ProfsPost(c *gin.Context)

ProfsPost -

func (*EvalAPI) ProfsProfIdDelete

func (ev *EvalAPI) ProfsProfIdDelete(c *gin.Context)

ProfsProfIdDelete - Deletes a module by ID

func (*EvalAPI) ProfsProfIdGet

func (ev *EvalAPI) ProfsProfIdGet(c *gin.Context)

ProfsProfIdGet - Get a prof by ID

func (*EvalAPI) ProfsProfIdPatch

func (ev *EvalAPI) ProfsProfIdPatch(c *gin.Context)

ProfsProfIdPatch - Change a prof by ID

func (*EvalAPI) QuestionaireInvitationIdGet

func (ev *EvalAPI) QuestionaireInvitationIdGet(c *gin.Context)

QuestionaireInvitationIdGet -

func (*EvalAPI) QuestionaireInvitationIdPost

func (ev *EvalAPI) QuestionaireInvitationIdPost(c *gin.Context)

QuestionaireInvitationIdPost -

func (*EvalAPI) StatusGet

func (ev *EvalAPI) StatusGet(c *gin.Context)

func (*EvalAPI) TermsGet

func (ev *EvalAPI) TermsGet(c *gin.Context)

TermsGet -

func (*EvalAPI) TermsPost

func (ev *EvalAPI) TermsPost(c *gin.Context)

TermsPost -

func (*EvalAPI) TermsTermIdGet

func (ev *EvalAPI) TermsTermIdGet(c *gin.Context)

TermsTermIdGet - Get a term by ID

func (*EvalAPI) TermsTermIdPatch

func (ev *EvalAPI) TermsTermIdPatch(c *gin.Context)

TermsTermIdPatch - Change a term by ID

func (*EvalAPI) TermsTermIdReportGet

func (ev *EvalAPI) TermsTermIdReportGet(c *gin.Context)

TermsTermIdReportGet - Get a term report

func (*EvalAPI) UsersGet

func (ev *EvalAPI) UsersGet(c *gin.Context)

type EvalRepository

type EvalRepository struct {
	DB *gorm.DB
}

func ProvideEvalRepository

func ProvideEvalRepository(DB *gorm.DB) EvalRepository

ProvideEvalRepository provides Eval Repository

func (*EvalRepository) AvgPerConcern

func (ev *EvalRepository) AvgPerConcern(objectId, questionId uuid.UUID) float32

func (*EvalRepository) AvgPerQuestion

func (ev *EvalRepository) AvgPerQuestion(questionId uuid.UUID) float32

func (*EvalRepository) CountNotApplicable

func (ev *EvalRepository) CountNotApplicable(questionId uuid.UUID, objectId uuid.UUID) int

func (*EvalRepository) CountOfQuestionaires

func (ev *EvalRepository) CountOfQuestionaires(courseId uuid.UUID) int

func (*EvalRepository) CountPerOption

func (ev *EvalRepository) CountPerOption(questionId uuid.UUID, objectId uuid.UUID) ([]Pair, error)

func (*EvalRepository) CountTutor

func (ev *EvalRepository) CountTutor(questionId uuid.UUID, objectId uuid.UUID) int

CountTutor counts the number the tutor is named, question ID can be null, if question is unique

func (*EvalRepository) CreateUser

func (ev *EvalRepository) CreateUser(name, firstname, lastname, password string) (User, error)

func (*EvalRepository) DeleteAllInvitationsOfCourse

func (ev *EvalRepository) DeleteAllInvitationsOfCourse(courseId uuid.UUID) error

func (*EvalRepository) DeleteAllQuestionairesAndSingleAnswersOfCourse

func (ev *EvalRepository) DeleteAllQuestionairesAndSingleAnswersOfCourse(courseId uuid.UUID) error

func (*EvalRepository) DeleteCourse

func (ev *EvalRepository) DeleteCourse(id uuid.UUID) error

func (*EvalRepository) DeleteCourseProf

func (ev *EvalRepository) DeleteCourseProf(id uuid.UUID) error

func (*EvalRepository) DeleteModule

func (ev *EvalRepository) DeleteModule(id uuid.UUID) error

func (*EvalRepository) DeleteProf

func (ev *EvalRepository) DeleteProf(id uuid.UUID) error

func (*EvalRepository) DeleteTutor

func (ev *EvalRepository) DeleteTutor(courseId, tutorId uuid.UUID) error

func (*EvalRepository) FindAllCourseProfs

func (ev *EvalRepository) FindAllCourseProfs(courseId uuid.UUID, profId uuid.UUID) []CourseProf

FindAllCourseProfs returns all courseprofs

func (*EvalRepository) FindAllCourseProfsForCourse

func (ev *EvalRepository) FindAllCourseProfsForCourse(courseId uuid.UUID) ([]Prof, error)

FindAllCourseProfsForCourse returns all courseProfs profs with id = courseProfId

func (*EvalRepository) FindAllCourseTutors

func (ev *EvalRepository) FindAllCourseTutors(courseId uuid.UUID) ([]Tutor, error)

FindAllTutors returns all tutors

func (*EvalRepository) FindAllCourses

func (ev *EvalRepository) FindAllCourses() []Course

FindAllCourses returns all Courses

func (*EvalRepository) FindAllFaculties

func (ev *EvalRepository) FindAllFaculties() []Faculty

FindAllFaculties returns all Faculties

func (*EvalRepository) FindAllForms

func (ev *EvalRepository) FindAllForms() []Form

FindAllForms loads all forms and their abstractForms

func (*EvalRepository) FindAllModules

func (ev *EvalRepository) FindAllModules() []Module

FindAllModules returns all modules

func (*EvalRepository) FindAllProfs

func (ev *EvalRepository) FindAllProfs() []Prof

FindAllProfs returns all profs

func (*EvalRepository) FindAllSingleAnswers

func (ev *EvalRepository) FindAllSingleAnswers(questionId, objectId uuid.UUID) []SingleAnswer

func (*EvalRepository) FindAllTerms

func (ev *EvalRepository) FindAllTerms() []Term

FindAllTerms find all terms.

func (*EvalRepository) FindCourse

func (ev *EvalRepository) FindCourse(id uuid.UUID) (Course, error)

FindCourse finds a course by id

func (*EvalRepository) FindCourseByThirdPartyKey

func (ev *EvalRepository) FindCourseByThirdPartyKey(thirdPartyKey string) (Course, error)

FindCourseByThirdPartyKey finds a course By ThirdPartyKey

func (*EvalRepository) FindCourseInvitations

func (ev *EvalRepository) FindCourseInvitations(courseId uuid.UUID) ([]Invitation, error)

func (*EvalRepository) FindCourseProf

func (ev *EvalRepository) FindCourseProf(id uuid.UUID) (CourseProf, error)

func (*EvalRepository) FindFaculty

func (ev *EvalRepository) FindFaculty(id uuid.UUID) (Faculty, error)

FindFaculty finds a specific faculty

func (*EvalRepository) FindForm

func (ev *EvalRepository) FindForm(id uuid.UUID) (Form, error)

func (*EvalRepository) FindInvitation

func (ev *EvalRepository) FindInvitation(id uuid.UUID) (Invitation, error)

func (*EvalRepository) FindModule

func (ev *EvalRepository) FindModule(id uuid.UUID) (Module, error)

FindModule finds a module by id

func (*EvalRepository) FindProf

func (ev *EvalRepository) FindProf(id uuid.UUID) (Prof, error)

FindProf finds a prof by id

func (*EvalRepository) FindTerm

func (ev *EvalRepository) FindTerm(id uuid.UUID) (Term, error)

FindTerm Finds a specific Term

func (*EvalRepository) FindTutor

func (ev *EvalRepository) FindTutor(courseId, tutorId uuid.UUID) (Tutor, error)

func (*EvalRepository) FindUserByName

func (ev *EvalRepository) FindUserByName(name string) User

func (*EvalRepository) FindUserByNameAndPW

func (ev *EvalRepository) FindUserByNameAndPW(name, password string) User

func (*EvalRepository) FindUsers

func (ev *EvalRepository) FindUsers() ([]User, error)

func (*EvalRepository) GetCount

func (ev *EvalRepository) GetCount(tablename string) int32

func (*EvalRepository) GetInvitationForLTIAssignment

func (ev *EvalRepository) GetInvitationForLTIAssignment(courseId uuid.UUID, userId string) (string, error)

func (*EvalRepository) InvalidateInvitationAndCommitQuestionaire

func (ev *EvalRepository) InvalidateInvitationAndCommitQuestionaire(invitationId uuid.UUID, quest Questionaire) error

func (*EvalRepository) Save

func (ev *EvalRepository) Save(fac Faculty) Faculty

Save upserts a faculty, i.e. if a faculty with this id exists it will be created.

func (*EvalRepository) SaveCourse

func (ev *EvalRepository) SaveCourse(course Course) Course

SaveCourse upserts a term, i.e. if a course with this id exists it will be created.

func (*EvalRepository) SaveCourseProf

func (ev *EvalRepository) SaveCourseProf(courseprof CourseProf) CourseProf

Save^ upserts a term, i.e. if a courseprof with this id exists it will be created.

func (*EvalRepository) SaveForm

func (ev *EvalRepository) SaveForm(form Form) Form

SaveForm upserts a form, i.e. if a form with this id exists it will be created.

func (*EvalRepository) SaveInvitation

func (ev *EvalRepository) SaveInvitation(invitation Invitation) Invitation

SaveInvitation upserts a term, i.e. if a invitation with this id exists it will be created.

func (*EvalRepository) SaveModule

func (ev *EvalRepository) SaveModule(module Module) Module

SaveModule upserts a term, i.e. if a module with this id exists it will be created.

func (*EvalRepository) SaveProf

func (ev *EvalRepository) SaveProf(prof Prof) Prof

SaveProf upserts a prof, i.e. if a prof with this id exists it will be created.

func (*EvalRepository) SaveTerm

func (ev *EvalRepository) SaveTerm(term Term) Term

SaveTerm upserts a term, i.e. if a term with this id exists it will be created.

func (*EvalRepository) SaveTutor

func (ev *EvalRepository) SaveTutor(tutor Tutor) Tutor

SaveTutor upserts a term, i.e. if a tutor with this id exists it will be created.

func (*EvalRepository) StddevPerConcern

func (ev *EvalRepository) StddevPerConcern(objectId, questionId uuid.UUID) float32

func (*EvalRepository) StddevPerQuestion

func (ev *EvalRepository) StddevPerQuestion(questionId uuid.UUID) float32

type EvalService

type EvalService struct {
	EvalRepository EvalRepository
}

func ProvideEvalService

func ProvideEvalService(rep EvalRepository) EvalService

func (*EvalService) CreateUser

func (ev *EvalService) CreateUser(name, firstname, lastname, pw string) (User, error)

func (*EvalService) DeleteCourse

func (ev *EvalService) DeleteCourse(id uuid.UUID) error

func (*EvalService) DeleteCourseProf

func (ev *EvalService) DeleteCourseProf(id uuid.UUID) error

func (*EvalService) DeleteModule

func (ev *EvalService) DeleteModule(id uuid.UUID) error

func (*EvalService) DeleteProf

func (ev *EvalService) DeleteProf(id uuid.UUID) error

func (*EvalService) DeleteTutor

func (ev *EvalService) DeleteTutor(courseId uuid.UUID, tutorId uuid.UUID) error

func (*EvalService) FindAllCourseProfs

func (ev *EvalService) FindAllCourseProfs(courseId uuid.UUID, profId uuid.UUID) []CourseProf

func (*EvalService) FindAllCourseTutors

func (ev *EvalService) FindAllCourseTutors(courseId uuid.UUID) ([]Tutor, error)

func (*EvalService) FindAllCourses

func (ev *EvalService) FindAllCourses() []Course

func (*EvalService) FindAllFaculties

func (ev *EvalService) FindAllFaculties() []Faculty

func (*EvalService) FindAllForms

func (ev *EvalService) FindAllForms() []Form

func (*EvalService) FindAllModules

func (ev *EvalService) FindAllModules() []Module

func (*EvalService) FindAllProfs

func (ev *EvalService) FindAllProfs() []Prof

func (*EvalService) FindAllTerms

func (ev *EvalService) FindAllTerms() []Term

func (*EvalService) FindAllTutors

func (ev *EvalService) FindAllTutors(courseId uuid.UUID) ([]Tutor, error)

func (*EvalService) FindCourse

func (ev *EvalService) FindCourse(id uuid.UUID) (Course, error)

func (*EvalService) FindCourseProf

func (ev *EvalService) FindCourseProf(id uuid.UUID) (CourseProf, error)

func (*EvalService) FindCourseTutor

func (ev *EvalService) FindCourseTutor(courseId, tutorId uuid.UUID) (Tutor, error)

func (*EvalService) FindFaculty

func (ev *EvalService) FindFaculty(id uuid.UUID) (Faculty, error)

func (*EvalService) FindForm

func (ev *EvalService) FindForm(id uuid.UUID) (Form, error)

func (*EvalService) FindModule

func (ev *EvalService) FindModule(id uuid.UUID) (Module, error)

func (*EvalService) FindOrGenerateCourseInvitations

func (ev *EvalService) FindOrGenerateCourseInvitations(courseId uuid.UUID, begin, end string) ([]Invitation, error)

FindOrGenerateCourseInvitations finds or generates Course Invititations based on no of students, if there is a mismatch in numbers, they will be regenerated

func (*EvalService) FindProf

func (ev *EvalService) FindProf(id uuid.UUID) (Prof, error)

func (*EvalService) FindTerm

func (ev *EvalService) FindTerm(id uuid.UUID) (Term, error)

func (*EvalService) FindUserByName

func (ev *EvalService) FindUserByName(name string) User

func (*EvalService) FindUserByNameAndPW

func (ev *EvalService) FindUserByNameAndPW(name, pw string) User

func (*EvalService) FindUsers

func (ev *EvalService) FindUsers() ([]User, error)

func (*EvalService) GenerateCourseProfReport

func (ev *EvalService) GenerateCourseProfReport(courseprofId uuid.UUID) (CourseProfReport, error)

GenerateCourseReport generates a report for course

func (*EvalService) GenerateCourseReport

func (ev *EvalService) GenerateCourseReport(courseId uuid.UUID) (CourseReport, error)

GenerateCourseReport generates a report for course

func (*EvalService) GenerateTutorReport

func (ev *EvalService) GenerateTutorReport(courseId, tutorId uuid.UUID) (TutorReport, error)

GenerateTutorReport generates a Tutor report

func (*EvalService) GetCounts

func (ev *EvalService) GetCounts() StatusCounts

func (*EvalService) GetCourseStats

func (ev *EvalService) GetCourseStats(courseId uuid.UUID) CourseStats

func (*EvalService) GetInvitationForLTI

func (ev *EvalService) GetInvitationForLTI(infos LTIInfos) (string, error)

func (*EvalService) RenderInvitationToEmptyForm

func (ev *EvalService) RenderInvitationToEmptyForm(invitationID uuid.UUID) (EmptyForm, error)

func (*EvalService) Save

func (ev *EvalService) Save(fac Faculty) Faculty

func (*EvalService) SaveCourse

func (ev *EvalService) SaveCourse(course Course) (Course, error)

func (*EvalService) SaveCourseProf

func (ev *EvalService) SaveCourseProf(courseprof CourseProf) (CourseProf, error)

func (*EvalService) SaveForm

func (ev *EvalService) SaveForm(form Form) Form

func (*EvalService) SaveModule

func (ev *EvalService) SaveModule(module Module) (Module, error)

func (*EvalService) SaveProf

func (ev *EvalService) SaveProf(prof Prof) (Prof, error)

func (*EvalService) SaveTerm

func (ev *EvalService) SaveTerm(term Term) (Term, error)

func (*EvalService) SaveTutor

func (ev *EvalService) SaveTutor(tutor Tutor) (Tutor, error)

func (*EvalService) SendInvitations

func (ev *EvalService) SendInvitations(id uuid.UUID, begin, end string, baseUrl, url string, force int32) (SendStatus, error)

SendInvitations finds or generates invitations and send them to the plattform

func (*EvalService) ValidateAndSaveQuestionaire

func (ev *EvalService) ValidateAndSaveQuestionaire(invitationId uuid.UUID, quest Questionaire) error

ValidateAndSaveQuestionaire validates and saves a questionaire. Beaware, that there can only exist one subteacher in answer

type Faculty

type Faculty struct {
	Base

	Name string `json:"name"`
}

type Form

type Form struct {
	Base

	Name string `json:"name"`

	TermId uuid.UUID `gorm:"type:uuid;" json:"termId"`

	AbstractForm AbstractForm `json:"abstractForm" gorm:"foreignkey:FormId"`
}

type Invitation

type Invitation struct {
	Base

	CourseId uuid.UUID `gorm:"type:uuid;" json:"courseId"`

	ValidBegin string `json:"validBegin"`
	ValidEnd   string `json:"validEnd"`
	Used       bool   `json:"used,omitempty"`
}

Invitation - Onetime invitation to take a certain evaluation of a course.

type LTIAssignment

type LTIAssignment struct {
	InvitationId uuid.UUID `gorm:"type:uuid;" json:"id,omitempty"`
	CustomerHash string
}

type LTIConfig

type LTIConfig struct {
	Cartridge Cartridge `xml:"cartridge_basiclti_link"`
	Blti      string    `xml:"xmlns:blti,attr"`
}

type LTIInfos

type LTIInfos struct {
	CourseId  string
	UserId    string
	IsLearner bool
}

type LabeledObject

type LabeledObject struct {
	// Map of translations for a given string. A string might contain markdown code.
	Label     map[string]string `gorm:"-" json:"label"`
	LabelJson string            `json:"-"`
}

func (*LabeledObject) AfterFind

func (lo *LabeledObject) AfterFind() (err error)

AfterFind is called by GORM

func (*LabeledObject) BeforeSave

func (lo *LabeledObject) BeforeSave() (err error)

BeforeSave is called by GORM

type Module

type Module struct {
	Base

	Name string `json:"name"`

	Description string `json:"description"`

	// Determines which faculty is in charge.
	FacultyId uuid.UUID `gorm:"type:uuid;" json:"facultyId"`
}

Module - used to keep track of courses over many years.

type Option

type Option struct {
	Base
	LabeledObject
	Position   int32     `json:"position"`
	Value      int32     `json:"value"`
	QuestionId uuid.UUID `gorm:"type:uuid" json:"-"`
}

Option - Possibly labeled selection option

type Page

type Page struct {
	Base
	Position       int32     `json:"position"`
	AbstractFormId uuid.UUID `gorm:"type:uuid" json:"-"`
	Sections       []Section `gorm:"foreignkey:PageId" json:"sections"`
}

Page - Group of sections that belong together

type Pair

type Pair struct {
	Value string
	Freq  int
}

type Prof

type Prof struct {
	Base

	Firstname string `json:"firstname"`

	Lastname string `json:"lastname"`

	Title string `json:"title"`

	// Determines, whether public reports can include, this persons results.
	Censored bool `json:"censored"`

	// Date of agreement that results can be published
	CensoredDate string `json:"censoredDate"`

	// Used to communicate to prof.
	Email string `json:"email"`
}

type Question

type Question struct {
	Base
	Position  int32     `json:"position"`
	SectionId uuid.UUID `gorm:"type:uuid" json:"-"`

	// Unique, humanreadable label.
	Shortcode string `json:"shortcode"`

	TitledObject

	// Whether this question is a single choice or multiple choice question
	IsMulti bool `json:"isMulti"`

	// Determines whether it is a free text form. Can not occur with isMulti and hasOtherOption.
	IsComment bool `json:"isComment"`

	// Some questions have an option that allows custom answers
	HasOtherOption bool `json:"hasOtherOption"`

	// Question either concerns course, lecturer or tutor.
	Regards string `json:"regards"`

	// Some questions need a not applicable option.
	HasNotApplicableOption bool `json:"hasNotApplicableOption,omitempty"`

	// isSlider: Render as slider.
	IsSlider bool `json:"isSlider,omitempty"`

	// Defines how results should be displayed.
	Visualizer string `json:"visualizer"`

	// Array of possibly labeled selection options.
	Options []Option `gorm:"foreignkey:QuestionId" json:"options"`
}

type Questionaire

type Questionaire struct {
	Base
	CourseId uuid.UUID
	Answers  []Answer `gorm:"-" json:"answers"`
}

Questionaire - A fully completed form.

type Result

type Result struct {
	Base

	LabeledObject

	// indicate, how result is displayed.
	Visualizer string `json:"visualizer,omitempty"`
	Shortcode  string `json:"shortcode,omitempty"`

	Values             []ResultPair `json:"values,omitempty"`
	NotApplicableCount int          `json:"notApplicableCount,omitempty"`
	// If applicable return the average of this field
	Avg float32 `json:"avg,omitempty"`
	// If applicable return the standard deviation of this answer
	Stddev float32 `json:"stddev,omitempty"`
	// If applicable return the average of this question globally.
	AvgQuestion float32 `json:"avgQuestion,omitempty"`
	// If applicable return the standard deviation  of this question globally.
	StddevQuestion float32 `json:"stddevQuestion,omitempty"`
}

type ResultPair

type ResultPair struct {

	// Map of translations for a given string. A string might contain markdown code.
	LabeledObject

	Value    string `json:"value,omitempty"`
	Position int32  `json:"position,omitempty"`
}

type ResultSection

type ResultSection struct {
	Base
	LabeledObject

	Results []Result `json:"results,omitempty"`
}

type Route

type Route struct {
	// Name is the name of this Route.
	Name string
	// Method is the string for the HTTP method. ex) GET, POST etc..
	Method string
	// Pattern is the pattern of the URI.
	Pattern string
	// HandlerFunc is the handler function of this route.
	HandlerFunc gin.HandlerFunc
}

Route is the information for every URI.

type Routes

type Routes []Route

Routes is the list of the generated Route.

type Section

type Section struct {
	Base

	TitledObject
	Position  int32      `json:"position"`
	PageId    uuid.UUID  `gorm:"type:uuid" json:"-"`
	Questions []Question `gorm:"foreignkey:SectionId" json:"questions"`
}

type SendStatus

type SendStatus struct {
	ErrNo        int    `json:"errno"`
	Vid          string `json:"vid"`
	Participants int    `json:"participants"`
	Assigned     int    `json:"assigned"`
	Overwritten  int    `json:"overwritten"`
	NotChanged   int    `json:"notchanged"`
}

type SingleAnswer

type SingleAnswer struct {
	QuestionaireId uuid.UUID `gorm:"type:uuid;" json:"questionaireId"`

	QuestionId uuid.UUID `gorm:"type:uuid;index:idx_singleanswer" json:"questionId"`
	//BUG(henrik): Concerns must be integrated into the api
	Concerns uuid.UUID `gorm:"type:uuid;index:idx_singleanswer" json:"concerns"`

	NotApplicable bool `json:"notApplicable"`

	Value string `json:"value"`
}

type Status

type Status struct {
	Generated time.Time      `json:"generated,omitempty"`
	Counts    StatusCounts   `json:"counts,omitempty"`
	Sysstats  StatusSysstats `json:"sysstats,omitempty"`
}

Status struct for Status

type StatusCounts

type StatusCounts struct {
	Terms         int32 `json:"terms,omitempty"`
	Tutors        int32 `json:"tutors,omitempty"`
	Options       int32 `json:"options,omitempty"`
	Profs         int32 `json:"profs,omitempty"`
	Courseprofs   int32 `json:"courseprofs,omitempty"`
	Courses       int32 `json:"courses,omitempty"`
	Questionaires int32 `json:"questionaires,omitempty"`
	Singleanswers int32 `json:"singleanswers,omitempty"`
	Invitations   int32 `json:"invitations,omitempty"`
}

StatusCounts struct for StatusCounts

type StatusSysstats

type StatusSysstats struct {
	Ram   float32 `json:"ram,omitempty"`
	Ram10 float32 `json:"ram10,omitempty"`
	Cpu   float32 `json:"cpu,omitempty"`
	Cpu10 float32 `json:"cpu10,omitempty"`
}

StatusSysstats struct for StatusSysstats

type Term

type Term struct {
	Base

	Name string `json:"name"`

	Begin string `json:"begin"`

	End string `json:"end"`
}

type TermReport

type TermReport struct {
	Base

	Generated time.Time `json:"generated,omitempty"`

	TermId uuid.UUID `gorm:"type:uuid;" json:"termId,omitempty"`

	FacultyId uuid.UUID `gorm:"type:uuid;" json:"facultyId,omitempty"`

	Censored bool `json:"censored,omitempty"`

	CourseProfReports []CourseProfReport `json:"courseProfReports,omitempty"`
}

type TitledObject

type TitledObject struct {
	// Map of translations for a given string. A string might contain markdown code.
	Title     map[string]string `gorm:"-" json:"title"`
	TitleJson string            `json:"-"`
}

func (*TitledObject) AfterFind

func (lo *TitledObject) AfterFind() (err error)

AfterFind is called by GORM

func (*TitledObject) BeforeSave

func (lo *TitledObject) BeforeSave() (err error)

BeforeSave is called by GORM

type Tutor

type Tutor struct {
	Base

	Name string `json:"name"`

	// Determines, whether public reports can include, this persons results.
	Censored bool `json:"censored"`

	// Date of agreement that results can be published
	CensoredDate string `json:"censoredDate"`

	// Third-party Key, that identifies a tutor.
	ThirdPartyKey string `json:"thirdPartyKey,omitempty"`

	Email string `json:"email"`

	CourseId uuid.UUID `gorm:"type:uuid;" json:"courseId,omitempty"`
}

Tutor - Subteacher, only sees portions of the results of his course. Currently they are created for every year newly.

type TutorReport

type TutorReport struct {
	Base

	TutorId uuid.UUID `gorm:"type:uuid;" json:"tutorId,omitempty"`

	CourseId uuid.UUID `gorm:"type:uuid;" json:"courseId,omitempty"`

	Generated time.Time `json:"generated,omitempty"`

	Sections []ResultSection `json:"sections,omitempty"`
}

type User

type User struct {
	UserName     string `gorm:"primary_key;"`
	FirstName    string `json:"firstname"`
	LastName     string `json:"lastname"`
	PasswordHash string `json:"-"`
	Password     string `gorm:"-"`
}

User demo

Notes

Bugs

  • if faculty id doesn't exists the faculty will be created.

  • check for errors!

  • Moodle is not standard compliant!

  • return only subset

  • return only subset

  • return only subset

  • Privacy

  • no validity check are done (yet!)

  • no validity check is done (yet!)

  • no validity check is done (yet!)

  • no validity check is done (yet!)

  • no validity check is done (yet!)

  • Use right format in parse!

  • we need the id of courseProf

  • Use right format in parse!

  • add isTutorselect!

  • Concerns must be integrated into the api

  • Concerns must be integrated into the api

  • Autoload them via GORM

  • Replace with db lookup!

  • Replace with db/casbin lookup!

Jump to

Keyboard shortcuts

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