فهرست منبع

Remove unused structs

Andrea Fazzi 6 سال پیش
والد
کامیت
d889eca9a8
4فایلهای تغییر یافته به همراه2 افزوده شده و 59 حذف شده
  1. 1 1
      handlers/handlers.go
  2. 0 16
      orm/issue.go
  3. 1 40
      orm/orm.go
  4. 0 2
      orm/teacher.go

+ 1 - 1
handlers/handlers.go

@@ -164,7 +164,7 @@ func recoverHandler(next http.Handler) http.Handler {
 
 func get(w http.ResponseWriter, r *http.Request, model string, pattern PathPattern) {
 	format := r.URL.Query().Get("format")
-	getFn, err := orm.GetResultFunc(pattern.Path(model))
+	getFn, err := orm.GetFunc(pattern.Path(model))
 	if err != nil {
 		respondWithError(w, r, err)
 	} else {

+ 0 - 16
orm/issue.go

@@ -1,16 +0,0 @@
-package orm
-
-import "github.com/jinzhu/gorm"
-
-type Issue struct {
-	gorm.Model
-	Description string
-	Type        uint
-	Reported    bool
-	TeacherID   uint
-	Teacher     Teacher
-}
-
-func (i *Issue) newTeacherMaxHoursIssue(t *Teacher) *Issue {
-	return nil
-}

+ 1 - 40
orm/orm.go

@@ -8,30 +8,12 @@ import (
 	_ "github.com/jinzhu/gorm/dialects/mysql"
 )
 
-const (
-	ADMINISTRATIVE_ROLE_PERSONAL = iota
-	ADMINISTRATIVE_ROLE_TEACHING
-	ADMINISTRATIVE_ROLE_DSGA
-	ADMINISTRATIVE_ROLE_SCHOOL_CARETAKER
-	ADMINISTRATIVE_ROLE_TECHNICAL_ASSISTANT
-	ADMINISTRATIVE_ROLE_LIBRARIAN
-	ADMINISTRATIVE_ROLE_UNDEFINED
-
-	IssueTeacherHours = iota
-)
-
 type Timetable [][]Activity
 
 type Person interface {
 	GetCredential() *Credential
 }
 
-type TheBoss struct {
-	gorm.Model
-	Credential
-	Teachers []Teacher
-}
-
 type Address struct {
 	City    string
 	Street  string
@@ -65,23 +47,6 @@ type Student struct {
 	Class *Class
 }
 
-type Director struct {
-	gorm.Model
-	Credential
-}
-
-type Administrative struct {
-	gorm.Model
-	Credential
-	Role int
-}
-
-type Office struct {
-	gorm.Model
-	Credential
-	Persons []Person
-}
-
 type Department struct {
 	gorm.Model
 	Name     string
@@ -204,18 +169,14 @@ func AutoMigrate() {
 		&Class{},
 		&Activity{},
 		&Department{},
-		&TheBoss{},
-		&Administrative{},
 		&Student{},
-		&Director{},
-		&Issue{},
 	).Error; err != nil {
 		panic(err)
 	}
 
 }
 
-func GetResultFunc(path string) (GetFn, error) {
+func GetFunc(path string) (GetFn, error) {
 	fn, ok := Get[path]
 	if !ok {
 		return nil, fmt.Errorf("Can't map %s!", path)

+ 0 - 2
orm/teacher.go

@@ -14,10 +14,8 @@ type Teacher struct {
 	Subjects    []*Subject
 	Activities  []*Activity
 	Departments []*Department
-	Issues      []*Issue
 	Hours       int
 	CurrHours   int
-	TheBossId   uint
 }
 
 type IDer interface {