 (defresource section [conn company-slug section-name as-of]
   common/open-company-anonymous-resource  ; verify validity of JWToken if it's provided, but it's not required
 
-  :allowed-methods [:options :get :put :patch]
+  :allowed-methods [:options :get :put :patch :delete]
   :available-media-types [section-rep/media-type]
   :exists? (by-method {
                        :get (fn [_] (get-section conn company-slug section-name as-of))
                        :put (fn [_] (and (nil? as-of) (get-section conn company-slug section-name as-of)))
                        :patch (fn [_] (and (not (nil? as-of)) (get-section conn company-slug section-name as-of)))
-                       :delete (fn [_] (and (nil? as-of) (get-section conn company-slug section-name as-of)))})
+                       :delete (fn [_] (and (not (nil? as-of)) (get-section conn company-slug section-name as-of)))})
 
   :known-content-type? (fn [ctx] (common/known-content-type? ctx section-rep/media-type))
 

                            :options true
                            :get true
                            :put true
                            :patch true})

  ;; Handlers
  :handle-ok
    (by-method {
                :get (fn [ctx] (section-rep/render-section conn (:section ctx) (common/allow-org-members conn company-slug ctx) (not (nil? as-of))))
                :put (fn [ctx] (section-rep/render-section conn (:updated-section ctx)))
                :patch (fn [ctx] (section-rep/render-section conn (:updated-section ctx)))})
  :handle-not-acceptable (fn [_] (common/only-accept 406 section-rep/media-type))
  :handle-unsupported-media-type (fn [_] (common/only-accept 415 section-rep/media-type))
  :handle-unprocessable-entity (fn [ctx] (unprocessable-reason (:reason ctx)))

                        :put (fn [ctx] (common/allow-org-members conn company-slug ctx))
                        :patch (fn [ctx] (common/allow-org-members conn company-slug ctx))
                        :post false
                        :delete (fn [ctx] (common/allow-org-members conn company-slug ctx))})

  :can-put-to-missing? true
  
