Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAPIKeyCorrect ¶
IsAPIKeyCorrect checks if the API key is registered
Types ¶
type Class ¶
type Class struct {
Promotion nulltype.NullInt64 `json:"promotion" db:"promotion"`
Semester nulltype.NullString `json:"semester" db:"semester"`
Region nulltype.NullString `json:"region" db:"region"`
Class nulltype.NullString `json:"class" db:"class"`
}
Class struct
func GetClasses ¶
GetClasses fetches distinct classes from users in DB
type Filters ¶
type Filters struct {
StartDate time.Time `json:"start_date" form:"start_date"`
EndDate time.Time `json:"end_date" form:"end_date"`
Completed *bool `json:"completed" form:"completed"`
Visibility *Visibility `json:"visibility" form:"visibility"`
Subject *string `json:"subject" form:"subject"`
}
Filters struct
type Members ¶
type Members []string
Members string
func (Members) MarshalJSON ¶
MarshalJSON interface method
func (*Members) UnmarshalJSON ¶
UnmarshalJSON interface method
type Task ¶
type Task struct {
// Meta
ShortID string `json:"short_id" db:"short_id"`
Visibility Visibility `json:"visibility" db:"visibility"`
// Promotion
Promotion nulltype.NullInt64 `json:"promotion" db:"promotion"`
Semester nulltype.NullString `json:"semester" db:"semester"`
// Class
Class nulltype.NullString `json:"class" db:"class"`
Region nulltype.NullString `json:"region" db:"region"`
// Students
Members Members `json:"members" db:"members"`
// Body
Title string `json:"title" db:"title"`
Subject string `json:"subject" db:"subject"`
Content string `json:"content" db:"content"`
DueDate time.Time `json:"due_date" db:"due_date"`
Completed bool `json:"completed" db:"completed"`
CompletedAt *time.Time `json:"completed_at" db:"completed_at"`
Deleted bool `json:"-" db:"deleted"`
// Meta
CreatedByLogin string `json:"created_by_login" db:"created_by_login"`
CreatedBy string `json:"created_by" db:"created_by"`
UpdatedByLogin string `json:"updated_by_login" db:"updated_by_login"`
UpdatedBy string `json:"updated_by" db:"updated_by"`
// contains filtered or unexported fields
}
Task truct
func GetAllTasks ¶
GetAllTasks returns list of tasks in some timeframe for all promotions
func GetTasksRange ¶
GetTasksRange returns list of tasks in a time for a specific class promotion
func GetTeacherTasksRange ¶
GetTeacherTasksRange returns list of tasks in a time range (for teachers)
func (Task) PrepareUpdate ¶
PrepareUpdate prepares new update data
type UpdateUserReq ¶
type UpdateUserReq struct {
Promotion int `db:"promotion"`
Class nulltype.NullString `db:"class"`
Region nulltype.NullString `db:"region"`
Semester nulltype.NullString `db:"semester"`
Login string `db:"login"`
}
type User ¶
type User struct {
Login string `json:"login" db:"login"`
Name string `json:"name" db:"name"`
Promotion nulltype.NullInt64 `json:"promotion" db:"promotion"`
Class nulltype.NullString `json:"class" db:"class"`
Region nulltype.NullString `json:"region" db:"region"`
Semester nulltype.NullString `json:"semester" db:"semester"`
Email string `json:"email" db:"email"`
Teacher bool `json:"teacher" db:"teacher"`
// contains filtered or unexported fields
}
User struct
func GetUserByEmail ¶
GetUserByEmail retrives user by email
func (User) CanDeleteTask ¶
CanDeleteTask checks if an user can delete a task
func (User) CanEditTask ¶
CanEditTask checks if an user can edit a task
func (User) CanViewTask ¶
CanViewTask checks if an user can view a task
type Visibility ¶
type Visibility string
Visibility enum
const ( // SelfVisibility only the author of task can access it SelfVisibility Visibility = "self" // PromotionVisibility only the promotion of the author of the task can access it PromotionVisibility Visibility = "promotion" // ClassVisibility only the class of the author of the task can access it ClassVisibility Visibility = "class" // StudentsVisibility only selected students can access it StudentsVisibility Visibility = "students" )