models

package
v0.0.0-...-3c38824 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIGetVivaQuestionsRequest

type AIGetVivaQuestionsRequest struct {
	Code       string `json:"code"`
	QuestionID uint   `json:"questionID"`
}

type AIGiveHintRequest

type AIGiveHintRequest struct {
	Code       string `json:"code"`
	Language   string `json:"language"`
	QuestionID uint   `json:"questionID"`
}

type AIVerifyConstraintsAssignmentRequest

type AIVerifyConstraintsAssignmentRequest struct {
	AssignmentID uint `json:"assignmentID"`
}

type AIVerifyConstraintsInstantTestRequest

type AIVerifyConstraintsInstantTestRequest struct {
	PrivateCode string `json:"privateCode"`
}

AI Stuff

type AddStudentToBlacklistRequest

type AddStudentToBlacklistRequest struct {
	AssignmentID uint `json:"assignmentID"`
}

type AddUserToClassroomRequest

type AddUserToClassroomRequest struct {
	ClassroomCode string `json:"classroomCode"`
}

type Answer

type Answer struct {
	gorm.Model
	ParentID            uint               `json:"parentID"`
	ParentType          string             `json:"parentType"`
	QuestionID          uint               `json:"questionID"`
	Code                string             `json:"code"`
	TestCases           []VerifiedTestCase `gorm:"constraint:OnDelete:CASCADE;" json:"testCases"`
	Score               int                `json:"score"`               // total score for this particular question
	AIVerified          bool               `json:"AIVerified"`          // if AI has verified the code
	AIVerdict           bool               `json:"AIVerdict"`           // if AI has verified the code, this is the verdict. If true, it means it's aproved. else something is fishy
	AIVerdictFailReason string             `json:"AIVerdictFailReason"` // if AI has flagged this answer, the reason why
	AIVivaScore         int                `json:"AIVivaScore"`         // how many viva questions did the student answer correctly
	AIVivaTaken         bool               `json:"AIVivaTaken"`         // if the student has taken the viva, or somehow hit back and not answered
}

type Assignment

type Assignment struct {
	gorm.Model
	Name                    string                 `json:"name"`
	Description             string                 `json:"description"`
	StartTime               time.Time              `json:"startTime"`
	EndTime                 time.Time              `json:"endTime"`
	EnableAIViva            bool                   `json:"enableAIViva"`
	EnableAIHint            bool                   `json:"enableAIHint"`
	EnableLeaderboard       bool                   `json:"enableLeaderboard"`
	MaxWindowChangeAttempts int                    `json:"maxWindowChangeAttempts"`
	Classrooms              []Classroom            `gorm:"many2many:assignment_classroom;" json:"classrooms"`
	Questions               []Question             `gorm:"polymorphic:Parent;" json:"questions"`
	BlacklistedStudents     []User                 `gorm:"many2many:assignment_user_blacklist;" json:"blacklistedStudents"` // students who've been caught cheating
	Submissions             []AssignmentSubmission `gorm:"foreignKey:AssignmentID" json:"submissions"`
}

aka test

type AssignmentSubmission

type AssignmentSubmission struct {
	gorm.Model
	AssignmentID uint     `json:"assignmentID"`
	UserID       uint     `json:"userID"`
	UniversityID string   `json:"universityID"`
	Answers      []Answer `gorm:"polymorphic:Parent;" json:"answers"`
	TotalScore   int      `json:"totalScore"`
}

type AssignmentSubmitRequest

type AssignmentSubmitRequest struct {
	Code         string `json:"code"`
	Language     string `json:"language"`
	AssignmentID uint   `json:"assignmentID"` // this will be the test ID of the test stored in the database
	QuestionID   uint   `json:"questionID"`
}

type ChangeActiveStatusInstantTestRequest

type ChangeActiveStatusInstantTestRequest struct {
	PrivateCode string `json:"privateCode"`
	Active      bool   `json:"active"`
}

type Classroom

type Classroom struct {
	gorm.Model
	Name        string       `json:"name"`
	Code        string       `json:"code"`        // this is the code that students will use to join the classroom
	TeacherCode string       `json:"teacherCode"` // this is the code that teachers will use to join the classroom
	Users       []User       `json:"users" gorm:"many2many:user_classroom;"`
	Assignments []Assignment `json:"assignments" gorm:"many2many:assignment_classroom;"`
}

aka class

type CreateAssignmentRequest

type CreateAssignmentRequest struct {
	Name                    string     `json:"name"`
	Description             string     `json:"description"`
	Questions               []Question `json:"questions"`
	ClassroomIDs            []uint     `json:"classroomIDs"` // IDs of the classroom the assignment is to be assigned to
	StartTime               time.Time  `json:"startTime"`    // start time of the assignment
	EndTime                 time.Time  `json:"endTime"`      // end time of the assignment
	EnableAIViva            bool       `json:"enableAIViva"`
	EnableAIHint            bool       `json:"enableAIHint"`
	EnableLeaderboard       bool       `json:"enableLeaderboard"`
	MaxWindowChangeAttempts int        `json:"maxWindowChangeAttempts"`
}

type CreateClassroomRequest

type CreateClassroomRequest struct {
	Name string `json:"name"`
}

type CreateInstantTestRequest

type CreateInstantTestRequest struct {
	Questions []Question `json:"questions"`
	Email     string     `json:"email"`
}

type ExampleTestCase

type ExampleTestCase struct {
	gorm.Model
	QuestionID     uint   `json:"questionID"`
	Input          string `json:"input"`
	ExpectedOutput string `json:"expectedOutput"`
	Score          int    `json:"score"`
	Explanation    string `json:"explanation"`
}

type ExcuseStudentFromBlacklistRequest

type ExcuseStudentFromBlacklistRequest struct {
	AssignmentID uint `json:"assignmentID"`
	StudentID    uint `json:"studentID"`
}

type ForgotPasswordRequest

type ForgotPasswordRequest struct {
	UniversityID string `json:"universityID"`
}

type GetAssignmentForEditRequest

type GetAssignmentForEditRequest struct {
	AssignmentID uint `json:"assignmentID"`
}

type GetAssignmentLeaderboardRequest

type GetAssignmentLeaderboardRequest struct {
	AssignmentID uint `json:"assignmentID"`
}

type GetAssignmentRequest

type GetAssignmentRequest struct {
	ClassroomCode string `json:"classroomCode"`
	AssignmentID  uint   `json:"assignmentID"`
}

type GetAssignmentSubmissionsRequest

type GetAssignmentSubmissionsRequest struct {
	AssignmentID uint `json:"assignmentID"`
}

type GetInstantTestRequest

type GetInstantTestRequest struct {
	PublicCode string `json:"publicCode"`
}

type GetStudentSubmissionRequest

type GetStudentSubmissionRequest struct {
	AssignmentID uint `json:"assignmentID"`
}

type InstantTest

type InstantTest struct {
	gorm.Model
	Email                    string                  `json:"email"`
	PrivateCode              string                  `json:"privateCode"`
	PublicCode               string                  `json:"publicCode"`
	IsActive                 bool                    `json:"isActive"`
	Questions                []Question              `gorm:"polymorphic:Parent;" json:"questions"`
	Submissions              []InstantTestSubmission `gorm:"foreignKey:InstantTestID" json:"submissions"`
	BlacklistedUniversityIDs pq.StringArray          `json:"blacklistedUniversityIDs" gorm:"type:text[]"` // students who've been caught cheatingy
}

Instant tests are tests that are created on the fly by teachers. Private code is not shared. This code is used to edit the test Public code is shared with students. This code is used to attempt the test

type InstantTestGetSubmissionsRequest

type InstantTestGetSubmissionsRequest struct {
	PrivateCode string `json:"privateCode"`
}

type InstantTestSubmission

type InstantTestSubmission struct {
	gorm.Model
	InstantTestID uint     `json:"instantTestID"`
	UniversityID  string   `json:"universityID"`
	Answers       []Answer `gorm:"polymorphic:Parent;" json:"answers"`
	TotalScore    int      `json:"totalScore"`
}

type InstantTestSubmitRequest

type InstantTestSubmitRequest struct {
	Code         string `json:"code"`
	Language     string `json:"language"`
	PublicCode   string `json:"publicCode"` // this will be the public code of the test stored in the database
	UniversityID string `json:"universityID"`
	QuestionID   uint   `json:"questionID"`
}

type IsTeacherFromTokenRequest

type IsTeacherFromTokenRequest struct {
	Token string `json:"token"`
}

type ListAssignmentsRequest

type ListAssignmentsRequest struct {
	ClassroomCode string `json:"classroomCode"`
}

type PopulateGoogleSheetAssignmentSubmissionsRequest

type PopulateGoogleSheetAssignmentSubmissionsRequest struct {
	AssignmentID    uint   `json:"assignmentID"`
	GoogleSheetLink string `json:"googleSheetLink"`
}

type PopulateGoogleSheetInstantTestSubmissionsRequest

type PopulateGoogleSheetInstantTestSubmissionsRequest struct {
	PrivateCode     string `json:"privateCode"`
	GoogleSheetLink string `json:"googleSheetLink"`
}

type Question

type Question struct {
	gorm.Model
	ParentID       uint              `json:"parentID"`
	ParentType     string            `json:"parentType"`
	Title          string            `json:"title"`
	Question       string            `json:"question"`
	ExampleCases   []ExampleTestCase `json:"exampleCases"`
	PreWrittenCode string            `json:"preWrittenCode"`
	TestCases      []TestCase        `json:"testCases"`
	Constraints    pq.StringArray    `json:"constraints" gorm:"type:text[]"` // list of constraints that the code must satisfy. Used for AI Verification
	Languages      pq.StringArray    `json:"languages" gorm:"type:text[]"`   // languages the student is allowed to submit in
}

type ResetPasswordRequest

type ResetPasswordRequest struct {
	Token       string `json:"token"`
	NewPassword string `json:"newPassword"`
}

type RunRequest

type RunRequest struct {
	Code     string `json:"code"`
	Language string `json:"language"` // this will be the extension of the file. Example: "py" for python, "c" for C, "cpp" for C++, "java" for Java
	Input    string `json:"input"`
}

this is the request for /run. It only runs the given code and sends the output back

type SaveEditedAssignmentRequest

type SaveEditedAssignmentRequest struct {
	EditedAssignment Assignment `json:"editedAssignment"`
}

type SetVivaScoreRequest

type SetVivaScoreRequest struct {
	QuestionID   uint `json:"questionID"`
	AssignmentID uint `json:"assignmentID"`
	Score        int  `json:"score"`
}

type SignInRequestEmail

type SignInRequestEmail struct {
	Email     string `json:"email"`
	Password  string `json:"password"`
	IsTeacher bool   `json:"isTeacher"` // true if the user is a teacher. Else, they are a student
}

type SignInRequestUniversityID

type SignInRequestUniversityID struct {
	UniversityID string `json:"universityID"`
	Password     string `json:"password"`
}

type SignUpRequest

type SignUpRequest struct {
	UniversityID string `json:"universityID"`
	Name         string `json:"name"`
	Email        string `json:"email"`
	Password     string `json:"password"`
	IsTeacher    bool   `json:"isTeacher"` // true if the registering user is a teacher. Else, they are a student
}

type TestCase

type TestCase struct {
	gorm.Model
	QuestionID     uint   `json:"questionID"`
	Input          string `json:"input"`
	ExpectedOutput string `json:"expectedOutput"`
	Score          int    `json:"score"`
}

type User

type User struct {
	gorm.Model
	UniversityID string                 `json:"universityID"` // this may be employee ID or student ID (EMP ID and SRN in terms of PES)
	Name         string                 `json:"name"`
	Email        string                 `json:"email"`
	Password     string                 `json:"password"`
	IsTeacher    bool                   `json:"isTeacher"`
	Classrooms   []Classroom            `gorm:"many2many:user_classroom;" json:"classrooms"`
	Submissions  []AssignmentSubmission `json:"submissions"`
}

type VerifiedTestCase

type VerifiedTestCase struct {
	gorm.Model
	AnswerID       uint   `json:"answerID"`
	Passed         bool   `json:"passed"`
	Input          string `json:"input"`
	ExpectedOutput string `json:"expectedOutput"`
	ProducedOutput string `json:"producedOutput"`
}

Jump to

Keyboard shortcuts

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