diff --git a/Readme.md b/Readme.md index 23aa0b6..e4a5df7 100644 --- a/Readme.md +++ b/Readme.md @@ -21,8 +21,10 @@ Todo till we can fork this repo * ~~/register endpoint creates database, company and first admin~~ * checking some roles in all endpoints * ~~load db connections from config~~ -* user delete needs to update system -* company delete needs to exist and update company +* ~~user delete needs to update system~~ +* ~~company delete needs to exist and update usercompanymap~~ +* modified by (companyuserid) +* last modified in update for all tables ## Notes: diff --git a/models/companyData.go b/models/companyData.go index 0dbf339..0afb47d 100644 --- a/models/companyData.go +++ b/models/companyData.go @@ -124,6 +124,7 @@ func GetAllCompanyData(o orm.Ormer, query map[string]string, fields []string, so // UpdateCompanyData updates CompanyData by Id and returns error if // the record to be updated doesn't exist func UpdateCompanyDataById(o orm.Ormer, m *CompanyData) (err error) { + m.Modified = time.Now() v := CompanyData{Id: m.Id} // ascertain id exists in the database if err = o.Read(&v); err == nil { diff --git a/models/companyUser.go b/models/companyUser.go index 8da620b..8e569ae 100644 --- a/models/companyUser.go +++ b/models/companyUser.go @@ -123,6 +123,7 @@ func GetAllCompanyUser(o orm.Ormer, query map[string]string, fields []string, so // UpdateCompanyUserById updates CompanyUser by Id and returns error if the record to be updated doesn't exist func UpdateCompanyUserById(o orm.Ormer, m *CompanyUser) (err error) { + m.Modified = time.Now() v := CompanyUser{Id: m.Id} // ascertain id exists in the database if err = o.Read(&v); err == nil { diff --git a/models/contact.go b/models/contact.go index ab9e93a..43790e7 100644 --- a/models/contact.go +++ b/models/contact.go @@ -127,6 +127,7 @@ func GetAllContact(o orm.Ormer, query map[string]string, fields []string, sortby // UpdateContact updates Contact by Id and returns error if // the record to be updated doesn't exist func UpdateContactById(o orm.Ormer, m *Contact) (err error) { + m.Modified = time.Now() v := Contact{Id: m.Id} // ascertain id exists in the database if err = o.Read(&v); err == nil { diff --git a/models/post.go b/models/post.go index 7864475..78970c5 100644 --- a/models/post.go +++ b/models/post.go @@ -124,6 +124,7 @@ func GetAllPost(o orm.Ormer, query map[string]string, fields []string, sortby [] // UpdatePost updates Post by Id and returns error if // the record to be updated doesn't exist func UpdatePostById(o orm.Ormer, m *Post) (err error) { + m.Modified = time.Now() v := Post{Id: m.Id} // ascertain id exists in the database if err = o.Read(&v); err == nil { diff --git a/models/userCompanyMap.go b/models/userCompanyMap.go index 9c6e8ea..255b311 100644 --- a/models/userCompanyMap.go +++ b/models/userCompanyMap.go @@ -154,6 +154,7 @@ func GetUserCompanyMapsByCompanyName(o orm.Ormer, companyName string) (l []UserC // UpdateUserCompanyMapById updates UserCompanyMap by Id and returns error if the record to be updated doesn't exist func UpdateUserCompanyMapById(o orm.Ormer, m *UserCompanyMap) (err error) { + m.Modified = time.Now() v := UserCompanyMap{ID: m.ID} // ascertain id exists in the database if err = o.Read(&v); err == nil {