database

package
v0.0.0-...-4a4d21a Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *gorm.DB

Functions

func GetTestReportByReportID

func GetTestReportByReportID(reportId string) (StudentReport, []TestResults, error)

This generates the report of a paricular student based on his/her reportID.

Types

type Data

type Data struct {
	StudentReport StudentReport
	TestResults   []TestResults
}

func SaveStudentReport

func SaveStudentReport(report *ReportInput, testResults []TestResultsInput) (Data, error)

Saves new student report

type Notification

type Notification struct {
	ID          string `gorm:"primary_key;not null"`
	StudentName string
	StudentID   string
	Message     string `gorm:"type:text"`
	CreatedAt   string `gorm:"unique;not null"`
	Type        string `gorm:"default:'ADMIN'"`
	MarkRead    bool   `gorm:"default: false"`
	Total       int    `gorm:"-"`
}

func AllNotifications

func AllNotifications() ([]Notification, error)

func GetAdminNotificationByStudentID

func GetAdminNotificationByStudentID(studentId string) ([]Notification, error)

func MarkNotificationAsRead

func MarkNotificationAsRead(notificationId string) (Notification, error)

func NotificationsStudentList

func NotificationsStudentList(createdAt string) ([]Notification, error)

type NotificationInput

type NotificationInput struct {
	StudentName string
	StudentID   string
}

type ReportInput

type ReportInput struct {
	ID                   string `json:"id"`
	StudentID            string `json:"studentId"`
	TeacherID            string `json:"teacherId"`
	Date                 string `json:"date"`
	HwCompletion         string `json:"hwCompletion"`
	VocabularyCompletion string `json:"vocabularyCompletion"`
	ClassParticipation   string `json:"classParticipation"`
	DictionaryUse        string `json:"dictionaryUse"`
	TestCorrection       string `json:"testCorrection"`
	Feedback             string `json:"feedback"`
	ConversationClub     bool   `json:"conversationClub"`
	Workshops            bool   `json:"workshop"`
	MovieClub            bool   `json:"movieClub"`
	ReadingClub          bool   `json:"readingClub"`
}

type Response

type Response struct {
	ID          string `json:"id"`
	Status      bool   `json:"status"`
	Message     string `json:"message"`
	Token       string `json:"token"`
	Role        string
	StudentName string
}

func AddNewStudent

func AddNewStudent(input StudentInput, imageData string) (Response, error)

Adds new student in db..

func AddNewTeacher

func AddNewTeacher(input TeacherInput) (Response, error)

Adds new teacher into the db...

func AddStudentNotification

func AddStudentNotification(notificationInput []NotificationInput, message string) (Response, error)

func AdminLogin

func AdminLogin(username, password string) (Response, error)

Login for Admin..

func Login

func Login(username, password string) (Response, error)

Logs in user based on his role of teacher or parent.

func UpdateStudentByStudentID

func UpdateStudentByStudentID(input StudentInput) (Response, error)

func UpdateTeacherByTeacherID

func UpdateTeacherByTeacherID(input TeacherInput) (Response, error)

type Student

type Student struct {
	ID          string `gorm:"primary_key;not null"`
	StudentName string
	Status      int
	TeacherID   string
	ParentName  string
	Username    string
	Password    string
	TeacherName string `gorm:"-"`
	ImageUrl    string
}

func GetStudentDetails

func GetStudentDetails(studentId string) (Student, error)

Fetches student details for admin

type StudentInput

type StudentInput struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Status     int    `json:"status"`
	TeacherID  string `json:"teacherId"`
	ParentName string `json:"parentName"`
	Username   string `json:"username"`
	Password   string `json:"password"`
}

type StudentList

type StudentList struct {
	Name     string `json:"name"`
	ID       string `json:"id"`
	Date     string `json:"date"`
	Subject  string `json:"subject"`
	Teacher  string `json:"teacher"`
	ImageUrl string
}

func GetStudentList

func GetStudentList(teacherId string) ([]StudentList, error)

Fetches the list of students for given teacher id.

func GetStudentListForAdmin

func GetStudentListForAdmin() ([]StudentList, error)

Generates student list for admin

type StudentReport

type StudentReport struct {
	ID                   string `gorm:"primary_key;not null"`
	StudentID            string `gorm:"not null"`
	Date                 string `gorm:"type:varchar(10)"`
	HwCompletion         string
	VocabularyCompletion string
	ClassParticipation   string
	DictionaryUse        string
	ConversationClub     bool
	Workshops            bool
	MovieClub            bool
	ReadingClub          bool
	MarkRead             bool
	TestCorrection       string
	Feedback             string
	TeacherID            string
	Type                 string `gorm:"default:'TEACHER'"`
}

func GetStudentTestReportsByStudentID

func GetStudentTestReportsByStudentID(studentId string) ([]StudentReport, error)

This generates all the Test Reports of a particular student based on his StudentID.

func MarkReportAsRead

func MarkReportAsRead(reportId string) (StudentReport, error)

Mark the report as read.

func UpdateStudentReportByReportID

func UpdateStudentReportByReportID(report *ReportInput, testResults []TestResultsInput) (StudentReport, error)

Updates the previous student report..

type Teacher

type Teacher struct {
	ID       string `gorm:"primary_key;not null"`
	Name     string
	Subject  string
	Username string
	Password string
	Count    int `gorm:"-"`
}

func GetTeacherByTeacherID

func GetTeacherByTeacherID(teacherId string) (Teacher, error)

Gets teacher details by teacher id for admin

func TeachersList

func TeachersList() ([]Teacher, error)

List of teachers for admin..

type TeacherInput

type TeacherInput struct {
	ID       string
	Name     string
	Subject  string
	Username string
	Password string
}

type TestResults

type TestResults struct {
	ID             string `gorm:"primary_key;not null"`
	StudentID      string `gorm:"not null"`
	Date           string `gorm:"type:varchar(10)"`
	Reference      string
	TotalQuestions int
	CorrectAnswers float64
	ReportID       string `gorm:"not null"`
}

type TestResultsInput

type TestResultsInput struct {
	ID             string  `json:"id"`
	Date           string  `json:"date"`
	Reference      string  `json:"reference"`
	TotalQuestions int     `json:"totalQuestions"`
	CorrectAnswers float64 `json:"correctAnswers"`
	ReportID       *string
}

type User

type User struct {
	ID       int    `gorm:"primary_key;not null; auto_increment"`
	Username string `gorm:"unique;not null"`
	Password string
}

Jump to

Keyboard shortcuts

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