make create call consistent with update and delete

This commit is contained in:
Michael Mandrus 2022-11-30 10:56:44 -05:00
parent 3b53fdb53a
commit 26b6463bd6

View File

@ -168,11 +168,15 @@ func (pd *PublicDashboardServiceImpl) Create(ctx context.Context, u *user.Signed
},
}
_, err = pd.store.Create(ctx, cmd)
affectedRows, err := pd.store.Create(ctx, cmd)
if err != nil {
return nil, ErrInternalServerError.Errorf("Create: failed to create the public dashboard: %w", err)
}
if affectedRows == 0 {
return nil, ErrPublicDashboardNotFound.Errorf("Create: failed to create a public dashboard with Uid: %s", uid)
}
//Get latest public dashboard to return
newPubdash, err := pd.store.Find(ctx, uid)
if err != nil {