mirror of
https://github.com/ultrasn0w/huso.git
synced 2026-10-26 12:34:17 +01:00
Clear appointments on anime delete
This commit is contained in:
1 parent
231cecedd8
commit
864aa5695a
1 file changed
+15
@@ -257,6 +257,21 @@ func DeleteUserFromAppointment(username string, animeId int64, meeting time.Time
|
||||
}
|
||||
|
||||
func DeleteAnime(tx *nutsdb.Tx, keyBytes []byte) error {
|
||||
// clear appointments
|
||||
appoints, err := tx.GetAll(bucketAppoint)
|
||||
if err == nil {
|
||||
animeId, err := BytesToInt64(keyBytes)
|
||||
if err == nil {
|
||||
for _, e := range appoints {
|
||||
// decode appointment list
|
||||
dbAnimeId, _, err := BytesToInt64AndDate(e.Key)
|
||||
if err == nil && dbAnimeId == animeId {
|
||||
tx.Delete(bucketAppoint, e.Key)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tx.Delete(bucketChat, keyBytes)
|
||||
return tx.Delete(bucketAnime, keyBytes)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user