Commit 65057212 by Utkarsh Bhatnagar Committed by Torkel Ödegaard

Org update should throw error if not found (#7066)

* Org update should give error if not found

* Used affected rows
parent d8ebebc6
......@@ -133,10 +133,16 @@ func UpdateOrg(cmd *m.UpdateOrgCommand) error {
Updated: time.Now(),
}
if _, err := sess.Id(cmd.OrgId).Update(&org); err != nil {
affectedRows, err := sess.Id(cmd.OrgId).Update(&org)
if err != nil {
return err
}
if affectedRows == 0 {
return m.ErrOrgNotFound
}
sess.publishAfterCommit(&events.OrgUpdated{
Timestamp: org.Updated,
Id: org.Id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment