last modified in update for all tables

This commit is contained in:
Lukas Bachschwell 2018-11-16 10:42:25 +01:00
parent dec75bea91
commit cb7a46617d
6 changed files with 9 additions and 2 deletions

View File

@ -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:

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {