Handle expired shares

This commit is contained in:
Deluan
2023-01-22 19:52:11 -05:00
parent d0dceae094
commit d4c1d2ece4
2 changed files with 6 additions and 0 deletions
+3
View File
@@ -36,6 +36,9 @@ func (s *shareService) Load(ctx context.Context, id string) (*model.Share, error
return nil, err
}
share := entity.(*model.Share)
if !share.ExpiresAt.IsZero() && share.ExpiresAt.Before(time.Now()) {
return nil, model.ErrNotAvailable
}
share.LastVisitedAt = time.Now()
share.VisitCount++