Adding Modified By relation

This commit is contained in:
2018-11-16 13:37:18 +01:00
parent dc1778a5b9
commit e79ece15aa
14 changed files with 38 additions and 24 deletions

View File

@ -139,6 +139,7 @@ func (c *CompanyDataController) Put() {
id, _ := strconv.Atoi(idStr)
v := models.CompanyData{Id: id}
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &v); err == nil {
v.ModifiedBy = int64(currentUser.Id)
if err := models.UpdateCompanyDataById(o, &v); err == nil {
c.ServeJSONSuccess("Ok")
} else {

View File

@ -189,6 +189,7 @@ func (c *CompanyUserController) Put() {
id, _ := strconv.Atoi(idStr)
v := models.CompanyUser{Id: id}
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &v); err == nil {
v.ModifiedBy = int64(currentUser.Id)
if err := models.UpdateCompanyUserById(o, &v); err == nil {
c.ServeJSONSuccess("Ok")
} else {

View File

@ -140,6 +140,7 @@ func (c *ContactController) Put() {
id, _ := strconv.Atoi(idStr)
v := models.Contact{Id: id}
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &v); err == nil {
v.ModifiedBy = int64(currentUser.Id)
if err := models.UpdateContactById(o, &v); err == nil {
c.ServeJSONSuccess("Ok")
} else {

View File

@ -149,6 +149,7 @@ func (c *PostController) Put() {
id, _ := strconv.Atoi(idStr)
v := models.Post{Id: id}
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &v); err == nil {
v.ModifiedBy = int64(currentUser.Id)
if err := models.UpdatePostById(o, &v); err == nil {
c.ServeJSONSuccess("Updated Post")
} else {