mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-13 12:29:53 +01:00
Erster Discord Versuch
This commit is contained in:
6
nuss.go
6
nuss.go
@@ -79,14 +79,16 @@ func AddUserToAnime(username string, userId, animeId int64, progress int, update
|
||||
return &anime, err
|
||||
}
|
||||
|
||||
func AddUserToAppointment(username string, animeId int64, meeting time.Time) (*Appointment, error) {
|
||||
func AddUserToAppointment(username string, animeId int64, meeting time.Time) (*Appointment, bool, error) {
|
||||
var appoint Appointment
|
||||
fresh := false
|
||||
err := db.Update(
|
||||
func(tx *nutsdb.Tx) error {
|
||||
keyBytes := Int64AndDateToBytes(animeId, meeting)
|
||||
e, err := tx.Get(bucketAppoint, keyBytes)
|
||||
var users []string
|
||||
if err != nil {
|
||||
fresh = true
|
||||
users = make([]string, 0)
|
||||
} else {
|
||||
// parse user list
|
||||
@@ -121,7 +123,7 @@ func AddUserToAppointment(username string, animeId int64, meeting time.Time) (*A
|
||||
}
|
||||
return tx.Put(bucketAppoint, keyBytes, newData, nutsdb.Persistent)
|
||||
})
|
||||
return &appoint, err
|
||||
return &appoint, fresh, err
|
||||
}
|
||||
|
||||
func DeleteUserFromAnime(username string, userId, animeId int64) (*AnimeUser, error) {
|
||||
|
||||
Reference in New Issue
Block a user