alter primary keys to uuids and adjust the membership system
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"acc-server-manager/local/model"
|
||||
"context"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -30,12 +31,12 @@ func (r *SteamCredentialsRepository) GetCurrent(ctx context.Context) (*model.Ste
|
||||
}
|
||||
|
||||
func (r *SteamCredentialsRepository) Save(ctx context.Context, creds *model.SteamCredentials) error {
|
||||
if creds.ID == 0 {
|
||||
if creds.ID == uuid.Nil {
|
||||
return r.db.WithContext(ctx).Create(creds).Error
|
||||
}
|
||||
return r.db.WithContext(ctx).Save(creds).Error
|
||||
}
|
||||
|
||||
func (r *SteamCredentialsRepository) Delete(ctx context.Context, id uint) error {
|
||||
func (r *SteamCredentialsRepository) Delete(ctx context.Context, id uuid.UUID) error {
|
||||
return r.db.WithContext(ctx).Delete(&model.SteamCredentials{}, id).Error
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user