breakAndDeleteDoc deletes the given document struct and marks all of its associated mediaObject as not being part of a document
(ctx context.Context, docRef blob.Ref)
| 834 | // breakAndDeleteDoc deletes the given document struct and marks all of its |
| 835 | // associated mediaObject as not being part of a document |
| 836 | func (h *handler) breakAndDeleteDoc(ctx context.Context, docRef blob.Ref) error { |
| 837 | doc, err := h.fetchDocument(docRef) |
| 838 | if err != nil { |
| 839 | return fmt.Errorf("document %v not found: %v", docRef, err) |
| 840 | } |
| 841 | if err := h.deleteNode(ctx, docRef); err != nil { |
| 842 | return fmt.Errorf("could not delete document %v: %v", docRef, err) |
| 843 | } |
| 844 | for _, page := range doc.pages { |
| 845 | if err := h.delAttribute(ctx, page, "document", ""); err != nil { |
| 846 | return fmt.Errorf("could not unset document of scan %v: %v", page, err) |
| 847 | } |
| 848 | } |
| 849 | return nil |
| 850 | } |
| 851 | |
| 852 | // deleteDocAndImages deletes the given document struct and marks all of its |
| 853 | // associated mediaObjects as not being part of a document |
no test coverage detected