File uploads, mostly. Also added extra behavior to addCharacter.
the build was successful

This commit is contained in:
2019-08-31 22:46:55 +02:00
parent 8a313b3bb2
commit c8ced52e1a
17 changed files with 175 additions and 25 deletions
+2
View File
@@ -26,6 +26,8 @@ const (
ChangeModelChapter ChangeModel = "Chapter"
// ChangeModelComment is a value of ChangeModel
ChangeModelComment ChangeModel = "Comment"
// ChangeModelFile is a value of ChangeModel
ChangeModelFile ChangeModel = "File"
)
// IsValid returns true if the underlying string is one of the correct values.
+8
View File
@@ -23,6 +23,7 @@ type Change struct {
Tags []*Tag `bson:"tags"`
Chapters []*Chapter `bson:"chapters"`
Comments []*Comment `bson:"comments"`
Files []*File `bson:"files"`
}
// AddObject adds the model into the appropriate array.
@@ -68,6 +69,10 @@ func (change *Change) AddObject(object interface{}) bool {
change.Comments = append(change.Comments, object)
case []*Comment:
change.Comments = append(change.Comments, object...)
case *File:
change.Files = append(change.Files, object)
case []*File:
change.Files = append(change.Files, object...)
default:
return false
}
@@ -103,6 +108,9 @@ func (change *Change) Objects() []interface{} {
for _, comment := range change.Comments {
data = append(data, comment)
}
for _, file := range change.Files {
data = append(data, file)
}
return data
}