Implement custom account field deletion

Custom account fields can now be deleted either one at a time via id or
all fields owned by an account
This commit is contained in:
Melody Becker 2024-11-07 10:47:09 +01:00
parent 487b57b4d6
commit cea3009641

View file

@ -55,3 +55,16 @@ func (s *Storage) AddNewUserField(name, value, belongsToId string) (*UserInfoFie
// TODO: Implement me // TODO: Implement me
panic("Not implemented") panic("Not implemented")
} }
func (s *Storage) DeleteUserField(id uint) error {
defer util.Untrace(util.Trace(&log.Logger))
return s.db.Delete(UserInfoField{Model: gorm.Model{ID: id}}).Error
}
func (s *Storage) DeleteAllUserFieldsForAccountId(id string) error {
defer util.Untrace(util.Trace(&log.Logger))
return s.db.Model(&UserInfoField{}).
Where(&UserInfoField{BelongsTo: id}).
Delete(&UserInfoField{}).
Error
}