Skip to content

Commit 4cb65b7

Browse files
authored
Feat: Add create/modified by to article (#6)
1 parent 77d9ea5 commit 4cb65b7

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ func main() {
1313
routes := routes.CreateRoutes()
1414
router := router.NewHatchRouter(routes)
1515
loggerRouter := handlers.CombinedLoggingHandler(os.Stdout, router)
16+
1617
http.ListenAndServe(":3810", loggerRouter)
1718
}

store/articles.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ type Article struct {
1919
Attachments []Attachment `bson:"attachments"json:"attachments"validate:"omitempty"`
2020
CustomFields []CustomFields `bson:"customFields"json:"customFields"validate:"omitempty"`
2121
PCC []string `bson:"pcc"json:"pcc"validate:"omitempty"`
22+
CreatedBy string `bson:"createdBy"json:"createdBy"validate:"omitempty"`
23+
ModifiedBy string `bson:"modifiedBy"json:"modifiedBy"validate:"omitempty"`
2224
}
2325

2426
//Attachment store link and file name
@@ -123,6 +125,9 @@ func (art *ArticlesCollection) Update(ID bson.ObjectId, entry Article) (err erro
123125
"tags": entry.Tags,
124126
"attachments": entry.Attachments,
125127
"customFields": entry.CustomFields,
128+
"pcc": entry.PCC,
129+
"createdBy": entry.CreatedBy,
130+
"modifiedBy": entry.ModifiedBy,
126131
},
127132
}
128133

0 commit comments

Comments
 (0)