GraphQL API and utilities for the rpdata project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
449 B

  1. package logs
  2. import (
  3. "errors"
  4. "git.aiterp.net/rpdata/api/models"
  5. "git.aiterp.net/rpdata/api/models/posts"
  6. )
  7. // Remove removes the log.
  8. func Remove(log models.Log) (models.Log, error) {
  9. err := collection.RemoveId(log.ID)
  10. if err != nil {
  11. return models.Log{}, err
  12. }
  13. if err := posts.RemoveAllInLog(log); err != nil {
  14. return models.Log{}, errors.New("The log was removed, but its posts couldn't be: " + err.Error())
  15. }
  16. return log, nil
  17. }