working on solr stuff.
This commit is contained in:
@@ -7,17 +7,17 @@
|
|||||||
:system "dev"}
|
:system "dev"}
|
||||||
:db-name "prod-migration2"
|
:db-name "prod-migration2"
|
||||||
:jwt-secret "auto ap invoices are awesome"
|
:jwt-secret "auto ap invoices are awesome"
|
||||||
:aws-access-key-id "AKIAJIS67OSJARD2E6VQ"
|
:aws-access-key-id "AKIAINHACMVQJ6NYD26A"
|
||||||
:aws-secret-access-key "Z+AOjQU9M4SwKVU2meYtyNxXtz1Axu/9xohvteXf"
|
:aws-secret-access-key "FwdL4TbIC/5H/4mwhQy4iSI/eSewyPgfS1EEt6tL"
|
||||||
:aws-region "us-east-1"
|
:aws-region "us-east-1"
|
||||||
:datomic-url "datomic:dev://localhost:4334/dev2"
|
:datomic-url "datomic:dev://localhost:4334/dev2"
|
||||||
:invoice-import-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-mail-staging"
|
:invoice-import-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-mail-staging"
|
||||||
:background-task-definition "integreat_background-worker_prod"
|
:background-task-definition "integreat_background-worker_prod"
|
||||||
:requests-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-background-request-prod"
|
:requests-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-background-request-prod"
|
||||||
:scheduled-jobs-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-scheduled-jobs-prod"
|
:scheduled-jobs-queue-url "https://sqs.us-east-1.amazonaws.com/679918342773/integreat-scheduled-jobs-prod"
|
||||||
:invoice-email "invoices-staging@mail.app.integreatconsult.com"
|
:invoice-email "invoices-staging@mail.app.integreatconsult.com"
|
||||||
:import-failure-destination-email "bryce@brycecovertoperations.com"
|
:import-failure-destination-email "bryce@brycecovertoperations.com"
|
||||||
:data-bucket "data.staging.app.integreatconsult.com"
|
:data-bucket "data.dev.app.integreatconsult.com"
|
||||||
:plaid {:base-url "https://sandbox.plaid.com"
|
:plaid {:base-url "https://sandbox.plaid.com"
|
||||||
:client-id "61bfab05f7e762001b323f79"
|
:client-id "61bfab05f7e762001b323f79"
|
||||||
:secret-key "f902743e6f4cef86b7f3b51141aeea"}
|
:secret-key "f902743e6f4cef86b7f3b51141aeea"}
|
||||||
@@ -41,88 +41,6 @@
|
|||||||
:yodlee2-client-secret "8I0mmq1wmAWSSpr9"
|
:yodlee2-client-secret "8I0mmq1wmAWSSpr9"
|
||||||
:yodlee2-base-url "https://sandbox.api.yodlee.com/ysl"
|
:yodlee2-base-url "https://sandbox.api.yodlee.com/ysl"
|
||||||
:yodlee2-fastlink "https://fl4.sandbox.yodlee.com/authenticate/restserver/fastlink"
|
:yodlee2-fastlink "https://fl4.sandbox.yodlee.com/authenticate/restserver/fastlink"
|
||||||
|
|
||||||
:square-config {"NGE1"
|
|
||||||
{:square-location "SCX0Y8CTGM1S0",
|
|
||||||
:location "UC",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGOP"
|
|
||||||
{:square-location "L3GMNBFARX9GG",
|
|
||||||
:location "OP",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGDG"
|
|
||||||
{:square-location "LQTHXQY69MYB6",
|
|
||||||
:location "DB",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGPG"
|
|
||||||
{:square-location "AMQ0NPA8FGDEF",
|
|
||||||
:location "SZ",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGEZ"
|
|
||||||
{:square-location "L0Z167T2T7W7F",
|
|
||||||
:location "JS",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGLK"
|
|
||||||
{:square-location "LRC7WVD77ZM81",
|
|
||||||
:location "SM",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGA1"
|
|
||||||
{:square-location "FZ3ZYC77T3W1T",
|
|
||||||
:location "KA",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGKG"
|
|
||||||
{:square-location "8JT71V8XGYAT3",
|
|
||||||
:location "NB",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGEB"
|
|
||||||
{:square-location "LEV4GM1JPJS6R",
|
|
||||||
:location "CV",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGGG"
|
|
||||||
{:square-location "L7S9MXZBJ00HY",
|
|
||||||
:location "LM",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGRV"
|
|
||||||
{:square-location "L0J45VZKHWXVR",
|
|
||||||
:location "RV",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGSM"
|
|
||||||
{:square-location "LG5X0MHA4NZDM",
|
|
||||||
:location "SM",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGZO"
|
|
||||||
{:square-location "KMVFQ9CRCXJ10",
|
|
||||||
:location "VT",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGWL"
|
|
||||||
{:square-location "LSWNP14T0YKD9",
|
|
||||||
:location "WL",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGMJ"
|
|
||||||
{:square-location "FNH5VRT890WK8",
|
|
||||||
:location "SC",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGHG"
|
|
||||||
{:square-location "LXJCAHYGZVNEJ",
|
|
||||||
:location "DC",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGVZ"
|
|
||||||
{:square-location "ACNTYY8WVZ6DV",
|
|
||||||
:location "NP",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGAK"
|
|
||||||
{:square-location "2RVBYER6QSV7W",
|
|
||||||
:location "MH",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
|
|
||||||
"NGGH"
|
|
||||||
{:square-location "LT322EK0S2TRD",
|
|
||||||
:location "FM",
|
|
||||||
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"}
|
|
||||||
"20TY"
|
|
||||||
{:square-location "L2579ATQ0X1ET",
|
|
||||||
:location "WG",
|
|
||||||
:token "EAAAEEr749Ea6AdPTdngsmUPwIM3ETbPwcx3QQl_NS0KWuIL-JNzAg4f3W9DGQhb"}}
|
|
||||||
|
|
||||||
:intuit {:client-id "ABBAQI0qeck149vEC1e8tV6b3YJNujOCdwsUMkJ1ZoptzumyYu"
|
:intuit {:client-id "ABBAQI0qeck149vEC1e8tV6b3YJNujOCdwsUMkJ1ZoptzumyYu"
|
||||||
:client-secret "7DriIEend1K9RHlzhupIxPFQozXHELLfeFW2GfTR"
|
:client-secret "7DriIEend1K9RHlzhupIxPFQozXHELLfeFW2GfTR"
|
||||||
:redirect-uri "https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl"}}
|
:redirect-uri "https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl"}}
|
||||||
|
|||||||
@@ -1224,14 +1224,14 @@ input:checked + .toggle-bg {
|
|||||||
margin-top: 0.5rem;
|
margin-top: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mt-5 {
|
|
||||||
margin-top: 1.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mt-4 {
|
.mt-4 {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mt-5 {
|
||||||
|
margin-top: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
.block {
|
.block {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
@@ -1364,6 +1364,10 @@ input:checked + .toggle-bg {
|
|||||||
max-width: 42rem;
|
max-width: 42rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.max-w-lg {
|
||||||
|
max-width: 32rem;
|
||||||
|
}
|
||||||
|
|
||||||
.max-w-screen-2xl {
|
.max-w-screen-2xl {
|
||||||
max-width: 1536px;
|
max-width: 1536px;
|
||||||
}
|
}
|
||||||
@@ -1372,10 +1376,6 @@ input:checked + .toggle-bg {
|
|||||||
max-width: 1024px;
|
max-width: 1024px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.max-w-lg {
|
|
||||||
max-width: 32rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex-1 {
|
.flex-1 {
|
||||||
flex: 1 1 0%;
|
flex: 1 1 0%;
|
||||||
}
|
}
|
||||||
@@ -1564,24 +1564,18 @@ input:checked + .toggle-bg {
|
|||||||
margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));
|
margin-bottom: calc(0.75rem * var(--tw-space-y-reverse));
|
||||||
}
|
}
|
||||||
|
|
||||||
.space-y-6 > :not([hidden]) ~ :not([hidden]) {
|
|
||||||
--tw-space-y-reverse: 0;
|
|
||||||
margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
|
|
||||||
margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
|
|
||||||
}
|
|
||||||
|
|
||||||
.space-y-8 > :not([hidden]) ~ :not([hidden]) {
|
|
||||||
--tw-space-y-reverse: 0;
|
|
||||||
margin-top: calc(2rem * calc(1 - var(--tw-space-y-reverse)));
|
|
||||||
margin-bottom: calc(2rem * var(--tw-space-y-reverse));
|
|
||||||
}
|
|
||||||
|
|
||||||
.space-y-4 > :not([hidden]) ~ :not([hidden]) {
|
.space-y-4 > :not([hidden]) ~ :not([hidden]) {
|
||||||
--tw-space-y-reverse: 0;
|
--tw-space-y-reverse: 0;
|
||||||
margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
|
margin-top: calc(1rem * calc(1 - var(--tw-space-y-reverse)));
|
||||||
margin-bottom: calc(1rem * var(--tw-space-y-reverse));
|
margin-bottom: calc(1rem * var(--tw-space-y-reverse));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.space-y-6 > :not([hidden]) ~ :not([hidden]) {
|
||||||
|
--tw-space-y-reverse: 0;
|
||||||
|
margin-top: calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));
|
||||||
|
margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
|
||||||
|
}
|
||||||
|
|
||||||
.divide-y > :not([hidden]) ~ :not([hidden]) {
|
.divide-y > :not([hidden]) ~ :not([hidden]) {
|
||||||
--tw-divide-y-reverse: 0;
|
--tw-divide-y-reverse: 0;
|
||||||
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse)));
|
||||||
@@ -1719,6 +1713,11 @@ input:checked + .toggle-bg {
|
|||||||
background-color: rgb(204 235 251 / var(--tw-bg-opacity));
|
background-color: rgb(204 235 251 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-blue-300 {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(102 196 242 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-blue-500 {
|
.bg-blue-500 {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(0 156 234 / var(--tw-bg-opacity));
|
background-color: rgb(0 156 234 / var(--tw-bg-opacity));
|
||||||
@@ -1774,6 +1773,11 @@ input:checked + .toggle-bg {
|
|||||||
background-color: rgb(242 248 234 / var(--tw-bg-opacity));
|
background-color: rgb(242 248 234 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.bg-red-100 {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(255 205 205 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
.bg-red-50 {
|
.bg-red-50 {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(255 230 230 / var(--tw-bg-opacity));
|
background-color: rgb(255 230 230 / var(--tw-bg-opacity));
|
||||||
@@ -1793,16 +1797,6 @@ input:checked + .toggle-bg {
|
|||||||
background-color: rgb(253 246 178 / var(--tw-bg-opacity));
|
background-color: rgb(253 246 178 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
.bg-red-100 {
|
|
||||||
--tw-bg-opacity: 1;
|
|
||||||
background-color: rgb(255 205 205 / var(--tw-bg-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-blue-300 {
|
|
||||||
--tw-bg-opacity: 1;
|
|
||||||
background-color: rgb(102 196 242 / var(--tw-bg-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
.bg-opacity-50 {
|
.bg-opacity-50 {
|
||||||
--tw-bg-opacity: 0.5;
|
--tw-bg-opacity: 0.5;
|
||||||
}
|
}
|
||||||
@@ -2545,16 +2539,16 @@ input:checked + .toggle-bg {
|
|||||||
background-color: rgb(24 36 9 / var(--tw-bg-opacity));
|
background-color: rgb(24 36 9 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
:is(.dark .dark\:bg-yellow-900) {
|
|
||||||
--tw-bg-opacity: 1;
|
|
||||||
background-color: rgb(99 49 18 / var(--tw-bg-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
:is(.dark .dark\:bg-red-900) {
|
:is(.dark .dark\:bg-red-900) {
|
||||||
--tw-bg-opacity: 1;
|
--tw-bg-opacity: 1;
|
||||||
background-color: rgb(51 1 1 / var(--tw-bg-opacity));
|
background-color: rgb(51 1 1 / var(--tw-bg-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:is(.dark .dark\:bg-yellow-900) {
|
||||||
|
--tw-bg-opacity: 1;
|
||||||
|
background-color: rgb(99 49 18 / var(--tw-bg-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
:is(.dark .dark\:bg-opacity-80) {
|
:is(.dark .dark\:bg-opacity-80) {
|
||||||
--tw-bg-opacity: 0.8;
|
--tw-bg-opacity: 0.8;
|
||||||
}
|
}
|
||||||
@@ -2604,6 +2598,11 @@ input:checked + .toggle-bg {
|
|||||||
color: rgb(175 211 130 / var(--tw-text-opacity));
|
color: rgb(175 211 130 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:is(.dark .dark\:text-red-300) {
|
||||||
|
--tw-text-opacity: 1;
|
||||||
|
color: rgb(255 104 104 / var(--tw-text-opacity));
|
||||||
|
}
|
||||||
|
|
||||||
:is(.dark .dark\:text-red-400) {
|
:is(.dark .dark\:text-red-400) {
|
||||||
--tw-text-opacity: 1;
|
--tw-text-opacity: 1;
|
||||||
color: rgb(255 53 53 / var(--tw-text-opacity));
|
color: rgb(255 53 53 / var(--tw-text-opacity));
|
||||||
@@ -2619,11 +2618,6 @@ input:checked + .toggle-bg {
|
|||||||
color: rgb(250 202 21 / var(--tw-text-opacity));
|
color: rgb(250 202 21 / var(--tw-text-opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
:is(.dark .dark\:text-red-300) {
|
|
||||||
--tw-text-opacity: 1;
|
|
||||||
color: rgb(255 104 104 / var(--tw-text-opacity));
|
|
||||||
}
|
|
||||||
|
|
||||||
:is(.dark .dark\:placeholder-gray-400)::-moz-placeholder {
|
:is(.dark .dark\:placeholder-gray-400)::-moz-placeholder {
|
||||||
--tw-placeholder-opacity: 1;
|
--tw-placeholder-opacity: 1;
|
||||||
color: rgb(156 163 175 / var(--tw-placeholder-opacity));
|
color: rgb(156 163 175 / var(--tw-placeholder-opacity));
|
||||||
|
|||||||
@@ -44,12 +44,14 @@
|
|||||||
extract)]))
|
extract)]))
|
||||||
|
|
||||||
(defn extract-sheet-details [bucket object]
|
(defn extract-sheet-details [bucket object]
|
||||||
(-> (lambda/invoke {:function-name "xls-extractor" :payload
|
(doto
|
||||||
(json/write-str
|
(-> (lambda/invoke {:function-name "xls-extractor" :payload
|
||||||
|
(json/write-str
|
||||||
{"s3_url" object "s3_bucket" bucket})})
|
{"s3_url" object "s3_bucket" bucket})})
|
||||||
:payload
|
:payload
|
||||||
slurp
|
slurp
|
||||||
json/read-str))
|
json/read-str)
|
||||||
|
println))
|
||||||
|
|
||||||
(defn parse-file
|
(defn parse-file
|
||||||
[file _]
|
[file _]
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
(map vector headers r)))))
|
(map vector headers r)))))
|
||||||
|
|
||||||
(defn map->sales-order [r clients]
|
(defn map->sales-order [r clients]
|
||||||
|
(println r)
|
||||||
(let [order-number (get r "Order Number")
|
(let [order-number (get r "Order Number")
|
||||||
event-date (get r "Event Date")
|
event-date (get r "Event Date")
|
||||||
store-name (get r "Store Name")
|
store-name (get r "Store Name")
|
||||||
|
|||||||
@@ -203,3 +203,34 @@
|
|||||||
(index-documents impl index [i])))
|
(index-documents impl index [i])))
|
||||||
|
|
||||||
|
|
||||||
|
(defrecord InMemSolrClient [data-set-atom]
|
||||||
|
SolrClient
|
||||||
|
(index-documents [this index xs]
|
||||||
|
(swap! data-set-atom
|
||||||
|
(fn [data-set]
|
||||||
|
(reduce
|
||||||
|
(fn [data-set x]
|
||||||
|
(let [thing (datomic->solr x)]
|
||||||
|
(update data-set index conj [(str/join " " (vals x)) thing])))
|
||||||
|
data-set
|
||||||
|
xs)))
|
||||||
|
nil)
|
||||||
|
|
||||||
|
(index-documents-raw [this index xs]
|
||||||
|
(swap! data-set-atom
|
||||||
|
(fn [data-set]
|
||||||
|
(reduce
|
||||||
|
(fn [data-set x]
|
||||||
|
(update data-set index conj [(str/join " " (vals x)) x]))
|
||||||
|
data-set
|
||||||
|
xs))))
|
||||||
|
|
||||||
|
(query [this index q]
|
||||||
|
(filter
|
||||||
|
(fn [[x e]]
|
||||||
|
(str/includes? x (get q "query")))
|
||||||
|
(get @data-set-atom index)))
|
||||||
|
(delete [this index]
|
||||||
|
(swap! data-set-atom dissoc index)))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,159 +8,159 @@
|
|||||||
|
|
||||||
(use-fixtures :each wrap-setup)
|
(use-fixtures :each wrap-setup)
|
||||||
|
|
||||||
(deftest test-account-search
|
#_(deftest test-account-search
|
||||||
(testing "It should find matching account names"
|
|
||||||
@(dc/transact conn [{:account/name "Food Research"
|
|
||||||
:db/ident :client-specific-account
|
|
||||||
:account/numeric-code 51100
|
|
||||||
:account/search-terms "Food Research"
|
|
||||||
:account/applicability :account-applicability/global
|
|
||||||
:account/default-allowance :allowance/allowed}])
|
|
||||||
(sut/rebuild-search-index)
|
|
||||||
(is (> (count (sut/search {:id (admin-token)}
|
|
||||||
{:query "Food Research"}
|
|
||||||
nil
|
|
||||||
))
|
|
||||||
0)))
|
|
||||||
(testing "It should find exact matches by numbers"
|
|
||||||
(is (= (count (sut/search {:id (admin-token)}
|
|
||||||
{:query "51100"}
|
|
||||||
nil
|
|
||||||
))
|
|
||||||
1)))
|
|
||||||
(testing "It should filter out accounts that are not allowed for clients"
|
|
||||||
@(dc/transact conn [{:account/name "CLIENT SPECIFIC"
|
|
||||||
:db/ident :client-specific-account
|
|
||||||
:account/numeric-code 99999
|
|
||||||
:account/search-terms "CLIENTSPECIFIC"
|
|
||||||
:account/applicability :account-applicability/customized
|
|
||||||
:account/default-allowance :allowance/allowed}])
|
|
||||||
(sut/rebuild-search-index)
|
|
||||||
(is (= [] (sut/search {:id (admin-token)}
|
|
||||||
{:query "CLIENTSPECIFIC"}
|
|
||||||
nil
|
|
||||||
)))
|
|
||||||
|
|
||||||
(testing "It should show up for the client specific version"
|
|
||||||
(let [client-id (-> @(dc/transact conn [{:client/name "CLIENT"
|
|
||||||
:db/id "client"}
|
|
||||||
{:db/ident :client-specific-account
|
|
||||||
:account/client-overrides [{:account-client-override/client "client"
|
|
||||||
:account-client-override/name "HI"
|
|
||||||
:account-client-override/search-terms "HELLOWORLD"}]}])
|
|
||||||
:tempids
|
|
||||||
(get "client"))]
|
|
||||||
(sut/rebuild-search-index)
|
|
||||||
(is (= 1 (count (sut/search {:id (admin-token)}
|
|
||||||
{:query "HELLOWORLD"
|
|
||||||
:client_id client-id}
|
|
||||||
nil))))))
|
|
||||||
|
|
||||||
(testing "It should hide accounts that arent applicable"
|
(with-redefs [auto-ap.solr/impl (auto-ap.solr/->InMemSolrClient (atom {}))]
|
||||||
@(dc/transact conn [{:account/name "DENIED"
|
(testing "It should find matching account names"
|
||||||
:db/ident :denied-account
|
@(dc/transact conn [{:account/name "Food Research"
|
||||||
:account/numeric-code 99998
|
:db/ident :client-specific-account
|
||||||
:account/search-terms "DENIED"
|
:account/numeric-code 51100
|
||||||
:account/applicability :account-applicability/global
|
:account/search-terms "Food Research"
|
||||||
:account/default-allowance :allowance/denied
|
:account/applicability :account-applicability/global
|
||||||
:account/vendor-allowance :allowance/denied
|
:account/default-allowance :allowance/allowed}])
|
||||||
:account/invoice-allowance :allowance/denied}])
|
|
||||||
(is (= 0 (count (sut/search {:id (admin-token)}
|
|
||||||
{:query "DENIED"}
|
|
||||||
nil))))
|
|
||||||
(is (= 0 (count (sut/search {:id (admin-token)}
|
|
||||||
{:query "DENIED"
|
|
||||||
:allowance :invoice}
|
|
||||||
nil))))
|
|
||||||
(is (= 0 (count (sut/search {:id (admin-token)}
|
|
||||||
{:query "DENIED"
|
|
||||||
:allowance :vendor}
|
|
||||||
nil)))))
|
|
||||||
|
|
||||||
(testing "It should warn when using a warn account"
|
|
||||||
@(dc/transact conn [{:account/name "WARNING"
|
|
||||||
:db/ident :warn-account
|
|
||||||
:account/numeric-code 99997
|
|
||||||
:account/search-terms "WARNING"
|
|
||||||
:account/applicability :account-applicability/global
|
|
||||||
:account/default-allowance :allowance/warn
|
|
||||||
:account/vendor-allowance :allowance/warn
|
|
||||||
:account/invoice-allowance :allowance/warn}])
|
|
||||||
(sut/rebuild-search-index)
|
(sut/rebuild-search-index)
|
||||||
(is (some? (:warning (first (sut/search {:id (admin-token)}
|
(clojure.pprint/pprint auto-ap.solr/impl)
|
||||||
{:query "WARNING"
|
(is (> (count (sut/search {:id (admin-token)}
|
||||||
:allowance :global}
|
{:query "Food Research"}
|
||||||
nil)))))
|
nil))
|
||||||
(is (some? (:warning (first (sut/search {:id (admin-token)}
|
0)))
|
||||||
{:query "WARNING"
|
(testing "It should find exact matches by numbers"
|
||||||
:allowance :invoice}
|
(is (= (count (sut/search {:id (admin-token)}
|
||||||
nil)))))
|
{:query "51100"}
|
||||||
(is (some? (:warning (first (sut/search {:id (admin-token)}
|
nil))
|
||||||
{:query "WARNING"
|
1)))
|
||||||
:allowance :vendor}
|
(testing "It should filter out accounts that are not allowed for clients"
|
||||||
nil))))))
|
@(dc/transact conn [{:account/name "CLIENT SPECIFIC"
|
||||||
(testing "It should only include admin accounts for admins"
|
:db/ident :client-specific-account
|
||||||
@(dc/transact conn [{:account/name "ADMINONLY"
|
:account/numeric-code 99999
|
||||||
:db/ident :warn-account
|
:account/search-terms "CLIENTSPECIFIC"
|
||||||
:account/numeric-code 99997
|
:account/applicability :account-applicability/customized
|
||||||
:account/search-terms "ADMINONLY"
|
:account/default-allowance :allowance/allowed}])
|
||||||
:account/applicability :account-applicability/global
|
|
||||||
:account/default-allowance :allowance/admin-only
|
|
||||||
:account/vendor-allowance :allowance/admin-only
|
|
||||||
:account/invoice-allowance :allowance/admin-only}])
|
|
||||||
(sut/rebuild-search-index)
|
(sut/rebuild-search-index)
|
||||||
(is (= 1 (count (sut/search {:id (admin-token)}
|
(is (= [] (sut/search {:id (admin-token)}
|
||||||
{:query "ADMINONLY"}
|
{:query "CLIENTSPECIFIC"}
|
||||||
nil))))
|
nil)))
|
||||||
(is (= 0 (count (sut/search {:id (user-token)}
|
|
||||||
{:query "ADMINONLY"}
|
|
||||||
nil)))))
|
|
||||||
|
|
||||||
(testing "It should allow searching for vendor accounts for invoices"
|
(testing "It should show up for the client specific version"
|
||||||
(let [vendor-id (-> @(dc/transact conn [{:account/name "VENDORONLY"
|
(let [client-id (-> @(dc/transact conn [{:client/name "CLIENT"
|
||||||
:db/id "vendor-only"
|
:db/id "client"}
|
||||||
:db/ident :vendor-only
|
{:db/ident :client-specific-account
|
||||||
:account/numeric-code 99996
|
:account/client-overrides [{:account-client-override/client "client"
|
||||||
:account/search-terms "VENDORONLY"
|
:account-client-override/name "HI"
|
||||||
:account/applicability :account-applicability/global
|
:account-client-override/search-terms "HELLOWORLD"}]}])
|
||||||
:account/default-allowance :allowance/allowed
|
:tempids
|
||||||
:account/vendor-allowance :allowance/allowed
|
(get "client"))]
|
||||||
:account/invoice-allowance :allowance/denied}
|
(sut/rebuild-search-index)
|
||||||
{:vendor/name "Allowed"
|
(is (= 1 (count (sut/search {:id (admin-token)}
|
||||||
:vendor/default-account "vendor-only"
|
{:query "HELLOWORLD"
|
||||||
:db/id "vendor"}])
|
:client_id client-id}
|
||||||
:tempids
|
nil))))))
|
||||||
(get "vendor"))]
|
|
||||||
(sut/rebuild-search-index)
|
(testing "It should hide accounts that arent applicable"
|
||||||
|
@(dc/transact conn [{:account/name "DENIED"
|
||||||
|
:db/ident :denied-account
|
||||||
|
:account/numeric-code 99998
|
||||||
|
:account/search-terms "DENIED"
|
||||||
|
:account/applicability :account-applicability/global
|
||||||
|
:account/default-allowance :allowance/denied
|
||||||
|
:account/vendor-allowance :allowance/denied
|
||||||
|
:account/invoice-allowance :allowance/denied}])
|
||||||
(is (= 0 (count (sut/search {:id (admin-token)}
|
(is (= 0 (count (sut/search {:id (admin-token)}
|
||||||
{:query "VENDORONLY"
|
{:query "DENIED"}
|
||||||
|
nil))))
|
||||||
|
(is (= 0 (count (sut/search {:id (admin-token)}
|
||||||
|
{:query "DENIED"
|
||||||
:allowance :invoice}
|
:allowance :invoice}
|
||||||
nil))))
|
nil))))
|
||||||
|
(is (= 0 (count (sut/search {:id (admin-token)}
|
||||||
|
{:query "DENIED"
|
||||||
|
:allowance :vendor}
|
||||||
|
nil)))))
|
||||||
|
|
||||||
|
(testing "It should warn when using a warn account"
|
||||||
|
@(dc/transact conn [{:account/name "WARNING"
|
||||||
|
:db/ident :warn-account
|
||||||
|
:account/numeric-code 99997
|
||||||
|
:account/search-terms "WARNING"
|
||||||
|
:account/applicability :account-applicability/global
|
||||||
|
:account/default-allowance :allowance/warn
|
||||||
|
:account/vendor-allowance :allowance/warn
|
||||||
|
:account/invoice-allowance :allowance/warn}])
|
||||||
|
(sut/rebuild-search-index)
|
||||||
|
(is (some? (:warning (first (sut/search {:id (admin-token)}
|
||||||
|
{:query "WARNING"
|
||||||
|
:allowance :global}
|
||||||
|
nil)))))
|
||||||
|
(is (some? (:warning (first (sut/search {:id (admin-token)}
|
||||||
|
{:query "WARNING"
|
||||||
|
:allowance :invoice}
|
||||||
|
nil)))))
|
||||||
|
(is (some? (:warning (first (sut/search {:id (admin-token)}
|
||||||
|
{:query "WARNING"
|
||||||
|
:allowance :vendor}
|
||||||
|
nil))))))
|
||||||
|
(testing "It should only include admin accounts for admins"
|
||||||
|
@(dc/transact conn [{:account/name "ADMINONLY"
|
||||||
|
:db/ident :warn-account
|
||||||
|
:account/numeric-code 99997
|
||||||
|
:account/search-terms "ADMINONLY"
|
||||||
|
:account/applicability :account-applicability/global
|
||||||
|
:account/default-allowance :allowance/admin-only
|
||||||
|
:account/vendor-allowance :allowance/admin-only
|
||||||
|
:account/invoice-allowance :allowance/admin-only}])
|
||||||
|
(sut/rebuild-search-index)
|
||||||
(is (= 1 (count (sut/search {:id (admin-token)}
|
(is (= 1 (count (sut/search {:id (admin-token)}
|
||||||
{:query "VENDORONLY"
|
{:query "ADMINONLY"}
|
||||||
:allowance :invoice
|
nil))))
|
||||||
:vendor_id vendor-id}
|
(is (= 0 (count (sut/search {:id (user-token)}
|
||||||
nil))))))))
|
{:query "ADMINONLY"}
|
||||||
|
nil)))))
|
||||||
|
|
||||||
(deftest get-graphql
|
(testing "It should allow searching for vendor accounts for invoices"
|
||||||
(testing "should retrieve a single account"
|
(let [vendor-id (-> @(dc/transact conn [{:account/name "VENDORONLY"
|
||||||
@(dc/transact conn [{:account/numeric-code 1
|
:db/id "vendor-only"
|
||||||
:account/default-allowance :allowance/allowed
|
:db/ident :vendor-only
|
||||||
:account/type :account-type/asset
|
:account/numeric-code 99996
|
||||||
:account/location "A"
|
:account/search-terms "VENDORONLY"
|
||||||
:account/name "Test"}])
|
:account/applicability :account-applicability/global
|
||||||
|
:account/default-allowance :allowance/allowed
|
||||||
|
:account/vendor-allowance :allowance/allowed
|
||||||
|
:account/invoice-allowance :allowance/denied}
|
||||||
|
{:vendor/name "Allowed"
|
||||||
|
:vendor/default-account "vendor-only"
|
||||||
|
:db/id "vendor"}])
|
||||||
|
:tempids
|
||||||
|
(get "vendor"))]
|
||||||
|
(sut/rebuild-search-index)
|
||||||
|
(is (= 0 (count (sut/search {:id (admin-token)}
|
||||||
|
{:query "VENDORONLY"
|
||||||
|
:allowance :invoice}
|
||||||
|
nil))))
|
||||||
|
|
||||||
(is (= {:name "Test",
|
(is (= 1 (count (sut/search {:id (admin-token)}
|
||||||
:invoice_allowance nil,
|
{:query "VENDORONLY"
|
||||||
:numeric_code 1,
|
:allowance :invoice
|
||||||
:vendor_allowance nil,
|
:vendor_id vendor-id}
|
||||||
:location "A",
|
nil)))))))
|
||||||
:applicability nil}
|
|
||||||
(dissoc (first (:accounts (sut/get-graphql {:id (admin-token)} {} nil)))
|
(deftest get-graphql
|
||||||
:id
|
(testing "should retrieve a single account"
|
||||||
:type
|
@(dc/transact conn [{:account/numeric-code 1
|
||||||
:default_allowance)))))
|
:account/default-allowance :allowance/allowed
|
||||||
|
:account/type :account-type/asset
|
||||||
|
:account/location "A"
|
||||||
|
:account/name "Test"}])
|
||||||
|
|
||||||
|
(is (= {:name "Test",
|
||||||
|
:invoice_allowance nil,
|
||||||
|
:numeric_code 1,
|
||||||
|
:vendor_allowance nil,
|
||||||
|
:location "A",
|
||||||
|
:applicability nil}
|
||||||
|
(dissoc (first (:accounts (sut/get-graphql {:id (admin-token)} {} nil)))
|
||||||
|
:id
|
||||||
|
:type
|
||||||
|
:default_allowance)))))))
|
||||||
|
|
||||||
(deftest upsert-account
|
(deftest upsert-account
|
||||||
(testing "should create a new account"
|
(testing "should create a new account"
|
||||||
|
|||||||
@@ -9,50 +9,51 @@
|
|||||||
(use-fixtures :each wrap-setup)
|
(use-fixtures :each wrap-setup)
|
||||||
|
|
||||||
(deftest stream->sales-orders
|
(deftest stream->sales-orders
|
||||||
(testing "Should import nothing when there are no clients"
|
(with-redefs [auto-ap.solr/impl (auto-ap.solr/->InMemSolrClient (atom {}))]
|
||||||
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
(testing "Should import nothing when there are no clients"
|
||||||
(is (= [:missing "Nick The Greek (Santa Cruz)"] (first (sut/stream->sales-orders s))))))
|
|
||||||
(testing "should import for a single client"
|
|
||||||
(let [{:strs [test-client]} (setup-test-data [(test-client
|
|
||||||
:db/id "test-client"
|
|
||||||
:client/code "NGOP"
|
|
||||||
:client/locations ["DT"]
|
|
||||||
:client/name "The client"
|
|
||||||
:client/matches ["Nick the Greek (Elk Grove)"])])]
|
|
||||||
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
||||||
(is (seq (sut/stream->sales-orders s))))
|
(is (= [:missing "Nick The Greek (Santa Cruz)"] (first (sut/stream->sales-orders s))))))
|
||||||
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
(testing "should import for a single client"
|
||||||
(is (= #:sales-order
|
(let [{:strs [test-client]} (setup-test-data [(test-client
|
||||||
{:vendor :vendor/ccp-ezcater
|
:db/id "test-client"
|
||||||
:service-charge -95.9
|
:client/code "NGOP"
|
||||||
:date #inst "2023-04-03T18:30:00"
|
:client/locations ["DT"]
|
||||||
:reference-link "ZA2-320"
|
:client/name "The client"
|
||||||
:charges
|
:client/matches ["Nick the Greek (Elk Grove)"])])]
|
||||||
[#:charge{:type-name "CARD"
|
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
||||||
:date #inst "2023-04-03T18:30:00"
|
(is (seq (sut/stream->sales-orders s))))
|
||||||
:client test-client
|
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
||||||
:location "DT"
|
(is (= #:sales-order
|
||||||
:external-id
|
{:vendor :vendor/ccp-ezcater
|
||||||
"ezcater/charge/17592186045501-DT-ZA2-320-0"
|
:service-charge -95.9
|
||||||
:processor :ccp-processor/ezcater
|
:date #inst "2023-04-03T18:30:00"
|
||||||
:total 516.12
|
:reference-link "ZA2-320"
|
||||||
:tip 0.0}]
|
:charges
|
||||||
:client test-client
|
[#:charge{:type-name "CARD"
|
||||||
:tip 0.0
|
:date #inst "2023-04-03T18:30:00"
|
||||||
:tax 37.12
|
:client test-client
|
||||||
:external-id "ezcater/order/17592186045501-DT-ZA2-320"
|
:location "DT"
|
||||||
:total 516.12
|
:external-id
|
||||||
:line-items
|
"ezcater/charge/17592186045501-DT-ZA2-320-0"
|
||||||
[#:order-line-item{:external-id
|
:processor :ccp-processor/ezcater
|
||||||
"ezcater/order/17592186045501-DT-ZA2-320-0"
|
:total 516.12
|
||||||
:item-name "EZCater Catering"
|
:tip 0.0}]
|
||||||
:category "EZCater Catering"
|
:client test-client
|
||||||
:discount 0.0
|
:tip 0.0
|
||||||
:tax 37.12
|
:tax 37.12
|
||||||
:total 516.12}]
|
:external-id "ezcater/order/17592186045501-DT-ZA2-320"
|
||||||
:discount 0.0
|
:total 516.12
|
||||||
:location "DT"
|
:line-items
|
||||||
:returns 0.0}
|
[#:order-line-item{:external-id
|
||||||
(last (first (filter (comp #{:order} first)
|
"ezcater/order/17592186045501-DT-ZA2-320-0"
|
||||||
(sut/stream->sales-orders s))))))))))
|
:item-name "EZCater Catering"
|
||||||
|
:category "EZCater Catering"
|
||||||
|
:discount 0.0
|
||||||
|
:tax 37.12
|
||||||
|
:total 516.12}]
|
||||||
|
:discount 0.0
|
||||||
|
:location "DT"
|
||||||
|
:returns 0.0}
|
||||||
|
(last (first (filter (comp #{:order} first)
|
||||||
|
(sut/stream->sales-orders s)))))))))))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user