renamed company to client.
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
(ns auto-ap.routes.companies
|
||||
(ns auto-ap.routes.clients
|
||||
(:require [auto-ap.datomic.clients :as clients]
|
||||
[auto-ap.graphql.utils :refer [can-see-company? assert-can-see-company]]
|
||||
[auto-ap.graphql.utils :refer [can-see-client? assert-can-see-client]]
|
||||
[auto-ap.routes.utils :refer [wrap-secure wrap-spec]]
|
||||
[auto-ap.entities.companies :as entity]
|
||||
[auto-ap.entities.clients :as entity]
|
||||
[compojure.core :refer [GET PUT context defroutes
|
||||
wrap-routes]]))
|
||||
|
||||
|
||||
(defroutes routes
|
||||
(wrap-routes
|
||||
(context "/companies" []
|
||||
(context "/clients" []
|
||||
#_(wrap-spec
|
||||
(PUT "/:id" {{:keys [address email locations new-bank-accounts]} :edn-params :keys [edn-params] {:keys [id ]} :route-params :as r}
|
||||
(assert-can-see-company (:identity r) id)
|
||||
(assert-can-see-client (:identity r) id)
|
||||
(let [id (Integer/parseInt id)
|
||||
company (companies/get-by-id id)
|
||||
company (d-clients/get-by-id id)
|
||||
updated-company (merge company {:address address
|
||||
:email email
|
||||
:locations locations})]
|
||||
@@ -30,7 +30,7 @@
|
||||
(if-let [id (:db/id (or (clients client-code)
|
||||
(clients client)))]
|
||||
id
|
||||
(throw (Exception. (str "Company code '" client-code "' and company named '" client "' not found.")))))
|
||||
(throw (Exception. (str "Client code '" client-code "' and client named '" client "' not found.")))))
|
||||
|
||||
(defn parse-invoice-number [{:keys [invoice-number]}]
|
||||
(or invoice-number ""))
|
||||
@@ -94,7 +94,7 @@
|
||||
:details (str e)})))))
|
||||
|
||||
(defn parse-invoice-rows [excel-rows]
|
||||
(let [columns [:raw-date :vendor-name :check :location :invoice-number :amount :company :bill-entered :bill-rejected :added-on :exported-on :default-expense-account]
|
||||
(let [columns [:raw-date :vendor-name :check :location :invoice-number :amount :client :bill-entered :bill-rejected :added-on :exported-on :default-expense-account]
|
||||
all-vendors (by :vendor/name (d-vendors/get-graphql {}))
|
||||
all-clients (d-clients/get-all)
|
||||
all-clients (merge (by :client/code all-clients) (by :client/name all-clients))
|
||||
|
||||
Reference in New Issue
Block a user