More work on Shares

This commit is contained in:
Deluan
2023-01-20 19:53:53 -05:00
parent ab04e33da6
commit 84aa094e56
19 changed files with 150 additions and 167 deletions
+3 -5
View File
@@ -51,8 +51,7 @@ func (r *shareRepository) Update(id string, entity interface{}, cols ...string)
s := entity.(*model.Share)
// TODO Validate record
s.ID = id
now := time.Now()
s.UpdatedAt = &now
s.UpdatedAt = time.Now()
cols = append(cols, "updated_at")
_, err := r.put(id, s, cols...)
if errors.Is(err, model.ErrNotFound) {
@@ -68,9 +67,8 @@ func (r *shareRepository) Save(entity interface{}) (string, error) {
if s.UserID == "" {
s.UserID = u.ID
}
now := time.Now()
s.CreatedAt = &now
s.UpdatedAt = &now
s.CreatedAt = time.Now()
s.UpdatedAt = time.Now()
id, err := r.put(s.ID, s)
if errors.Is(err, model.ErrNotFound) {
return "", rest.ErrNotFound