-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcourseEntry.go
51 lines (42 loc) · 1.29 KB
/
courseEntry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package eduboard
import (
"gopkg.in/mgo.v2/bson"
"net/url"
"time"
)
type CourseEntry struct {
ID bson.ObjectId `json:"id,omitempty" bson:"_id"`
CourseID bson.ObjectId `json:"courseID" bson:"courseID"`
Date time.Time `json:"date" bson:"date"`
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
Message string `json:"message" bson:"message"`
Pictures []url.URL `json:"pictures" bson:"pictures"`
Published bool `json:"published" bson:"published"`
}
type CourseEntryRepository interface {
CourseEntryInserter
CourseEntryOneFinder
CourseEntryManyFinder
CourseEntryUpdater
CourseEntryDeleter
}
type CourseEntryInserter interface {
Insert(course CourseEntry) error
}
type CourseEntryOneFinder interface {
FindOneByID(id string) (error, CourseEntry)
}
type CourseEntryManyFinder interface {
FindMany(query bson.M) (error, []CourseEntry)
}
type CourseEntryUpdater interface {
Update(id string, update bson.M) error
}
type CourseEntryDeleter interface {
Delete(id string) error
}
type CourseEntryService interface {
StoreCourseEntry(entry *CourseEntry, cfu CourseFindUpdater) (err error, courseEntry *CourseEntry)
UpdateCourseEntry(*CourseEntry) (*CourseEntry, error)
DeleteCourseEntry(entryID string, courseID string, updater CourseUpdater) error
}