docVersionFromOCCValue converts an OCC value and type into a DocVersion struct.
(occValue string, occValueType occVersionType)
| 782 | |
| 783 | // docVersionFromOCCValue converts an OCC value and type into a DocVersion struct. |
| 784 | func docVersionFromOCCValue(occValue string, occValueType occVersionType) (docVersion db.DocVersion, err error) { |
| 785 | switch occValueType { |
| 786 | case VersionTypeRevTreeID: |
| 787 | docVersion.RevTreeID = occValue |
| 788 | case VersionTypeCV: |
| 789 | docVersion.CV, err = db.ParseVersion(occValue) |
| 790 | if err != nil { |
| 791 | return DocVersion{}, base.HTTPErrorf(http.StatusBadRequest, "Invalid CV: %v", err) |
| 792 | } |
| 793 | default: |
| 794 | return DocVersion{}, base.HTTPErrorf(http.StatusBadRequest, "Unknown OCC version type: %d", occValueType) |
| 795 | } |
| 796 | return docVersion, nil |
| 797 | } |
| 798 | |
| 799 | // HTTP handler for a DELETE of a document |
| 800 | func (h *handler) handleDeleteDoc() error { |
no test coverage detected