Documentation ¶
Index ¶
- Constants
- func Connect(user string, password string, addr string, tlsConfig *tls.Config) *pg.DB
- func InitTables(db *pg.DB) error
- type Area
- type AuthStore
- func (a AuthStore) DeleteSession(token string) error
- func (a AuthStore) DoPasswordReset(userId string, newPassword string, token string) error
- func (a AuthStore) GetPasswordResetToken(token string) (*auth.PasswordResetToken, error)
- func (a AuthStore) GetSession(token string) (*auth.Session, error)
- func (a AuthStore) GetUserByEmail(email string) (*auth.User, error)
- func (a AuthStore) NewPasswordResetToken(userId string) (*auth.PasswordResetToken, error)
- func (a AuthStore) NewSession(userId string) (*auth.Session, error)
- func (a AuthStore) NewUser(email string, password string, name string, inviteCode string) (*auth.User, error)
- func (a AuthStore) ResolveInviteCode(inviteCodeId string) (*auth.School, error)
- type Class
- type ClassStore
- func (s ClassStore) CheckPermission(userId string, classId string) (bool, error)
- func (s ClassStore) DeleteClass(id string) (int, error)
- func (s ClassStore) GetClass(id string) (*class.Class, error)
- func (s ClassStore) UpdateClass(id string, name string, weekdays []time.Weekday, startTime time.Time, ...) (int, error)
- type Curriculum
- type CurriculumStore
- func (s CurriculumStore) CheckAreaPermissions(areaId string, userId string) (bool, error)
- func (s CurriculumStore) CheckCurriculumPermission(curriculumId string, userId string) (bool, error)
- func (s CurriculumStore) CheckMaterialPermission(materialId string, userId string) (bool, error)
- func (s CurriculumStore) CheckSubjectPermissions(subjectId string, userId string) (bool, error)
- func (s CurriculumStore) DeleteArea(id string) error
- func (s CurriculumStore) DeleteSubject(id string) error
- func (s CurriculumStore) GetArea(areaId string) (*Area, error)
- func (s CurriculumStore) GetAreaSubjects(areaId string) ([]Subject, error)
- func (s CurriculumStore) GetMaterial(materialId string) (*Material, error)
- func (s CurriculumStore) GetSubject(id string) (*Subject, error)
- func (s CurriculumStore) GetSubjectMaterials(subjectId string) ([]Material, error)
- func (s CurriculumStore) NewArea(name string, curriculumId string) (string, error)
- func (s CurriculumStore) NewMaterial(name string, subjectId string) (*Material, error)
- func (s CurriculumStore) NewSubject(name string, areaId string, materials []Material) (*Subject, error)
- func (s CurriculumStore) ReplaceSubject(newSubject Subject) error
- func (s CurriculumStore) UpdateArea(areaId string, name string) error
- func (s CurriculumStore) UpdateMaterial(material *Material, order *int) error
- type EmptyCurriculumError
- type Gender
- type Guardian
- type GuardianRelationship
- type GuardianStore
- func (s GuardianStore) CheckPermission(userId string, guardianId string) (bool, error)
- func (s GuardianStore) DeleteGuardian(id string) (int, error)
- func (s GuardianStore) GetGuardian(id string) (*guardian.Guardian, error)
- func (s GuardianStore) UpdateGuardian(guardian guardian.Guardian) (int, error)
- type GuardianToStudent
- type Material
- type Observation
- type ObservationStore
- func (s ObservationStore) CheckPermissions(observationId string, userId string) (bool, error)
- func (o ObservationStore) DeleteObservation(observationId string) error
- func (o ObservationStore) GetObservation(id string) (*Observation, error)
- func (o ObservationStore) UpdateObservation(observationId string, shortDesc string, longDesc string, categoryId string) (*Observation, error)
- type PasswordResetToken
- type School
- type SchoolStore
- func (s SchoolStore) DeleteCurriculum(schoolId string) error
- func (s SchoolStore) GetCurriculum(schoolId string) (*Curriculum, error)
- func (s SchoolStore) GetCurriculumAreas(schoolId string) ([]Area, error)
- func (s SchoolStore) GetGuardians(schoolId string) ([]Guardian, error)
- func (s SchoolStore) GetSchool(schoolId string) (*School, error)
- func (s SchoolStore) GetSchoolClasses(schoolId string) ([]Class, error)
- func (s SchoolStore) GetStudents(schoolId string) ([]Student, error)
- func (s SchoolStore) NewClass(id string, name string, weekdays []time.Weekday, startTime time.Time, ...) error
- func (s SchoolStore) NewDefaultCurriculum(schoolId string) error
- func (s SchoolStore) NewGuardian(schoolId string, name string, email string, phone string, note string) (Guardian, error)
- func (s SchoolStore) NewSchool(schoolName string, userId string) (*School, error)
- func (s SchoolStore) NewStudent(student Student, classes []string, guardians map[string]int) error
- func (s SchoolStore) RefreshInviteCode(schoolId string) (*School, error)
- type Session
- type Student
- type StudentMaterialProgress
- type StudentStore
- func (s StudentStore) CheckPermissions(studentId string, userId string) (bool, error)
- func (s StudentStore) Delete(studentId string) error
- func (s StudentStore) Get(studentId string) (*Student, error)
- func (s StudentStore) GetObservations(studentId string) ([]Observation, error)
- func (s StudentStore) GetProgress(studentId string) ([]StudentMaterialProgress, error)
- func (s StudentStore) InsertObservation(studentId string, creatorId string, longDesc string, shortDesc string, ...) (*Observation, error)
- func (s StudentStore) Update(student *Student) error
- func (s StudentStore) UpdateProgress(progress StudentMaterialProgress) (pg.Result, error)
- type StudentToClass
- type Subject
- type User
- type UserStore
- type UserToSchool
- type Weekday
Constants ¶
View Source
const (
BCryptCost = 10
)
Variables ¶
This section is empty.
Functions ¶
func InitTables ¶
func InitTables(db *pg.DB) error
Types ¶
type Area ¶
type Area struct { Id string `pg:"type:uuid"` CurriculumId string `pg:"type:uuid,on_delete:CASCADE"` Curriculum Curriculum Name string Subjects []Subject `pg:"fk:area_id"` }
type AuthStore ¶
type AuthStore struct {
DB *pg.DB
}
func (AuthStore) DeleteSession ¶
func (AuthStore) DoPasswordReset ¶
func (AuthStore) GetPasswordResetToken ¶
func (a AuthStore) GetPasswordResetToken(token string) (*auth.PasswordResetToken, error)
func (AuthStore) GetUserByEmail ¶
func (AuthStore) NewPasswordResetToken ¶
func (a AuthStore) NewPasswordResetToken(userId string) (*auth.PasswordResetToken, error)
type Class ¶
type Class struct { Id string `pg:"type:uuid"` SchoolId string `pg:"type:uuid,on_delete:CASCADE"` School School Name string // Only use the time of day and timezone (WIB 8.30AM). // Ignore other data StartTime time.Time `pg:",notnull"` EndTime time.Time `pg:",notnull"` Weekdays []Weekday Students []Student `pg:"many2many:student_to_class,joinFK:class_id"` }
type ClassStore ¶
type ClassStore struct {
DB *pg.DB
}
func (ClassStore) CheckPermission ¶
func (s ClassStore) CheckPermission(userId string, classId string) (bool, error)
func (ClassStore) DeleteClass ¶
func (s ClassStore) DeleteClass(id string) (int, error)
type Curriculum ¶
type CurriculumStore ¶
type CurriculumStore struct {
*pg.DB
}
func (CurriculumStore) CheckAreaPermissions ¶
func (s CurriculumStore) CheckAreaPermissions(areaId string, userId string) (bool, error)
func (CurriculumStore) CheckCurriculumPermission ¶
func (s CurriculumStore) CheckCurriculumPermission(curriculumId string, userId string) (bool, error)
func (CurriculumStore) CheckMaterialPermission ¶
func (s CurriculumStore) CheckMaterialPermission(materialId string, userId string) (bool, error)
func (CurriculumStore) CheckSubjectPermissions ¶
func (s CurriculumStore) CheckSubjectPermissions(subjectId string, userId string) (bool, error)
updateSubject manually replace existing data with new ones completely. Without destroying its relationship with existing data.
func (CurriculumStore) DeleteArea ¶
func (s CurriculumStore) DeleteArea(id string) error
func (CurriculumStore) DeleteSubject ¶
func (s CurriculumStore) DeleteSubject(id string) error
func (CurriculumStore) GetAreaSubjects ¶
func (s CurriculumStore) GetAreaSubjects(areaId string) ([]Subject, error)
func (CurriculumStore) GetMaterial ¶
func (s CurriculumStore) GetMaterial(materialId string) (*Material, error)
func (CurriculumStore) GetSubject ¶
func (s CurriculumStore) GetSubject(id string) (*Subject, error)
func (CurriculumStore) GetSubjectMaterials ¶
func (s CurriculumStore) GetSubjectMaterials(subjectId string) ([]Material, error)
func (CurriculumStore) NewArea ¶
func (s CurriculumStore) NewArea(name string, curriculumId string) (string, error)
func (CurriculumStore) NewMaterial ¶
func (s CurriculumStore) NewMaterial(name string, subjectId string) (*Material, error)
func (CurriculumStore) NewSubject ¶
func (CurriculumStore) ReplaceSubject ¶
func (s CurriculumStore) ReplaceSubject(newSubject Subject) error
func (CurriculumStore) UpdateArea ¶
func (s CurriculumStore) UpdateArea(areaId string, name string) error
func (CurriculumStore) UpdateMaterial ¶
func (s CurriculumStore) UpdateMaterial(material *Material, order *int) error
type EmptyCurriculumError ¶
type EmptyCurriculumError struct{}
func (EmptyCurriculumError) Error ¶
func (e EmptyCurriculumError) Error() string
type GuardianRelationship ¶ added in v1.0.3
type GuardianRelationship int
const ( Others GuardianRelationship = iota Mother Father )
type GuardianStore ¶ added in v1.0.3
type GuardianStore struct {
*pg.DB
}
func (GuardianStore) CheckPermission ¶ added in v1.0.3
func (s GuardianStore) CheckPermission(userId string, guardianId string) (bool, error)
func (GuardianStore) DeleteGuardian ¶ added in v1.0.3
func (s GuardianStore) DeleteGuardian(id string) (int, error)
func (GuardianStore) GetGuardian ¶ added in v1.0.3
func (s GuardianStore) GetGuardian(id string) (*guardian.Guardian, error)
func (GuardianStore) UpdateGuardian ¶ added in v1.0.3
func (s GuardianStore) UpdateGuardian(guardian guardian.Guardian) (int, error)
type GuardianToStudent ¶ added in v1.0.3
type GuardianToStudent struct { StudentId string `pg:"type:uuid,on_delete:CASCADE"` Student Student GuardianId string `pg:"type:uuid,on_delete:CASCADE"` Guardian Guardian Relationship GuardianRelationship `pg:"type:int"` }
type Observation ¶
type Observation struct { Id string `json:"id" pg:",type:uuid"` StudentId string `pg:",type:uuid,on_delete:CASCADE"` Student *Student ShortDesc string `json:"shortDesc"` LongDesc string `json:"longDesc"` CategoryId string `json:"categoryId"` CreatedDate time.Time `json:"createdDate"` EventTime *time.Time CreatorId string `pg:",type:uuid,on_delete:SET NULL"` Creator *User }
type ObservationStore ¶
type ObservationStore struct {
*pg.DB
}
func (ObservationStore) CheckPermissions ¶
func (s ObservationStore) CheckPermissions(observationId string, userId string) (bool, error)
func (ObservationStore) DeleteObservation ¶
func (o ObservationStore) DeleteObservation(observationId string) error
func (ObservationStore) GetObservation ¶
func (o ObservationStore) GetObservation(id string) (*Observation, error)
func (ObservationStore) UpdateObservation ¶
func (o ObservationStore) UpdateObservation(observationId string, shortDesc string, longDesc string, categoryId string) (*Observation, error)
type PasswordResetToken ¶
type SchoolStore ¶
type SchoolStore struct {
*pg.DB
}
func (SchoolStore) DeleteCurriculum ¶
func (s SchoolStore) DeleteCurriculum(schoolId string) error
func (SchoolStore) GetCurriculum ¶
func (s SchoolStore) GetCurriculum(schoolId string) (*Curriculum, error)
func (SchoolStore) GetCurriculumAreas ¶
func (s SchoolStore) GetCurriculumAreas(schoolId string) ([]Area, error)
func (SchoolStore) GetGuardians ¶ added in v1.0.3
func (s SchoolStore) GetGuardians(schoolId string) ([]Guardian, error)
func (SchoolStore) GetSchoolClasses ¶
func (s SchoolStore) GetSchoolClasses(schoolId string) ([]Class, error)
func (SchoolStore) GetStudents ¶
func (s SchoolStore) GetStudents(schoolId string) ([]Student, error)
func (SchoolStore) NewDefaultCurriculum ¶
func (s SchoolStore) NewDefaultCurriculum(schoolId string) error
func (SchoolStore) NewGuardian ¶ added in v1.0.3
func (SchoolStore) NewSchool ¶
func (s SchoolStore) NewSchool(schoolName string, userId string) (*School, error)
func (SchoolStore) NewStudent ¶
func (SchoolStore) RefreshInviteCode ¶
func (s SchoolStore) RefreshInviteCode(schoolId string) (*School, error)
type Student ¶
type Student struct { Id string `json:"id" pg:",type:uuid"` Name string `json:"name"` SchoolId string `pg:"type:uuid,on_delete:CASCADE"` School School DateOfBirth *time.Time Classes []Class `pg:"many2many:student_to_class,joinFK:student_id"` Gender Gender `pg:"type:int"` DateOfEntry *time.Time Note string CustomId string Active bool ProfilePic string Guardians []Guardian `pg:"many2many:guardian_to_student,joinFK:student_id"` }
type StudentMaterialProgress ¶
type StudentStore ¶
type StudentStore struct {
*pg.DB
}
func (StudentStore) CheckPermissions ¶
func (s StudentStore) CheckPermissions(studentId string, userId string) (bool, error)
func (StudentStore) Delete ¶
func (s StudentStore) Delete(studentId string) error
func (StudentStore) GetObservations ¶
func (s StudentStore) GetObservations(studentId string) ([]Observation, error)
func (StudentStore) GetProgress ¶
func (s StudentStore) GetProgress(studentId string) ([]StudentMaterialProgress, error)
func (StudentStore) InsertObservation ¶
func (s StudentStore) InsertObservation( studentId string, creatorId string, longDesc string, shortDesc string, category string, eventTime *time.Time, ) (*Observation, error)
func (StudentStore) Update ¶
func (s StudentStore) Update(student *Student) error
func (StudentStore) UpdateProgress ¶
func (s StudentStore) UpdateProgress(progress StudentMaterialProgress) (pg.Result, error)
type StudentToClass ¶ added in v1.0.3
type UserStore ¶
type UserStore struct {
*pg.DB
}
func (UserStore) GetSchools ¶
func (u UserStore) GetSchools(userId string) ([]user.UserSchool, error)
type UserToSchool ¶
Click to show internal directories.
Click to hide internal directories.