remove sub things and add view
All checks were successful
build / windows (push) Successful in 2m22s
build / linux (push) Successful in 2m3s

This commit is contained in:
2025-03-07 15:23:33 +01:00
parent feb248e991
commit 2b13e5c03a
5 changed files with 3 additions and 85 deletions

View File

@ -31,24 +31,3 @@ func (s *Service) DeleteThing(id int) {
log.Fatal(err)
}
}
func (s *Service) GetSubThings(thingID int) (subthings []model.SubThing) {
if err := s.DB.Where("thing_id = ?", thingID).Find(&subthings).Error; err != nil {
log.Fatal(err)
}
return
}
func (s *Service) AddSubThing(thingID int, name string) {
if err := s.DB.Save(&model.SubThing{
ThingID: thingID,
Name: name,
}).Error; err != nil {
log.Fatal(err)
}
}
func (s *Service) DeleteSubThing(id int) {
if err := s.DB.Delete(model.SubThing{}, id).Error; err != nil {
log.Fatal(err)
}
}