oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package equipo
2
3import (
4 "time"
5
6 "gorm.io/gorm"
7)
8
9func lapseOwnerAcknowledgements(tx *gorm.DB, owner string, now time.Time) error {
10 var rows []isolationAcknowledgementRecord
11 if err := tx.Where("owner = ? AND revoked_at IS NULL", owner).Find(&rows).Error; err != nil {
12 return storeError(err)
13 }
14 for _, a := range rows {
15 var c connectionRecord
16 if err := tx.Where("id = ?", a.ConnectionID).First(&c).Error; err != nil {
17 return storeError(err)
18 }
19 if err := invalidateConnection(tx, c, "acknowledging_owner_changed", now); err != nil {
20 return err
21 }
22 }
23 return storeError(tx.Model(&isolationAcknowledgementRecord{}).Where("owner = ? AND revoked_at IS NULL", owner).Select("RevokedAt").Updates(&isolationAcknowledgementRecord{RevokedAt: &now}).Error)
24}
25