瀏覽代碼

Working on groups

Andrea Fazzi 5 年之前
父節點
當前提交
b24e452ca1
共有 2 個文件被更改,包括 11 次插入0 次删除
  1. 9 0
      orm/group.go
  2. 2 0
      orm/teacher.go

+ 9 - 0
orm/group.go

@@ -0,0 +1,9 @@
+package orm
+
+import "github.com/jinzhu/gorm"
+
+type Group struct {
+	gorm.Model
+
+	Name string
+}

+ 2 - 0
orm/teacher.go

@@ -21,6 +21,8 @@ type Teacher struct {
 	Activities  []*Activity
 	Activities  []*Activity
 	Departments []*Department
 	Departments []*Department
 
 
+	Groups []*Group `gorm:many2may:teacher_groups`
+
 	SubjectsByClass map[uint][]*Subject `gorm:"-"`
 	SubjectsByClass map[uint][]*Subject `gorm:"-"`
 
 
 	Hours       int
 	Hours       int