Files
integreat/src/clj/auto_ap/datomic/migrate/sales.clj
2020-08-21 07:47:44 -07:00

100 lines
5.0 KiB
Clojure

(ns auto-ap.datomic.migrate.sales
(:require [datomic.api :as d]
[auto-ap.datomic :refer [uri]]))
(def norms-map {:add-orders {:txes [[{:db/ident :sales-order/external-id
:db/doc "The client for the sale"
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db/unique :db.unique/identity}
{:db/ident :sales-order/client
:db/doc "The client for the sale"
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one}
{:db/ident :sales-order/location
:db/doc "The location of the sale"
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :sales-order/date
:db/doc "The date the order was placed"
:db/valueType :db.type/instant
:db/cardinality :db.cardinality/one}
{:db/ident :sales-order/total
:db/doc "The total amount on the sale"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
{:db/ident :sales-order/tax
:db/doc "The tax on the sale"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
{:db/ident :sales-order/tip
:db/doc "The tip on the sale"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
{:db/ident :sales-order/charges
:db/doc "How the sale was paid"
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many
:db/isComponent true}
{:db/ident :sales-order/line-items
:db/doc "What the person ordered"
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/many
:db/isComponent true}
{:db/ident :charge/type-name
:db/doc "The type of the charge"
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :charge/total
:db/doc "The total amount on the charge"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
{:db/ident :charge/tax
:db/doc "The tax on the charge"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
{:db/ident :charge/tip
:db/doc "The tip on the charge"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
{:db/ident :order-line-item/item-name
:db/doc "The type of the item"
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one}
{:db/ident :order-line-item/total
:db/doc "The total cost on the item"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
{:db/ident :order-line-item/tax
:db/doc "The tax on the item"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
{:db/ident :order-line-item/tip
:db/doc "The tip on the item"
:db/valueType :db.type/double
:db/cardinality :db.cardinality/one}
]]}})