Add SeaORM migration

This commit is contained in:
eraden 2023-06-03 13:31:57 +02:00
parent aaf45f3954
commit 11681acbda
188 changed files with 16404 additions and 549 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ node_modules
web/dist web/dist
web/tmp web/tmp
adapters adapters
plugins

651
Cargo.lock generated
View File

@ -2,6 +2,12 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "Inflector"
version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3"
[[package]] [[package]]
name = "account_manager" name = "account_manager"
version = "0.1.0" version = "0.1.0"
@ -291,6 +297,12 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "aliasable"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd"
[[package]] [[package]]
name = "alloc-no-stdlib" name = "alloc-no-stdlib"
version = "2.0.4" version = "2.0.4"
@ -372,6 +384,16 @@ version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
[[package]]
name = "async-attributes"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3203e79f4dd9bdda415ed03cf14dae5a2bf775c683a00f94e9cd1faf0f596e5"
dependencies = [
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "async-channel" name = "async-channel"
version = "1.8.0" version = "1.8.0"
@ -383,6 +405,114 @@ dependencies = [
"futures-core", "futures-core",
] ]
[[package]]
name = "async-executor"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fa3dc5f2a8564f07759c008b9109dc0d39de92a88d5588b8a5036d286383afb"
dependencies = [
"async-lock",
"async-task",
"concurrent-queue",
"fastrand",
"futures-lite",
"slab",
]
[[package]]
name = "async-global-executor"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776"
dependencies = [
"async-channel",
"async-executor",
"async-io",
"async-lock",
"blocking",
"futures-lite",
"once_cell",
"tokio 1.28.2",
]
[[package]]
name = "async-io"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
dependencies = [
"async-lock",
"autocfg 1.1.0",
"cfg-if 1.0.0",
"concurrent-queue",
"futures-lite",
"log",
"parking",
"polling",
"rustix 0.37.19",
"slab",
"socket2 0.4.9",
"waker-fn",
]
[[package]]
name = "async-lock"
version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa24f727524730b077666307f2734b4a1a1c57acb79193127dcc8914d5242dd7"
dependencies = [
"event-listener",
]
[[package]]
name = "async-std"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62565bb4402e926b29953c785397c6dc0391b7b446e45008b0049eb43cec6f5d"
dependencies = [
"async-attributes",
"async-channel",
"async-global-executor",
"async-io",
"async-lock",
"crossbeam-utils",
"futures-channel",
"futures-core",
"futures-io",
"futures-lite",
"gloo-timers",
"kv-log-macro",
"log",
"memchr",
"once_cell",
"pin-project-lite 0.2.9",
"pin-utils",
"slab",
"wasm-bindgen-futures",
]
[[package]]
name = "async-stream"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51"
dependencies = [
"async-stream-impl",
"futures-core",
"pin-project-lite 0.2.9",
]
[[package]]
name = "async-stream-impl"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.15",
]
[[package]] [[package]]
name = "async-stripe" name = "async-stripe"
version = "0.21.0" version = "0.21.0"
@ -408,6 +538,12 @@ dependencies = [
"uuid 0.8.2", "uuid 0.8.2",
] ]
[[package]]
name = "async-task"
version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecc7ab41815b3c653ccd2978ec3255c81349336702dfdf62ee6f7069b12a3aae"
[[package]] [[package]]
name = "async-trait" name = "async-trait"
version = "0.1.68" version = "0.1.68"
@ -437,6 +573,26 @@ dependencies = [
"autocfg 1.1.0", "autocfg 1.1.0",
] ]
[[package]]
name = "atomic-waker"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3"
[[package]]
name = "attohttpc"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fcf00bc6d5abb29b5f97e3c61a90b6d3caa12f3faf897d4a3e3607c050a35a7"
dependencies = [
"http",
"log",
"native-tls",
"serde",
"serde_json",
"url",
]
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -463,6 +619,45 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "aws-creds"
version = "0.34.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3776743bb68d4ad02ba30ba8f64373f1be4e082fe47651767171ce75bb2f6cf5"
dependencies = [
"attohttpc",
"dirs 4.0.0",
"log",
"quick-xml",
"rust-ini",
"serde",
"thiserror",
"time 0.3.20",
"url",
]
[[package]]
name = "aws-region"
version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "056557a61427d0e5ba29dd931031c8ffed4ee7a550e7cd55692a9d8deb0a9dba"
dependencies = [
"thiserror",
]
[[package]]
name = "bae"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33b8de67cc41132507eeece2584804efcb15f85ba516e34c944b7667f480397a"
dependencies = [
"heck 0.3.3",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "base64" name = "base64"
version = "0.13.1" version = "0.13.1"
@ -531,6 +726,21 @@ dependencies = [
"generic-array", "generic-array",
] ]
[[package]]
name = "blocking"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "77231a1c8f801696fc0123ec6150ce92cffb8e164a02afb9c8ddee0e9b65ad65"
dependencies = [
"async-channel",
"async-lock",
"async-task",
"atomic-waker",
"fastrand",
"futures-lite",
"log",
]
[[package]] [[package]]
name = "borsh" name = "borsh"
version = "0.10.3" version = "0.10.3"
@ -676,10 +886,12 @@ name = "cache-adapter"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bincode",
"config", "config",
"serde", "serde",
"thiserror", "thiserror",
"toml 0.7.4", "toml 0.7.4",
"tracing",
] ]
[[package]] [[package]]
@ -691,6 +903,7 @@ dependencies = [
"cache-adapter", "cache-adapter",
"chrono", "chrono",
"futures-executor", "futures-executor",
"plugin-api",
"serde", "serde",
"tokio 1.28.2", "tokio 1.28.2",
"tracing", "tracing",
@ -869,11 +1082,47 @@ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"strsim 0.8.0", "strsim 0.8.0",
"textwrap", "textwrap 0.11.0",
"unicode-width", "unicode-width",
"vec_map", "vec_map",
] ]
[[package]]
name = "clap"
version = "3.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
dependencies = [
"bitflags",
"clap_derive",
"clap_lex",
"indexmap",
"once_cell",
"textwrap 0.16.0",
]
[[package]]
name = "clap_derive"
version = "3.2.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008"
dependencies = [
"heck 0.4.1",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "clap_lex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
dependencies = [
"os_str_bytes",
]
[[package]] [[package]]
name = "cloudabi" name = "cloudabi"
version = "0.0.3" version = "0.0.3"
@ -1439,6 +1688,12 @@ dependencies = [
"syn 2.0.15", "syn 2.0.15",
] ]
[[package]]
name = "dlv-list"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
[[package]] [[package]]
name = "doc-comment" name = "doc-comment"
version = "0.3.3" version = "0.3.3"
@ -1588,13 +1843,16 @@ dependencies = [
name = "event-bus-adapter" name = "event-bus-adapter"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"async-trait",
"bincode", "bincode",
"config", "config",
"event-bus-messages", "event-bus-messages",
"futures 0.3.28", "futures 0.3.28",
"serde", "serde",
"thiserror", "thiserror",
"tokio 1.28.2",
"toml 0.7.4", "toml 0.7.4",
"uuid 1.3.3",
] ]
[[package]] [[package]]
@ -1611,9 +1869,11 @@ dependencies = [
name = "event-bus-redis" name = "event-bus-redis"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"async-trait",
"event-bus-adapter", "event-bus-adapter",
"futures 0.3.28", "futures 0.3.28",
"futures-util", "futures-util",
"plugin-api",
"redis-async", "redis-async",
"serde", "serde",
"thiserror", "thiserror",
@ -1707,6 +1967,14 @@ dependencies = [
[[package]] [[package]]
name = "file-storage-s3" name = "file-storage-s3"
version = "0.1.0" version = "0.1.0"
dependencies = [
"file-storage-adapter",
"futures 0.3.28",
"rust-s3",
"serde",
"tokio 1.28.2",
"tracing",
]
[[package]] [[package]]
name = "filetime" name = "filetime"
@ -2072,6 +2340,18 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
[[package]]
name = "gloo-timers"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c"
dependencies = [
"futures-channel",
"futures-core",
"js-sys",
"wasm-bindgen",
]
[[package]] [[package]]
name = "gumdrop" name = "gumdrop"
version = "0.8.1" version = "0.8.1"
@ -2709,6 +2989,15 @@ dependencies = [
"winapi-build", "winapi-build",
] ]
[[package]]
name = "kv-log-macro"
version = "1.0.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f"
dependencies = [
"log",
]
[[package]] [[package]]
name = "lang_provider" name = "lang_provider"
version = "0.1.0" version = "0.1.0"
@ -2869,6 +3158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"value-bag",
] ]
[[package]] [[package]]
@ -2916,6 +3206,17 @@ version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5"
[[package]]
name = "maybe-async"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f1b8c13cb1f814b634a96b2c725449fe7ed464a7b8781de8688be5ffbd3f305"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "maybe-owned" name = "maybe-owned"
version = "0.3.4" version = "0.3.4"
@ -2931,6 +3232,12 @@ dependencies = [
"digest", "digest",
] ]
[[package]]
name = "md5"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.5.0" version = "2.5.0"
@ -2964,6 +3271,14 @@ dependencies = [
"autocfg 1.1.0", "autocfg 1.1.0",
] ]
[[package]]
name = "migration"
version = "0.1.0"
dependencies = [
"async-std",
"sea-orm-migration",
]
[[package]] [[package]]
name = "mime" name = "mime"
version = "0.3.17" version = "0.3.17"
@ -2980,6 +3295,15 @@ dependencies = [
"unicase", "unicase",
] ]
[[package]]
name = "minidom"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f45614075738ce1b77a1768912a60c0227525971b03e09122a05b8a34a2a6278"
dependencies = [
"rxml",
]
[[package]] [[package]]
name = "minimal-lexical" name = "minimal-lexical"
version = "0.2.1" version = "0.2.1"
@ -3296,6 +3620,45 @@ dependencies = [
"uuid 1.3.3", "uuid 1.3.3",
] ]
[[package]]
name = "ordered-multimap"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"
dependencies = [
"dlv-list",
"hashbrown 0.12.3",
]
[[package]]
name = "os_str_bytes"
version = "6.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267"
[[package]]
name = "ouroboros"
version = "0.15.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1358bd1558bd2a083fed428ffeda486fbfb323e698cdda7794259d592ca72db"
dependencies = [
"aliasable",
"ouroboros_macro",
]
[[package]]
name = "ouroboros_macro"
version = "0.15.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f7d21ccd03305a674437ee1248f3ab5d4b1db095cf1caf49f1713ddf61956b7"
dependencies = [
"Inflector",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "overload" name = "overload"
version = "0.1.1" version = "0.1.1"
@ -3392,7 +3755,7 @@ dependencies = [
"async-trait", "async-trait",
"chrono", "chrono",
"config", "config",
"futures 0.1.31", "futures 0.3.28",
"model", "model",
"serde", "serde",
"thiserror", "thiserror",
@ -3428,6 +3791,7 @@ dependencies = [
"derive_more", "derive_more",
"fulfillment_adapter", "fulfillment_adapter",
"payment-adapter", "payment-adapter",
"plugin-api",
"serde", "serde",
"thiserror", "thiserror",
"tokio 1.28.2", "tokio 1.28.2",
@ -3566,11 +3930,35 @@ version = "0.1.0"
dependencies = [ dependencies = [
"actix-web", "actix-web",
"async-trait", "async-trait",
"bincode",
"cache-adapter",
"config", "config",
"derive_more",
"event-bus-adapter",
"file-storage-adapter",
"futures 0.3.28",
"payment-adapter",
"serde",
"thiserror", "thiserror",
"tracing", "tracing",
] ]
[[package]]
name = "polling"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
dependencies = [
"autocfg 1.1.0",
"bitflags",
"cfg-if 1.0.0",
"concurrent-queue",
"libc",
"log",
"pin-project-lite 0.2.9",
"windows-sys 0.48.0",
]
[[package]] [[package]]
name = "ppv-lite86" name = "ppv-lite86"
version = "0.2.17" version = "0.2.17"
@ -3664,6 +4052,16 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "quick-xml"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd"
dependencies = [
"memchr",
"serde",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.26" version = "1.0.26"
@ -4108,10 +4506,12 @@ dependencies = [
"serde_urlencoded", "serde_urlencoded",
"tokio 1.28.2", "tokio 1.28.2",
"tokio-native-tls", "tokio-native-tls",
"tokio-util 0.7.8",
"tower-service", "tower-service",
"url", "url",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
"wasm-streams",
"web-sys", "web-sys",
"winreg 0.10.1", "winreg 0.10.1",
] ]
@ -4201,6 +4601,49 @@ dependencies = [
"tokio-rustls", "tokio-rustls",
] ]
[[package]]
name = "rust-ini"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
dependencies = [
"cfg-if 1.0.0",
"ordered-multimap",
]
[[package]]
name = "rust-s3"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b2ac5ff6acfbe74226fa701b5ef793aaa054055c13ebb7060ad36942956e027"
dependencies = [
"async-trait",
"aws-creds",
"aws-region",
"base64 0.13.1",
"bytes 1.4.0",
"cfg-if 1.0.0",
"futures 0.3.28",
"hex",
"hmac",
"http",
"log",
"maybe-async",
"md5",
"minidom",
"percent-encoding",
"quick-xml",
"reqwest 0.11.17",
"serde",
"serde_derive",
"sha2",
"thiserror",
"time 0.3.20",
"tokio 1.28.2",
"tokio-stream",
"url",
]
[[package]] [[package]]
name = "rust_decimal" name = "rust_decimal"
version = "1.29.1" version = "1.29.1"
@ -4322,6 +4765,23 @@ dependencies = [
"num_cpus", "num_cpus",
] ]
[[package]]
name = "rxml"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a98f186c7a2f3abbffb802984b7f1dfd65dac8be1aafdaabbca4137f53f0dff7"
dependencies = [
"bytes 1.4.0",
"rxml_validation",
"smartstring",
]
[[package]]
name = "rxml_validation"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22a197350ece202f19a166d1ad6d9d6de145e1d2a8ef47db299abe164dbd7530"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.13" version = "1.0.13"
@ -4359,6 +4819,151 @@ dependencies = [
"untrusted", "untrusted",
] ]
[[package]]
name = "sea-orm"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fade86e8d41fd1a4721f84cb834f4ca2783f973cc30e6212b7fafc134f169214"
dependencies = [
"async-stream",
"async-trait",
"futures 0.3.28",
"log",
"ouroboros",
"sea-orm-macros",
"sea-query",
"sea-query-binder",
"sea-strum",
"serde",
"sqlx",
"thiserror",
"tracing",
"url",
]
[[package]]
name = "sea-orm-cli"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "efbf34a2caf70c2e3be9bb1e674e9540f6dfd7c8f40f6f05daf3b9740e476005"
dependencies = [
"chrono",
"clap 3.2.25",
"dotenvy",
"regex",
"sea-schema",
"tracing",
"tracing-subscriber",
"url",
]
[[package]]
name = "sea-orm-macros"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28936f26d62234ff0be16f80115dbdeb3237fe9c25cf18fbcd1e3b3592360f20"
dependencies = [
"bae",
"heck 0.3.3",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "sea-orm-migration"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "278d3adfd0832b6ffc17d3cfbc574d3695a5c1b38814e0bc8ac238d33f3d87cf"
dependencies = [
"async-trait",
"clap 3.2.25",
"dotenvy",
"futures 0.3.28",
"sea-orm",
"sea-orm-cli",
"sea-schema",
"tracing",
"tracing-subscriber",
]
[[package]]
name = "sea-query"
version = "0.28.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbab99b8cd878ab7786157b7eb8df96333a6807cc6e45e8888c85b51534b401a"
dependencies = [
"sea-query-derive",
]
[[package]]
name = "sea-query-binder"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cea85029985b40dfbf18318d85fe985c04db7c1b4e5e8e0a0a0cdff5f1e30f9"
dependencies = [
"sea-query",
"sqlx",
]
[[package]]
name = "sea-query-derive"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63f62030c60f3a691f5fe251713b4e220b306e50a71e1d6f9cce1f24bb781978"
dependencies = [
"heck 0.4.1",
"proc-macro2",
"quote",
"syn 1.0.109",
"thiserror",
]
[[package]]
name = "sea-schema"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eeb2940bb5a10bc6cd05b450ce6cd3993e27fddd7eface2becb97fc5af3a040e"
dependencies = [
"futures 0.3.28",
"sea-query",
"sea-schema-derive",
]
[[package]]
name = "sea-schema-derive"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56821b7076f5096b8f726e2791ad255a99c82498e08ec477a65a96c461ff1927"
dependencies = [
"heck 0.3.3",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "sea-strum"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "391d06a6007842cfe79ac6f7f53911b76dfd69fc9a6769f1cf6569d12ce20e1b"
dependencies = [
"sea-strum_macros",
]
[[package]]
name = "sea-strum_macros"
version = "0.23.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69b4397b825df6ccf1e98bcdabef3bbcfc47ff5853983467850eeab878384f21"
dependencies = [
"heck 0.3.3",
"proc-macro2",
"quote",
"rustversion",
"syn 1.0.109",
]
[[package]] [[package]]
name = "seahash" name = "seahash"
version = "4.1.0" version = "4.1.0"
@ -4643,6 +5248,17 @@ dependencies = [
"syn 1.0.109", "syn 1.0.109",
] ]
[[package]]
name = "smartstring"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29"
dependencies = [
"autocfg 1.1.0",
"static_assertions",
"version_check",
]
[[package]] [[package]]
name = "smol_str" name = "smol_str"
version = "0.1.24" version = "0.1.24"
@ -4880,7 +5496,7 @@ version = "0.3.26"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10" checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
dependencies = [ dependencies = [
"clap", "clap 2.34.0",
"lazy_static", "lazy_static",
"structopt-derive", "structopt-derive",
] ]
@ -5061,6 +5677,12 @@ dependencies = [
"unicode-width", "unicode-width",
] ]
[[package]]
name = "textwrap"
version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.40" version = "1.0.40"
@ -5666,6 +6288,16 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]]
name = "value-bag"
version = "1.0.0-alpha.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55"
dependencies = [
"ctor",
"version_check",
]
[[package]] [[package]]
name = "vcpkg" name = "vcpkg"
version = "0.2.15" version = "0.2.15"
@ -5873,6 +6505,19 @@ dependencies = [
"leb128", "leb128",
] ]
[[package]]
name = "wasm-streams"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6bbae3363c08332cadccd13b67db371814cd214c2524020932f0804b8cf7c078"
dependencies = [
"futures-util",
"js-sys",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
]
[[package]] [[package]]
name = "wasmparser" name = "wasmparser"
version = "0.93.0" version = "0.93.0"

View File

@ -9,47 +9,56 @@ members = [
# actors # actors
"crates/account_manager", "crates/account_manager",
"crates/cart_manager", "crates/cart_manager",
# "crates/database_manager", # "crates/database_manager",
"crates/email_manager", "crates/email_manager",
"crates/order_manager", "crates/order_manager",
"crates/payment_manager", "crates/payment_manager",
"crates/search_manager", "crates/search_manager",
"crates/stock_manager", "crates/stock_manager",
"crates/token_manager", "crates/token_manager",
# "crates/fs_manager", # "crates/fs_manager",
"crates/lang_provider", "crates/lang_provider",
"crates/fulfillment_adapter", "crates/fulfillment_adapter",
# "crates/payment_adapter_pay_u", # "crates/payment_adapter_pay_u",
# artifacts # artifacts
# "crates/db-seed", # "crates/db-seed",
# "crates/api", # "crates/api",
# "crates/web", # "crates/web",
# vendor # vendor
# "vendor/t_pay", # "vendor/t_pay",
# "vendor/pay_u", # "vendor/pay_u",
# PLUGINS # PLUGINS
"crates/plugin-api", "crates/plugin-api",
# PAYMENT # PAYMENT
"crates/payment-adapter", "crates/payment-adapter",
"crates/payment-pay-u", "crates/payment-pay-u-plugin",
"crates/payment-stripe", "crates/payment-stripe-plugin",
# EVENT BUS # EVENT BUS
"crates/event-bus-messages", "crates/event-bus-messages",
"crates/event-bus-adapter", "crates/event-bus-adapter",
"crates/event-bus-redis", "crates/event-bus-redis-plugin",
# CACHE # CACHE
"crates/cache-adapter", "crates/cache-adapter",
"crates/cache-adapter-redis", "crates/cache-redis-plugin",
"crates/cache-adapter-embedded-memory", "crates/cache-embedded-memory-plugin",
# FILE STORAGE # FILE STORAGE
"crates/file-storage-adapter", "crates/file-storage-adapter",
"crates/file-storage-local", "crates/file-storage-local-plugin",
"crates/file-storage-s3", "crates/file-storage-s3-plugin",
# database
"migration",
] ]
exclude = [ exclude = [
"crates/web" "crates/web"
] ]
[workspace.dependencies]
plugin-api = { path = "crates/plugin-api" }
payment-adapter = { path = "crates/payment-adapter" }
event-bus-adapter = { path = "crates/event-bus-adapter" }
cache-adapter = { path = "crates/cache-adapter" }
file-storage-adapter = { path = "crates/file-storage-adapter" }
[profile.release] [profile.release]
lto = true lto = true
opt-level = 's' opt-level = 's'

View File

@ -1,5 +0,0 @@
// generated by `sqlx migrate build-script`
fn main() {
// trigger recompilation when a new migration is added
println!("cargo:rerun-if-changed=migrations");
}

View File

@ -5,7 +5,9 @@ edition = "2021"
[dependencies] [dependencies]
async-trait = { version = "0.1.68" } async-trait = { version = "0.1.68" }
serde = { version = "1.0.163", feeatures = ['derive'] } bincode = { version = "1" }
config = { path = "../config" }
serde = { version = "1.0.163", features = ['derive'] }
thiserror = { version = "1.0.40" } thiserror = { version = "1.0.40" }
toml = { version = "0.7.3" } toml = { version = "0.7.3" }
config = { path = "../config" } tracing = { version = "0.1.37" }

View File

@ -1,7 +1,10 @@
#![feature(box_into_inner)]
use std::borrow::Cow; use std::borrow::Cow;
use async_trait::async_trait; use async_trait::async_trait;
pub use config::PluginConfig; pub use config::PluginConfig;
use tracing::warn;
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum Error { pub enum Error {
@ -25,26 +28,41 @@ pub enum InvalidatePattern<'s> {
Const(Cow<'s, str>), Const(Cow<'s, str>),
} }
#[async_trait] pub struct CacheObject(pub Option<Vec<u8>>);
pub trait CacheAdapter: Sized {
async fn new(config: PluginConfig) -> CResult<Self>;
async fn read<T>(&mut self, key: &str) -> CResult<Option<T>> impl CacheObject {
pub fn into_inner<T>(self) -> CResult<Option<T>>
where where
T: serde::de::DeserializeOwned; T: serde::de::DeserializeOwned,
{
let Some(data) = self.0 else {
return Ok(None)
};
bincode::deserialize(&data)
.map_err(|e| {
warn!("Malformed cache entry: {e}");
Error::InvalidEntry
})
.map(Some)
}
}
async fn set<T>( #[async_trait]
pub trait CacheAdapter {
async fn new(config: PluginConfig) -> CResult<Self>
where
Self: Sized;
async fn read(&self, key: &str) -> CResult<CacheObject>;
async fn set(
&mut self, &mut self,
key: &str, key: &str,
data: T, data: &[u8],
expires_in: Option<std::time::Duration>, expires_in: Option<std::time::Duration>,
) -> CResult<()> ) -> CResult<()>;
where
T: serde::Serialize + Send;
async fn invalidate(&mut self, pattern: InvalidatePattern<'_>) -> CResult<u64>; async fn invalidate(&mut self, pattern: InvalidatePattern<'_>) -> CResult<u64>;
async fn clear(&mut self) -> CResult<u64>; async fn clear(&mut self) -> CResult<u64>;
} }
pub struct CacheStorage {}

View File

@ -3,12 +3,17 @@ name = "cache-adapter-embedded-memory"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
[lib]
crate-type = ["cdylib"]
path = "src/lib.rs"
[dependencies] [dependencies]
cache-adapter = { path = "../cache-adapter" }
serde = { version = "1.0.163", features = ['derive'] }
async-trait = { version = "0.1.68" } async-trait = { version = "0.1.68" }
chrono = { version = "0.4.26" }
bincode = { version = "1" } bincode = { version = "1" }
tracing = { version = "0" } cache-adapter = { path = "../cache-adapter" }
chrono = { version = "0.4.26" }
futures-executor = { version = "0.3.28", features = [] } futures-executor = { version = "0.3.28", features = [] }
plugin-api = { workspace = true }
serde = { version = "1.0.163", features = ['derive'] }
tokio = { version = "1.28.2", features = ['full'] } tokio = { version = "1.28.2", features = ['full'] }
tracing = { version = "0" }

View File

@ -3,10 +3,10 @@ use std::sync::{Arc, RwLock};
use std::time::Duration; use std::time::Duration;
use async_trait::async_trait; use async_trait::async_trait;
use cache_adapter::{CResult, CacheAdapter, Error, InvalidatePattern, PluginConfig}; use cache_adapter::{CResult, CacheAdapter, CacheObject, Error, InvalidatePattern, PluginConfig};
use serde::de::DeserializeOwned; use plugin_api::{AppConfig, Cache, PluginType};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::error; use tracing::{error, warn};
pub struct CacheEntry { pub struct CacheEntry {
pub expires_at: Option<chrono::NaiveDateTime>, pub expires_at: Option<chrono::NaiveDateTime>,
@ -37,14 +37,11 @@ impl CacheAdapter for EmbeddedMemoryCacheAdapter {
}) })
} }
async fn read<T>(&mut self, key: &str) -> CResult<Option<T>> async fn read(&self, key: &str) -> CResult<CacheObject> {
where
T: DeserializeOwned,
{
let (valid, data) = { let (valid, data) = {
let lock = self.storage.read().unwrap(); let lock = self.storage.read().unwrap();
let entry = match lock.get(key) { let entry = match lock.get(key) {
None => return Ok(None), None => return Ok(CacheObject(None)),
Some(entry) => entry, Some(entry) => entry,
}; };
let valid = entry let valid = entry
@ -52,30 +49,21 @@ impl CacheAdapter for EmbeddedMemoryCacheAdapter {
.map(|exp| exp >= chrono::Utc::now().naive_utc()) .map(|exp| exp >= chrono::Utc::now().naive_utc())
.unwrap_or(true); .unwrap_or(true);
let data = if valid { let data = if valid {
match bincode::deserialize::<T>(&entry.payload) { Some(entry.payload.clone())
Ok(t) => Some(t),
Err(e) => {
tracing::warn!("Malformed embedded cache entry {key:?}: {e}");
return Err(Error::InvalidEntry);
}
}
} else { } else {
None None
}; };
(valid, data) (valid, data)
}; };
if valid { if valid {
Ok(data) Ok(CacheObject(data))
} else { } else {
self.storage.write().unwrap().remove(key); self.storage.write().unwrap().remove(key);
Ok(None) Ok(CacheObject(None))
} }
} }
async fn set<T>(&mut self, key: &str, data: T, expires_in: Option<Duration>) -> CResult<()> async fn set(&mut self, key: &str, data: &[u8], expires_in: Option<Duration>) -> CResult<()> {
where
T: Serialize + Send,
{
let expires_at = if let Some(duration) = expires_in.or(self.ttl) { let expires_at = if let Some(duration) = expires_in.or(self.ttl) {
let storage = self.storage.clone(); let storage = self.storage.clone();
let exp = let exp =
@ -96,10 +84,7 @@ impl CacheAdapter for EmbeddedMemoryCacheAdapter {
key.into(), key.into(),
CacheEntry { CacheEntry {
expires_at, expires_at,
payload: bincode::serialize(&data).map_err(|e| { payload: data.to_owned(),
tracing::warn!("Malformed embedded cache entry {key:?}: {e}");
Error::InvalidEntry
})?,
}, },
); );
Ok(()) Ok(())
@ -144,3 +129,47 @@ impl<'s> MatchesKey for InvalidatePattern<'s> {
} }
} }
} }
pub struct Plugin {
config: Option<PluginConfig>,
}
static PLUGIN_NAME: &str = "cache-embedded-memory";
#[async_trait]
impl plugin_api::Plugin for Plugin {
fn plugin_type() -> PluginType
where
Self: Sized,
{
PluginType::Cache
}
fn name(&self) -> &'static str {
PLUGIN_NAME
}
async fn initialize(app_config: &AppConfig) -> Self
where
Self: Sized,
{
Self {
config: app_config.plugin_config(PLUGIN_NAME),
}
}
async fn register_cache(&mut self, cache: &'static mut Cache) {
let Some(config) = self.config.as_ref() else {
warn!("Plugin {:?} does not have config", PLUGIN_NAME);
return;
};
let adapter = match EmbeddedMemoryCacheAdapter::new(config.clone()).await {
Ok(adapter) => adapter,
Err(e) => {
warn!("Failed to construct adapter: {e}");
return;
}
};
cache.register(Box::new(adapter));
}
}

View File

@ -3,15 +3,19 @@ name = "cache-adapter-redis"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
[lib]
crate-type = ["cdylib"]
path = "src/lib.rs"
[dependencies] [dependencies]
redis-async-pool = { git = "https://github.com/Eraden/redis-async-pool.git", branch = "upgrade-dependencies" }
cache-adapter = { path = "../cache-adapter" }
serde = { version = "1.0.163", features = ['derive'] }
async-trait = { version = "0.1.68" } async-trait = { version = "0.1.68" }
chrono = { version = "0.4.26" }
bincode = { version = "1" } bincode = { version = "1" }
tracing = { version = "0" } cache-adapter = { path = "../cache-adapter" }
tokio = { version = "1.28.2", features = ['full'] } chrono = { version = "0.4.26" }
redis = { version = "0.23.0" }
deadpool = { version = "0.9.5" } deadpool = { version = "0.9.5" }
futures = { version = "0.3.28" } futures = { version = "0.3.28" }
redis = { version = "0.23.0" }
redis-async-pool = { git = "https://github.com/Eraden/redis-async-pool.git", branch = "upgrade-dependencies" }
serde = { version = "1.0.163", features = ['derive'] }
tokio = { version = "1.28.2", features = ['full'] }
tracing = { version = "0" }

View File

@ -1,10 +1,9 @@
use std::time::Duration; use std::time::Duration;
use async_trait::async_trait; use async_trait::async_trait;
use cache_adapter::{CResult, CacheAdapter, Error, InvalidatePattern, PluginConfig}; use cache_adapter::{CResult, CacheAdapter, CacheObject, Error, InvalidatePattern, PluginConfig};
use redis::AsyncCommands; use redis::AsyncCommands;
use redis_async_pool::*; use redis_async_pool::*;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use tracing::{error, warn}; use tracing::{error, warn};
@ -60,10 +59,7 @@ impl CacheAdapter for RedisCacheAdapter {
.await .await
} }
async fn read<T>(&mut self, key: &str) -> CResult<Option<T>> async fn read(&self, key: &str) -> CResult<CacheObject> {
where
T: DeserializeOwned,
{
let mut conn = self.client.get().await.map_err(|e| { let mut conn = self.client.get().await.map_err(|e| {
error!("Failed to use pool connection to redis: {e}"); error!("Failed to use pool connection to redis: {e}");
Error::Connect Error::Connect
@ -74,31 +70,20 @@ impl CacheAdapter for RedisCacheAdapter {
Error::Connect Error::Connect
})?; })?;
if !exists { if !exists {
return Ok(None); return Ok(CacheObject(None));
} }
let data: Vec<u8> = conn.get(&key).await.map_err(|e| { let data: Vec<u8> = conn.get(&key).await.map_err(|e| {
warn!("Failed to fetch {key:?} from redis: {e}"); warn!("Failed to fetch {key:?} from redis: {e}");
Error::Connect Error::Connect
})?; })?;
let entry: T = bincode::deserialize(&data).map_err(|e| { Ok(CacheObject(Some(data)))
warn!("Malformed redis cache entry {key:?}: {e}");
Error::InvalidEntry
})?;
Ok(Some(entry))
} }
async fn set<T>(&mut self, key: &str, data: T, expires_in: Option<Duration>) -> CResult<()> async fn set(&mut self, key: &str, data: &[u8], expires_in: Option<Duration>) -> CResult<()> {
where
T: Serialize + Send,
{
let mut conn = self.client.get().await.map_err(|e| { let mut conn = self.client.get().await.map_err(|e| {
error!("Failed to use pool connection to redis: {e}"); error!("Failed to use pool connection to redis: {e}");
Error::Connect Error::Connect
})?; })?;
let data = bincode::serialize(&data).map_err(|e| {
warn!("Malformed redis cache entry {key:?}: {e}");
Error::InvalidEntry
})?;
let key = self.format_key(&*key); let key = self.format_key(&*key);
match expires_in { match expires_in {
Some(duration) => { Some(duration) => {

View File

@ -28,5 +28,5 @@ tarpc = { version = "0", features = ["tokio1", "serde-transport-bincode", "serde
thiserror = { version = "1" } thiserror = { version = "1" }
tokio = { version = "1", features = ['full'] } tokio = { version = "1", features = ['full'] }
tracing = { version = "0" } tracing = { version = "0" }
whatlang = { version = "0" }
uuid = { version = "1", features = ['v4'] } uuid = { version = "1", features = ['v4'] }
whatlang = { version = "0" }

View File

@ -686,6 +686,7 @@ pub struct AppConfig {
tokens: TokensConfig, tokens: TokensConfig,
#[serde(default)] #[serde(default)]
web: WebConfig, web: WebConfig,
plugin: HashMap<String, toml::Value>,
} }
impl Example for AppConfig { impl Example for AppConfig {
@ -704,6 +705,7 @@ impl Example for AppConfig {
order_manager: OrderConfig::example(), order_manager: OrderConfig::example(),
config_path: "".to_string(), config_path: "".to_string(),
tokens: TokensConfig::example(), tokens: TokensConfig::example(),
plugin: Default::default(),
} }
} }
} }
@ -772,6 +774,10 @@ impl AppConfig {
pub fn web_mut(&mut self) -> &mut WebConfig { pub fn web_mut(&mut self) -> &mut WebConfig {
&mut self.web &mut self.web
} }
pub fn plugin_config(&self, name: &str) -> Option<PluginConfig> {
self.plugin.get(name).cloned().map(PluginConfig)
}
} }
impl Default for AppConfig { impl Default for AppConfig {
@ -790,6 +796,7 @@ impl Default for AppConfig {
order_manager: OrderConfig::default(), order_manager: OrderConfig::default(),
config_path: "".to_string(), config_path: "".to_string(),
tokens: Default::default(), tokens: Default::default(),
plugin: Default::default(),
} }
} }
} }
@ -876,12 +883,17 @@ pub fn init_tracing(_service_name: &str) {
.unwrap(); .unwrap();
} }
pub struct PluginConfig(pub String); #[derive(Clone)]
pub struct PluginConfig(pub toml::Value);
impl PluginConfig { impl Default for PluginConfig {
pub fn config<S: serde::de::DeserializeOwned>( fn default() -> Self {
&self, Self(toml::Value::Table(toml::Table::default()))
) -> std::result::Result<S, toml::de::Error> { }
toml::from_str(&self.0) }
impl PluginConfig {
pub fn config<S: serde::de::DeserializeOwned>(self) -> std::result::Result<S, toml::de::Error> {
self.0.try_into::<S>()
} }
} }

View File

@ -4,10 +4,13 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
serde = { version = "1.0.162", features = ['derive'] }
bincode = { version = "1.3.3" } bincode = { version = "1.3.3" }
thiserror = { version = "1.0.40" } config = { path = "../config" }
event-bus-messages = { path = "../event-bus-messages" } event-bus-messages = { path = "../event-bus-messages" }
futures = { version = "0.3.28" } futures = { version = "0.3.28" }
serde = { version = "1.0.162", features = ['derive'] }
thiserror = { version = "1.0.40" }
toml = { version = "0.7.3" } toml = { version = "0.7.3" }
config = { path = "../config" } uuid = { version = "1.3.3", features = ['v4'] }
async-trait = { version = "0.1.68" }
tokio = { version = "1.28.2", features = ['full'] }

View File

@ -1,7 +1,14 @@
#![feature(async_fn_in_trait)] #![feature(async_fn_in_trait)]
#![feature(box_into_inner)]
use std::collections::HashMap;
use std::pin::Pin;
use std::sync::{Arc, RwLock};
use async_trait::async_trait;
pub use config::PluginConfig; pub use config::PluginConfig;
pub use event_bus_messages::*; pub use event_bus_messages::*;
use uuid::Uuid;
#[derive(Debug, thiserror::Error)] #[derive(Debug, thiserror::Error)]
pub enum EBError { pub enum EBError {
@ -15,16 +22,86 @@ pub enum EBError {
pub type EBResult<T> = Result<T, EBError>; pub type EBResult<T> = Result<T, EBError>;
pub trait MessageSend { #[async_trait]
pub trait MessageSend: Send + Sync + 'static {
async fn send(&mut self, topic: Topic, msg: Msg) -> EBResult<()>; async fn send(&mut self, topic: Topic, msg: Msg) -> EBResult<()>;
} }
pub trait EventBus<Stream, Sender> #[async_trait]
where pub trait Subscriber: Send {
Stream: futures::stream::Stream<Item = Message>, fn handle(&self, msg: &Message);
Sender: MessageSend,
{ fn matches(&self, msg: &Message) -> bool;
async fn connect(config: PluginConfig) -> Result<(Stream, Sender), ()>; }
#[derive(Copy, Clone)]
pub struct UnSubscribe(Uuid);
pub struct EventBus {
sender: Box<dyn MessageSend + Send + Sync + 'static>,
subscribers: Arc<RwLock<HashMap<Uuid, Box<dyn Subscriber + Send + Sync + 'static>>>>,
is_alive: Arc<RwLock<bool>>,
}
impl EventBus {
pub fn new(
stream: Box<dyn futures::stream::Stream<Item = Message> + Send + Sync + Unpin + 'static>,
sender: Box<dyn MessageSend + Send + Sync + 'static>,
) -> Self {
let subscribers: Arc<RwLock<HashMap<Uuid, Box<dyn Subscriber + Send + Sync + 'static>>>> =
Arc::new(Default::default());
let is_alive = Arc::new(RwLock::new(true));
{
let subscribers = subscribers.clone();
let is_alive = is_alive.clone();
tokio::spawn(async move {
let mut stream = Pin::new(stream);
let mut stream = stream.as_mut();
loop {
use futures::StreamExt;
if !*is_alive.read().unwrap() {
break;
}
let Some(msg) = stream.next().await else {
break;
};
for subscriber in subscribers.read().unwrap().values() {
let subscriber = subscriber.as_ref();
if !subscriber.matches(&msg) {
continue;
}
subscriber.handle(&msg);
}
}
});
}
Self {
sender,
subscribers,
is_alive,
}
}
async fn emit(&mut self, data: Msg) -> EBResult<()> {
let sender = self.sender.as_mut();
sender.send(Topic::Default, data).await
}
async fn subscribe(
&mut self,
subscriber: Box<dyn Subscriber + Send + Sync + 'static>,
) -> UnSubscribe {
let id = Uuid::new_v4();
self.subscribers.write().unwrap().insert(id, subscriber);
UnSubscribe(id)
}
async fn unsubscribe(&mut self, id: UnSubscribe) {
self.subscribers.write().unwrap().remove(&id.0);
}
} }
/// For client-server purpose only /// For client-server purpose only
@ -43,3 +120,6 @@ impl ClientMsg {
bincode::serialize(self) bincode::serialize(self)
} }
} }
#[cfg(test)]
mod tests {}

View File

@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
thiserror = { version = "1.0.40" }
serde = { version = "1.0.162", features = ['derive'] }
bincode = { version = "1.3.3" } bincode = { version = "1.3.3" }
serde = { version = "1.0.162", features = ['derive'] }
serde_json = { version = "1.0.96" } serde_json = { version = "1.0.96" }
thiserror = { version = "1.0.40" }

View File

@ -3,12 +3,18 @@ name = "event-bus-redis"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
[lib]
crate-type = ["cdylib"]
path = "src/lib.rs"
[dependencies] [dependencies]
redis-async = { version = "0.16.0" } event-bus-adapter = { workspace = true }
event-bus-adapter = { path = "../event-bus-adapter" } plugin-api = { workspace = true }
thiserror = { version = "1.0.40" }
futures-util = { version = "0.3.28" }
futures = { version = "0.3.28" } futures = { version = "0.3.28" }
tracing = { version = "0" } futures-util = { version = "0.3.28" }
redis-async = { version = "0.16.0" }
serde = { version = "1.0.162" } serde = { version = "1.0.162" }
thiserror = { version = "1.0.40" }
toml = { version = "0.7.4" } toml = { version = "0.7.4" }
tracing = { version = "0" }
async-trait = { version = "0.1.68" }

View File

@ -3,11 +3,13 @@
use std::pin::Pin; use std::pin::Pin;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
use async_trait::async_trait;
use event_bus_adapter::{ use event_bus_adapter::{
EBError, EBResult, EventBus, Message, MessageSend, Msg, PluginConfig, Topic, EBError, EBResult, EventBus, Message, MessageSend, Msg, PluginConfig, Topic,
}; };
use futures_util::stream::{SplitSink, SplitStream}; use futures_util::stream::{SplitSink, SplitStream};
use futures_util::{SinkExt, StreamExt}; use futures_util::{SinkExt, StreamExt};
use plugin_api::{AppConfig, EventBusRegister, PluginType};
use redis_async::client::connect::RespConnection; use redis_async::client::connect::RespConnection;
use redis_async::resp::RespValue; use redis_async::resp::RespValue;
use redis_async::resp::RespValue::BulkString; use redis_async::resp::RespValue::BulkString;
@ -15,6 +17,7 @@ use tracing::warn;
pub struct MessageSender(SplitSink<RespConnection, RespValue>); pub struct MessageSender(SplitSink<RespConnection, RespValue>);
#[async_trait]
impl MessageSend for MessageSender { impl MessageSend for MessageSender {
async fn send(&mut self, topic: Topic, msg: Msg) -> EBResult<()> { async fn send(&mut self, topic: Topic, msg: Msg) -> EBResult<()> {
match (Message { match (Message {
@ -84,14 +87,53 @@ pub struct RedisEventBusConfig {
pub struct RedisEventBus; pub struct RedisEventBus;
impl EventBus<MessageStream, MessageSender> for RedisEventBus { impl RedisEventBus {
async fn connect(config: PluginConfig) -> Result<(MessageStream, MessageSender), ()> { async fn connect(config: PluginConfig) -> Result<(Box<MessageStream>, Box<MessageSender>), ()> {
let RedisEventBusConfig { host, port } = config.config().expect("Invalid redis bus config"); let RedisEventBusConfig { host, port } = config.config().expect("Invalid redis bus config");
let client = redis_async::client::connect(&host, port) let client = redis_async::client::connect(&host, port)
.await .await
.expect("Failed to connect to redis event bus"); .expect("Failed to connect to redis event bus");
let (sink, stream) = client.split(); let (sink, stream) = client.split();
Ok((MessageStream(stream), MessageSender(sink))) Ok((
Box::new(MessageStream(stream)),
Box::new(MessageSender(sink)),
))
}
}
pub static PLUGIN_NAME: &str = "event-bus-redis";
pub struct RedisEventBusPlugin {
plugin_config: PluginConfig,
}
#[async_trait]
impl plugin_api::Plugin for RedisEventBusPlugin {
fn plugin_type() -> PluginType
where
Self: Sized,
{
PluginType::EventBus
}
fn name(&self) -> &'static str {
PLUGIN_NAME
}
async fn initialize(app_config: &AppConfig) -> Self
where
Self: Sized,
{
Self {
plugin_config: app_config.plugin_config(PLUGIN_NAME).unwrap_or_default(),
}
}
async fn register_event_bus(&mut self, register: &'static mut EventBusRegister) {
let Ok((stream, sender)) = RedisEventBus::connect(self.plugin_config.clone()).await else {
return
};
register.register(PLUGIN_NAME, EventBus::new(stream, sender));
} }
} }

View File

@ -4,9 +4,9 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
thiserror = { version = "1.0.40" }
async-trait = { version = "0.1.68" } async-trait = { version = "0.1.68" }
tracing = { version = "0.1.37" }
config = { path = "../config" } config = { path = "../config" }
futures = { version = "0.3.28", features = ["async-await", 'io-compat'] } futures = { version = "0.3.28", features = ["async-await", 'io-compat'] }
futures-util = { version = "0.3.28" } futures-util = { version = "0.3.28" }
thiserror = { version = "1.0.40" }
tracing = { version = "0.1.37" }

View File

@ -33,12 +33,16 @@ impl Display for Url {
} }
#[async_trait] #[async_trait]
pub trait FileStorage: Sized { pub trait FileStorage {
fn name() -> &'static str; fn name() -> &'static str
where
Self: Sized;
async fn new(config: &PluginConfig) -> SResult<Self>; async fn new(config: PluginConfig) -> SResult<Self>
where
Self: Sized;
async fn store(&mut self, file: impl futures::AsyncRead + Unpin + Send) -> SResult<Url>; async fn store(&mut self, file: Box<dyn futures::AsyncRead + Unpin + Send>) -> SResult<Url>;
async fn erase(&mut self, file_name: Url) -> SResult<usize>; async fn erase(&mut self, file_name: Url) -> SResult<usize>;
} }

View File

@ -3,11 +3,15 @@ name = "file-storage-local"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
[lib]
crate-type = ["cdylib"]
path = "src/lib.rs"
[dependencies] [dependencies]
file-storage-adapter = { path = "../file-storage-adapter" }
tokio = { version = "1.28.2", features = ['full'] }
futures = { version = "0.3.28" }
async-trait = { version = "0.1.68" } async-trait = { version = "0.1.68" }
file-storage-adapter = { path = "../file-storage-adapter" }
futures = { version = "0.3.28" }
serde = { version = "1.0.163", features = ['derive'] } serde = { version = "1.0.163", features = ['derive'] }
uuid = { version = "1.3.3", features = ['v4'] } tokio = { version = "1.28.2", features = ['full'] }
tracing = { version = "0.1" } tracing = { version = "0.1" }
uuid = { version = "1.3.3", features = ['v4'] }

View File

@ -25,7 +25,7 @@ impl FileStorage for FileStorageLocal {
"file-storage-local" "file-storage-local"
} }
async fn new(config: &PluginConfig) -> SResult<Self> { async fn new(config: PluginConfig) -> SResult<Self> {
Ok(Self { Ok(Self {
config: Arc::new(RwLock::new(config.config().map_err(|e| { config: Arc::new(RwLock::new(config.config().map_err(|e| {
error!("Invalid config for local file storage: {e}"); error!("Invalid config for local file storage: {e}");
@ -34,7 +34,7 @@ impl FileStorage for FileStorageLocal {
}) })
} }
async fn store(&mut self, mut input_stream: impl AsyncRead + Unpin + Send) -> SResult<Url> { async fn store(&mut self, mut input_stream: Box<dyn AsyncRead + Unpin + Send>) -> SResult<Url> {
let (root, base_url) = { let (root, base_url) = {
let config = self.config.read().unwrap(); let config = self.config.read().unwrap();
let root = config.root.clone(); let root = config.root.clone();

View File

@ -0,0 +1,16 @@
[package]
name = "file-storage-s3"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib"]
path = "src/lib.rs"
[dependencies]
file-storage-adapter = { workspace = true }
futures = { version = "0.3.28" }
rust-s3 = { version = "0.33.0", features = [] }
serde = { version = "1.0.163", features = ['derive'] }
tokio = { version = "1.28.2" }
tracing = { version = "0.1.37" }

View File

@ -1,6 +0,0 @@
[package]
name = "file-storage-s3"
version = "0.1.0"
edition = "2021"
[dependencies]

View File

@ -4,6 +4,6 @@ version = "0.1.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
tracing = { version = "0" }
thiserror = { version = "1.0.40" }
async-trait = { version = "0.1.68" } async-trait = { version = "0.1.68" }
thiserror = { version = "1.0.40" }
tracing = { version = "0" }

View File

@ -28,6 +28,6 @@ serde = { version = "1" }
sqlx = { version = "0", features = ["migrate", "runtime-actix-rustls", "all-types", "postgres"], optional = true } sqlx = { version = "0", features = ["migrate", "runtime-actix-rustls", "all-types", "postgres"], optional = true }
sqlx-core = { version = "0", features = [], optional = true } sqlx-core = { version = "0", features = [], optional = true }
thiserror = { version = "1" } thiserror = { version = "1" }
tracing = { version = "0.1.37" }
uuid = { version = "1", features = ["serde"] } uuid = { version = "1", features = ["serde"] }
validator = { version = "0" } validator = { version = "0" }
tracing = { version = "0.1.37" }

View File

@ -4,6 +4,7 @@ pub mod api;
pub mod encrypt; pub mod encrypt;
pub mod v3; pub mod v3;
pub mod v4;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use std::ops; use std::ops;

View File

@ -0,0 +1,140 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"addresses"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub customer_id: Option<String>,
pub company: Option<String>,
pub first_name: Option<String>,
pub last_name: Option<String>,
pub address_1: Option<String>,
pub address_2: Option<String>,
pub city: Option<String>,
pub country_code: Option<String>,
pub province: Option<String>,
pub postal_code: Option<String>,
pub phone: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
CustomerId,
Company,
FirstName,
LastName,
Address1,
Address2,
City,
CountryCode,
Province,
PostalCode,
Phone,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
ClaimOrders,
Countries,
Customers,
Swaps,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::CustomerId => ColumnType::String(None).def().null(),
Self::Company => ColumnType::String(None).def().null(),
Self::FirstName => ColumnType::String(None).def().null(),
Self::LastName => ColumnType::String(None).def().null(),
Self::Address1 => ColumnType::String(None).def().null(),
Self::Address2 => ColumnType::String(None).def().null(),
Self::City => ColumnType::String(None).def().null(),
Self::CountryCode => ColumnType::String(None).def().null(),
Self::Province => ColumnType::String(None).def().null(),
Self::PostalCode => ColumnType::String(None).def().null(),
Self::Phone => ColumnType::String(None).def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::ClaimOrders => Entity::has_many(super::claim_orders::Entity).into(),
Self::Countries => Entity::belongs_to(super::countries::Entity)
.from(Column::CountryCode)
.to(super::countries::Column::Iso2)
.into(),
Self::Customers => Entity::belongs_to(super::customers::Entity)
.from(Column::CustomerId)
.to(super::customers::Column::Id)
.into(),
Self::Swaps => Entity::has_many(super::swaps::Entity).into(),
}
}
}
impl Related<super::claim_orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimOrders.def()
}
}
impl Related<super::countries::Entity> for Entity {
fn to() -> RelationDef {
Relation::Countries.def()
}
}
impl Related<super::customers::Entity> for Entity {
fn to() -> RelationDef {
Relation::Customers.def()
}
}
impl Related<super::swaps::Entity> for Entity {
fn to() -> RelationDef {
Relation::Swaps.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,73 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"analytics_configs"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub user_id: String,
pub opt_out: bool,
pub anonymize: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
CreatedAt,
UpdatedAt,
DeletedAt,
UserId,
OptOut,
Anonymize,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::UserId => ColumnType::String(None).def(),
Self::OptOut => ColumnType::Boolean.def(),
Self::Anonymize => ColumnType::Boolean.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,110 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"batch_jobs"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub r#type: String,
pub created_by: Option<String>,
pub context: Option<Json>,
pub result: Option<Json>,
pub dry_run: bool,
pub created_at: DateTimeWithTimeZone,
pub pre_processed_at: Option<DateTimeWithTimeZone>,
pub confirmed_at: Option<DateTimeWithTimeZone>,
pub processing_at: Option<DateTimeWithTimeZone>,
pub completed_at: Option<DateTimeWithTimeZone>,
pub failed_at: Option<DateTimeWithTimeZone>,
pub canceled_at: Option<DateTimeWithTimeZone>,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Type,
CreatedBy,
Context,
Result,
DryRun,
CreatedAt,
PreProcessedAt,
ConfirmedAt,
ProcessingAt,
CompletedAt,
FailedAt,
CanceledAt,
UpdatedAt,
DeletedAt,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Users,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Type => ColumnType::Text.def(),
Self::CreatedBy => ColumnType::String(None).def().null(),
Self::Context => ColumnType::JsonBinary.def().null(),
Self::Result => ColumnType::JsonBinary.def().null(),
Self::DryRun => ColumnType::Boolean.def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::PreProcessedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::ConfirmedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::ProcessingAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CompletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::FailedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Users => Entity::belongs_to(super::users::Entity)
.from(Column::CreatedBy)
.to(super::users::Column::Id)
.into(),
}
}
}
impl Related<super::users::Entity> for Entity {
fn to() -> RelationDef {
Relation::Users.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

199
crates/model/src/v4/cart.rs Normal file
View File

@ -0,0 +1,199 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::CartTypes;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"cart"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub email: Option<String>,
pub billing_address_id: Option<String>,
pub shipping_address_id: Option<String>,
pub region_id: String,
pub customer_id: Option<String>,
pub payment_id: Option<String>,
pub r#type: CartTypes,
pub completed_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
pub idempotency_key: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Email,
BillingAddressId,
ShippingAddressId,
RegionId,
CustomerId,
PaymentId,
Type,
CompletedAt,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
IdempotencyKey,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Addresses2,
Addresses1,
Customers,
LineItems,
Order,
PaymentSessions,
Payments,
Regions,
ShippingMethods,
Swap,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Email => ColumnType::String(None).def().null(),
Self::BillingAddressId => ColumnType::String(None).def().null(),
Self::ShippingAddressId => ColumnType::String(None).def().null(),
Self::RegionId => ColumnType::String(None).def(),
Self::CustomerId => ColumnType::String(None).def().null(),
Self::PaymentId => ColumnType::String(None).def().null().unique(),
Self::Type => CartTypes::db_type().def(),
Self::CompletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Addresses2 => Entity::belongs_to(super::addresses::Entity)
.from(Column::BillingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::Addresses1 => Entity::belongs_to(super::addresses::Entity)
.from(Column::ShippingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::Customers => Entity::belongs_to(super::customers::Entity)
.from(Column::CustomerId)
.to(super::customers::Column::Id)
.into(),
Self::LineItems => Entity::has_many(super::line_items::Entity).into(),
Self::Order => Entity::has_one(super::order::Entity).into(),
Self::PaymentSessions => Entity::has_many(super::payment_sessions::Entity).into(),
Self::Payments => Entity::belongs_to(super::payments::Entity)
.from(Column::PaymentId)
.to(super::payments::Column::Id)
.into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
Self::ShippingMethods => Entity::has_many(super::shipping_methods::Entity).into(),
Self::Swap => Entity::has_one(super::swap::Entity).into(),
}
}
}
impl Related<super::customers::Entity> for Entity {
fn to() -> RelationDef {
Relation::Customers.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl Related<super::order::Entity> for Entity {
fn to() -> RelationDef {
Relation::Order.def()
}
}
impl Related<super::payment_sessions::Entity> for Entity {
fn to() -> RelationDef {
Relation::PaymentSessions.def()
}
}
impl Related<super::payments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Payments.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl Related<super::shipping_methods::Entity> for Entity {
fn to() -> RelationDef {
Relation::ShippingMethods.def()
}
}
impl Related<super::swap::Entity> for Entity {
fn to() -> RelationDef {
Relation::Swap.def()
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
super::cart_discounts::Relation::Discounts.def()
}
fn via() -> Option<RelationDef> {
Some(super::cart_discounts::Relation::Cart.def().rev())
}
}
impl Related<super::gift_cards::Entity> for Entity {
fn to() -> RelationDef {
super::cart_gift_cards::Relation::GiftCards.def()
}
fn via() -> Option<RelationDef> {
Some(super::cart_gift_cards::Relation::Cart.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"cart_discounts"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub cart_id: String,
pub discount_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
CartId,
DiscountId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
CartId,
DiscountId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Carts,
Discounts,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::CartId => ColumnType::String(None).def(),
Self::DiscountId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Carts => Entity::belongs_to(super::carts::Entity)
.from(Column::CartId)
.to(super::carts::Column::Id)
.into(),
Self::Discounts => Entity::belongs_to(super::discounts::Entity)
.from(Column::DiscountId)
.to(super::discounts::Column::Id)
.into(),
}
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Discounts.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"cart_gift_cards"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub cart_id: String,
pub gift_card_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
CartId,
GiftCardId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
CartId,
GiftCardId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Carts,
GiftCards,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::CartId => ColumnType::String(None).def(),
Self::GiftCardId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Carts => Entity::belongs_to(super::carts::Entity)
.from(Column::CartId)
.to(super::carts::Column::Id)
.into(),
Self::GiftCards => Entity::belongs_to(super::gift_cards::Entity)
.from(Column::GiftCardId)
.to(super::gift_cards::Column::Id)
.into(),
}
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::gift_cards::Entity> for Entity {
fn to() -> RelationDef {
Relation::GiftCards.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,237 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::CartTypes;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"carts"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub email: Option<String>,
pub billing_address_id: Option<String>,
pub shipping_address_id: Option<String>,
pub region_id: String,
pub customer_id: Option<String>,
pub payment_id: Option<String>,
pub r#type: CartTypes,
pub completed_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
pub idempotency_key: Option<String>,
pub context: Option<Json>,
pub payment_authorized_at: Option<DateTimeWithTimeZone>,
pub sales_channel_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Email,
BillingAddressId,
ShippingAddressId,
RegionId,
CustomerId,
PaymentId,
Type,
CompletedAt,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
IdempotencyKey,
Context,
PaymentAuthorizedAt,
SalesChannelId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Addresses2,
Addresses1,
CustomShippingOptions,
Customers,
DraftOrders,
LineItems,
Orders,
PaymentSessions,
Payments,
Regions,
SalesChannels,
ShippingMethods,
Swaps,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Email => ColumnType::String(None).def().null(),
Self::BillingAddressId => ColumnType::String(None).def().null(),
Self::ShippingAddressId => ColumnType::String(None).def().null(),
Self::RegionId => ColumnType::String(None).def(),
Self::CustomerId => ColumnType::String(None).def().null(),
Self::PaymentId => ColumnType::String(None).def().null().unique(),
Self::Type => CartTypes::db_type().def(),
Self::CompletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
Self::Context => ColumnType::JsonBinary.def().null(),
Self::PaymentAuthorizedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::SalesChannelId => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Addresses2 => Entity::belongs_to(super::addresses::Entity)
.from(Column::BillingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::Addresses1 => Entity::belongs_to(super::addresses::Entity)
.from(Column::ShippingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::CustomShippingOptions => {
Entity::has_many(super::custom_shipping_options::Entity).into()
}
Self::Customers => Entity::belongs_to(super::customers::Entity)
.from(Column::CustomerId)
.to(super::customers::Column::Id)
.into(),
Self::DraftOrders => Entity::has_one(super::draft_orders::Entity).into(),
Self::LineItems => Entity::has_many(super::line_items::Entity).into(),
Self::Orders => Entity::has_one(super::orders::Entity).into(),
Self::PaymentSessions => Entity::has_many(super::payment_sessions::Entity).into(),
Self::Payments => Entity::belongs_to(super::payments::Entity)
.from(Column::PaymentId)
.to(super::payments::Column::Id)
.into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
Self::SalesChannels => Entity::belongs_to(super::sales_channels::Entity)
.from(Column::SalesChannelId)
.to(super::sales_channels::Column::Id)
.into(),
Self::ShippingMethods => Entity::has_many(super::shipping_methods::Entity).into(),
Self::Swaps => Entity::has_one(super::swaps::Entity).into(),
}
}
}
impl Related<super::custom_shipping_options::Entity> for Entity {
fn to() -> RelationDef {
Relation::CustomShippingOptions.def()
}
}
impl Related<super::customers::Entity> for Entity {
fn to() -> RelationDef {
Relation::Customers.def()
}
}
impl Related<super::draft_orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::DraftOrders.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::payment_sessions::Entity> for Entity {
fn to() -> RelationDef {
Relation::PaymentSessions.def()
}
}
impl Related<super::payments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Payments.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl Related<super::sales_channels::Entity> for Entity {
fn to() -> RelationDef {
Relation::SalesChannels.def()
}
}
impl Related<super::shipping_methods::Entity> for Entity {
fn to() -> RelationDef {
Relation::ShippingMethods.def()
}
}
impl Related<super::swaps::Entity> for Entity {
fn to() -> RelationDef {
Relation::Swaps.def()
}
}
impl Related<super::gift_cards::Entity> for Entity {
fn to() -> RelationDef {
super::cart_gift_cards::Relation::GiftCards.def()
}
fn via() -> Option<RelationDef> {
Some(super::cart_gift_cards::Relation::Carts.def().rev())
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
super::cart_discounts::Relation::Discounts.def()
}
fn via() -> Option<RelationDef> {
Some(super::cart_discounts::Relation::Carts.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,86 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"claim_images"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub claim_item_id: String,
pub url: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
ClaimItemId,
Url,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
ClaimItems,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::ClaimItemId => ColumnType::String(None).def(),
Self::Url => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::ClaimItems => Entity::belongs_to(super::claim_items::Entity)
.from(Column::ClaimItemId)
.to(super::claim_items::Column::Id)
.into(),
}
}
}
impl Related<super::claim_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimItems.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"claim_item_tags"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub item_id: String,
pub tag_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
ItemId,
TagId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
ItemId,
TagId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
ClaimItems,
ClaimTags,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::ItemId => ColumnType::String(None).def(),
Self::TagId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::ClaimItems => Entity::belongs_to(super::claim_items::Entity)
.from(Column::ItemId)
.to(super::claim_items::Column::Id)
.into(),
Self::ClaimTags => Entity::belongs_to(super::claim_tags::Entity)
.from(Column::TagId)
.to(super::claim_tags::Column::Id)
.into(),
}
}
}
impl Related<super::claim_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimItems.def()
}
}
impl Related<super::claim_tags::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimTags.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,139 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::ClaimItemReasons;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"claim_items"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub claim_order_id: String,
pub item_id: String,
pub variant_id: String,
pub reason: ClaimItemReasons,
pub note: Option<String>,
pub quantity: i32,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
ClaimOrderId,
ItemId,
VariantId,
Reason,
Note,
Quantity,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
ClaimImages,
ClaimOrders,
LineItems,
ProductVariants,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::ClaimOrderId => ColumnType::String(None).def(),
Self::ItemId => ColumnType::String(None).def(),
Self::VariantId => ColumnType::String(None).def(),
Self::Reason => ClaimItemReasons::db_type().def(),
Self::Note => ColumnType::String(None).def().null(),
Self::Quantity => ColumnType::Integer.def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::ClaimImages => Entity::has_many(super::claim_images::Entity).into(),
Self::ClaimOrders => Entity::belongs_to(super::claim_orders::Entity)
.from(Column::ClaimOrderId)
.to(super::claim_orders::Column::Id)
.into(),
Self::LineItems => Entity::belongs_to(super::line_items::Entity)
.from(Column::ItemId)
.to(super::line_items::Column::Id)
.into(),
Self::ProductVariants => Entity::belongs_to(super::product_variants::Entity)
.from(Column::VariantId)
.to(super::product_variants::Column::Id)
.into(),
}
}
}
impl Related<super::claim_images::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimImages.def()
}
}
impl Related<super::claim_orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimOrders.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl Related<super::product_variants::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductVariants.def()
}
}
impl Related<super::claim_tags::Entity> for Entity {
fn to() -> RelationDef {
super::claim_item_tags::Relation::ClaimTags.def()
}
fn via() -> Option<RelationDef> {
Some(super::claim_item_tags::Relation::ClaimItems.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,162 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::{
ClaimOrderFulfillmentStatuses, ClaimOrderPaymentStatuses, ClaimOrderTypes,
};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"claim_orders"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub payment_status: ClaimOrderPaymentStatuses,
pub fulfillment_status: ClaimOrderFulfillmentStatuses,
pub r#type: ClaimOrderTypes,
pub order_id: String,
pub shipping_address_id: Option<String>,
pub refund_amount: Option<i32>,
pub canceled_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
pub idempotency_key: Option<String>,
pub no_notification: Option<bool>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
PaymentStatus,
FulfillmentStatus,
Type,
OrderId,
ShippingAddressId,
RefundAmount,
CanceledAt,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
IdempotencyKey,
NoNotification,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Addresses,
ClaimItems,
Fulfillments,
LineItems,
Orders,
Returns,
ShippingMethods,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::PaymentStatus => ClaimOrderPaymentStatuses::db_type().def(),
Self::FulfillmentStatus => ClaimOrderFulfillmentStatuses::db_type().def(),
Self::Type => ClaimOrderTypes::db_type().def(),
Self::OrderId => ColumnType::String(None).def(),
Self::ShippingAddressId => ColumnType::String(None).def().null(),
Self::RefundAmount => ColumnType::Integer.def().null(),
Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
Self::NoNotification => ColumnType::Boolean.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Addresses => Entity::belongs_to(super::addresses::Entity)
.from(Column::ShippingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::ClaimItems => Entity::has_many(super::claim_items::Entity).into(),
Self::Fulfillments => Entity::has_many(super::fulfillments::Entity).into(),
Self::LineItems => Entity::has_many(super::line_items::Entity).into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
Self::Returns => Entity::has_one(super::returns::Entity).into(),
Self::ShippingMethods => Entity::has_many(super::shipping_methods::Entity).into(),
}
}
}
impl Related<super::addresses::Entity> for Entity {
fn to() -> RelationDef {
Relation::Addresses.def()
}
}
impl Related<super::claim_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimItems.def()
}
}
impl Related<super::fulfillments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Fulfillments.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::returns::Entity> for Entity {
fn to() -> RelationDef {
Relation::Returns.def()
}
}
impl Related<super::shipping_methods::Entity> for Entity {
fn to() -> RelationDef {
Relation::ShippingMethods.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,79 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"claim_tags"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub value: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Value,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Value => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl Related<super::claim_items::Entity> for Entity {
fn to() -> RelationDef {
super::claim_item_tags::Relation::ClaimItems.def()
}
fn via() -> Option<RelationDef> {
Some(super::claim_item_tags::Relation::ClaimTags.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,94 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"countries"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: i32,
pub iso_2: String,
pub iso_3: String,
pub num_code: i32,
pub name: String,
pub display_name: String,
pub region_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Iso2,
Iso3,
NumCode,
Name,
DisplayName,
RegionId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = i32;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Addresses,
Regions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Iso2 => ColumnType::String(None).def(),
Self::Iso3 => ColumnType::String(None).def(),
Self::NumCode => ColumnType::Integer.def(),
Self::Name => ColumnType::String(None).def(),
Self::DisplayName => ColumnType::String(None).def(),
Self::RegionId => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Addresses => Entity::has_many(super::addresses::Entity).into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
}
}
}
impl Related<super::addresses::Entity> for Entity {
fn to() -> RelationDef {
Relation::Addresses.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,109 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"currencies"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub code: String,
pub symbol: String,
pub symbol_native: String,
pub name: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Code,
Symbol,
SymbolNative,
Name,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Code,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
MoneyAmounts,
Orders,
Payments,
Regions,
Stores,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Code => ColumnType::String(None).def(),
Self::Symbol => ColumnType::String(None).def(),
Self::SymbolNative => ColumnType::String(None).def(),
Self::Name => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::MoneyAmounts => Entity::has_many(super::money_amounts::Entity).into(),
Self::Orders => Entity::has_many(super::orders::Entity).into(),
Self::Payments => Entity::has_many(super::payments::Entity).into(),
Self::Regions => Entity::has_many(super::regions::Entity).into(),
Self::Stores => Entity::has_many(super::stores::Entity).into(),
}
}
}
impl Related<super::money_amounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::MoneyAmounts.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::payments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Payments.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl Related<super::stores::Entity> for Entity {
fn to() -> RelationDef {
super::store_currencies::Relation::Stores.def()
}
fn via() -> Option<RelationDef> {
Some(super::store_currencies::Relation::Currencies.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,100 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"custom_shipping_options"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub price: i32,
pub shipping_option_id: String,
pub cart_id: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Price,
ShippingOptionId,
CartId,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Carts,
ShippingOptions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Price => ColumnType::Integer.def(),
Self::ShippingOptionId => ColumnType::String(None).def(),
Self::CartId => ColumnType::String(None).def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Carts => Entity::belongs_to(super::carts::Entity)
.from(Column::CartId)
.to(super::carts::Column::Id)
.into(),
Self::ShippingOptions => Entity::belongs_to(super::shipping_options::Entity)
.from(Column::ShippingOptionId)
.to(super::shipping_options::Column::Id)
.into(),
}
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::shipping_options::Entity> for Entity {
fn to() -> RelationDef {
Relation::ShippingOptions.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"customer_group_customers"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub customer_group_id: String,
pub customer_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
CustomerGroupId,
CustomerId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
CustomerGroupId,
CustomerId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
CustomerGroups,
Customers,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::CustomerGroupId => ColumnType::String(None).def(),
Self::CustomerId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::CustomerGroups => Entity::belongs_to(super::customer_groups::Entity)
.from(Column::CustomerGroupId)
.to(super::customer_groups::Column::Id)
.into(),
Self::Customers => Entity::belongs_to(super::customers::Entity)
.from(Column::CustomerId)
.to(super::customers::Column::Id)
.into(),
}
}
}
impl Related<super::customer_groups::Entity> for Entity {
fn to() -> RelationDef {
Relation::CustomerGroups.def()
}
}
impl Related<super::customers::Entity> for Entity {
fn to() -> RelationDef {
Relation::Customers.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,109 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"customer_groups"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub name: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Name,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Name => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl Related<super::customers::Entity> for Entity {
fn to() -> RelationDef {
super::customer_group_customers::Relation::Customers.def()
}
fn via() -> Option<RelationDef> {
Some(
super::customer_group_customers::Relation::CustomerGroups
.def()
.rev(),
)
}
}
impl Related<super::discount_conditions::Entity> for Entity {
fn to() -> RelationDef {
super::discount_condition_customer_groups::Relation::DiscountConditions.def()
}
fn via() -> Option<RelationDef> {
Some(
super::discount_condition_customer_groups::Relation::CustomerGroups
.def()
.rev(),
)
}
}
impl Related<super::price_lists::Entity> for Entity {
fn to() -> RelationDef {
super::price_list_customer_groups::Relation::PriceLists.def()
}
fn via() -> Option<RelationDef> {
Some(
super::price_list_customer_groups::Relation::CustomerGroups
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,138 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"customers"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub email: String,
pub first_name: Option<String>,
pub last_name: Option<String>,
pub billing_address_id: Option<String>,
pub password_hash: Option<String>,
pub phone: Option<String>,
pub has_account: bool,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Email,
FirstName,
LastName,
BillingAddressId,
PasswordHash,
Phone,
HasAccount,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Addresses,
Carts,
Notifications,
Orders,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Email => ColumnType::String(None).def(),
Self::FirstName => ColumnType::String(None).def().null(),
Self::LastName => ColumnType::String(None).def().null(),
Self::BillingAddressId => ColumnType::String(None).def().null().unique(),
Self::PasswordHash => ColumnType::String(None).def().null(),
Self::Phone => ColumnType::String(None).def().null(),
Self::HasAccount => ColumnType::Boolean.def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Addresses => Entity::belongs_to(super::addresses::Entity)
.from(Column::BillingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::Carts => Entity::has_many(super::carts::Entity).into(),
Self::Notifications => Entity::has_many(super::notifications::Entity).into(),
Self::Orders => Entity::has_many(super::orders::Entity).into(),
}
}
}
impl Related<super::addresses::Entity> for Entity {
fn to() -> RelationDef {
Relation::Addresses.def()
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::notifications::Entity> for Entity {
fn to() -> RelationDef {
Relation::Notifications.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::customer_groups::Entity> for Entity {
fn to() -> RelationDef {
super::customer_group_customers::Relation::CustomerGroups.def()
}
fn via() -> Option<RelationDef> {
Some(
super::customer_group_customers::Relation::Customers
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,92 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_condition_customer_groups"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub customer_group_id: String,
pub condition_id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
CustomerGroupId,
ConditionId,
CreatedAt,
UpdatedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
CustomerGroupId,
ConditionId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
CustomerGroups,
DiscountConditions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::CustomerGroupId => ColumnType::String(None).def(),
Self::ConditionId => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::CustomerGroups => Entity::belongs_to(super::customer_groups::Entity)
.from(Column::CustomerGroupId)
.to(super::customer_groups::Column::Id)
.into(),
Self::DiscountConditions => Entity::belongs_to(super::discount_conditions::Entity)
.from(Column::ConditionId)
.to(super::discount_conditions::Column::Id)
.into(),
}
}
}
impl Related<super::customer_groups::Entity> for Entity {
fn to() -> RelationDef {
Relation::CustomerGroups.def()
}
}
impl Related<super::discount_conditions::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountConditions.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,92 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_condition_product_collections"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub product_collection_id: String,
pub condition_id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
ProductCollectionId,
ConditionId,
CreatedAt,
UpdatedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
ProductCollectionId,
ConditionId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
DiscountConditions,
ProductCollections,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::ProductCollectionId => ColumnType::String(None).def(),
Self::ConditionId => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DiscountConditions => Entity::belongs_to(super::discount_conditions::Entity)
.from(Column::ConditionId)
.to(super::discount_conditions::Column::Id)
.into(),
Self::ProductCollections => Entity::belongs_to(super::product_collections::Entity)
.from(Column::ProductCollectionId)
.to(super::product_collections::Column::Id)
.into(),
}
}
}
impl Related<super::discount_conditions::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountConditions.def()
}
}
impl Related<super::product_collections::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductCollections.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,92 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_condition_product_tags"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub product_tag_id: String,
pub condition_id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
ProductTagId,
ConditionId,
CreatedAt,
UpdatedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
ProductTagId,
ConditionId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
DiscountConditions,
ProductTags,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::ProductTagId => ColumnType::String(None).def(),
Self::ConditionId => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DiscountConditions => Entity::belongs_to(super::discount_conditions::Entity)
.from(Column::ConditionId)
.to(super::discount_conditions::Column::Id)
.into(),
Self::ProductTags => Entity::belongs_to(super::product_tags::Entity)
.from(Column::ProductTagId)
.to(super::product_tags::Column::Id)
.into(),
}
}
}
impl Related<super::discount_conditions::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountConditions.def()
}
}
impl Related<super::product_tags::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductTags.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,92 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_condition_product_types"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub product_type_id: String,
pub condition_id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
ProductTypeId,
ConditionId,
CreatedAt,
UpdatedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
ProductTypeId,
ConditionId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
DiscountConditions,
ProductTypes,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::ProductTypeId => ColumnType::String(None).def(),
Self::ConditionId => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DiscountConditions => Entity::belongs_to(super::discount_conditions::Entity)
.from(Column::ConditionId)
.to(super::discount_conditions::Column::Id)
.into(),
Self::ProductTypes => Entity::belongs_to(super::product_types::Entity)
.from(Column::ProductTypeId)
.to(super::product_types::Column::Id)
.into(),
}
}
}
impl Related<super::discount_conditions::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountConditions.def()
}
}
impl Related<super::product_types::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductTypes.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,92 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_condition_products"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub product_id: String,
pub condition_id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
ProductId,
ConditionId,
CreatedAt,
UpdatedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
ProductId,
ConditionId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
DiscountConditions,
Products,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::ProductId => ColumnType::String(None).def(),
Self::ConditionId => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DiscountConditions => Entity::belongs_to(super::discount_conditions::Entity)
.from(Column::ConditionId)
.to(super::discount_conditions::Column::Id)
.into(),
Self::Products => Entity::belongs_to(super::products::Entity)
.from(Column::ProductId)
.to(super::products::Column::Id)
.into(),
}
}
}
impl Related<super::discount_conditions::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountConditions.def()
}
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
Relation::Products.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,156 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::{DiscountConditionOperators, DiscountConditionTypes};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_conditions"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub r#type: DiscountConditionTypes,
pub operator: DiscountConditionOperators,
pub discount_rule_id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Type,
Operator,
DiscountRuleId,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
DiscountRules,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Type => DiscountConditionTypes::db_type().def(),
Self::Operator => DiscountConditionOperators::db_type().def(),
Self::DiscountRuleId => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DiscountRules => Entity::belongs_to(super::discount_rules::Entity)
.from(Column::DiscountRuleId)
.to(super::discount_rules::Column::Id)
.into(),
}
}
}
impl Related<super::discount_rules::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountRules.def()
}
}
impl Related<super::product_tags::Entity> for Entity {
fn to() -> RelationDef {
super::discount_condition_product_tags::Relation::ProductTags.def()
}
fn via() -> Option<RelationDef> {
Some(
super::discount_condition_product_tags::Relation::DiscountConditions
.def()
.rev(),
)
}
}
impl Related<super::customer_groups::Entity> for Entity {
fn to() -> RelationDef {
super::discount_condition_customer_groups::Relation::CustomerGroups.def()
}
fn via() -> Option<RelationDef> {
Some(
super::discount_condition_customer_groups::Relation::DiscountConditions
.def()
.rev(),
)
}
}
impl Related<super::product_types::Entity> for Entity {
fn to() -> RelationDef {
super::discount_condition_product_types::Relation::ProductTypes.def()
}
fn via() -> Option<RelationDef> {
Some(
super::discount_condition_product_types::Relation::DiscountConditions
.def()
.rev(),
)
}
}
impl Related<super::product_collections::Entity> for Entity {
fn to() -> RelationDef {
super::discount_condition_product_collections::Relation::ProductCollections.def()
}
fn via() -> Option<RelationDef> {
Some(
super::discount_condition_product_collections::Relation::DiscountConditions
.def()
.rev(),
)
}
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
super::discount_condition_products::Relation::Products.def()
}
fn via() -> Option<RelationDef> {
Some(
super::discount_condition_products::Relation::DiscountConditions
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_regions"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub discount_id: String,
pub region_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
DiscountId,
RegionId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
DiscountId,
RegionId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Discounts,
Regions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::DiscountId => ColumnType::String(None).def(),
Self::RegionId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Discounts => Entity::belongs_to(super::discounts::Entity)
.from(Column::DiscountId)
.to(super::discounts::Column::Id)
.into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
}
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Discounts.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_rule_products"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub discount_rule_id: String,
pub product_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
DiscountRuleId,
ProductId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
DiscountRuleId,
ProductId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
DiscountRules,
Products,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::DiscountRuleId => ColumnType::String(None).def(),
Self::ProductId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DiscountRules => Entity::belongs_to(super::discount_rules::Entity)
.from(Column::DiscountRuleId)
.to(super::discount_rules::Column::Id)
.into(),
Self::Products => Entity::belongs_to(super::products::Entity)
.from(Column::ProductId)
.to(super::products::Column::Id)
.into(),
}
}
}
impl Related<super::discount_rules::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountRules.def()
}
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
Relation::Products.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,112 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::{DiscountRuleAllocations, DiscountRuleTypes};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discount_rules"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub description: Option<String>,
pub r#type: DiscountRuleTypes,
pub value: i32,
pub allocation: Option<DiscountRuleAllocations>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Description,
Type,
Value,
Allocation,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
DiscountConditions,
Discounts,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Description => ColumnType::String(None).def().null(),
Self::Type => DiscountRuleTypes::db_type().def(),
Self::Value => ColumnType::Integer.def(),
Self::Allocation => DiscountRuleAllocations::db_type().def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DiscountConditions => Entity::has_many(super::discount_conditions::Entity).into(),
Self::Discounts => Entity::has_many(super::discounts::Entity).into(),
}
}
}
impl Related<super::discount_conditions::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountConditions.def()
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Discounts.def()
}
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
super::discount_rule_products::Relation::Products.def()
}
fn via() -> Option<RelationDef> {
Some(
super::discount_rule_products::Relation::DiscountRules
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,152 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"discounts"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub code: String,
pub is_dynamic: bool,
pub rule_id: Option<String>,
pub is_disabled: bool,
pub parent_discount_id: Option<String>,
pub starts_at: DateTimeWithTimeZone,
pub ends_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
pub usage_limit: Option<i32>,
pub usage_count: i32,
pub valid_duration: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Code,
IsDynamic,
RuleId,
IsDisabled,
ParentDiscountId,
StartsAt,
EndsAt,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
UsageLimit,
UsageCount,
ValidDuration,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
DiscountRules,
SelfRef,
LineItemAdjustments,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Code => ColumnType::String(None).def(),
Self::IsDynamic => ColumnType::Boolean.def(),
Self::RuleId => ColumnType::String(None).def().null(),
Self::IsDisabled => ColumnType::Boolean.def(),
Self::ParentDiscountId => ColumnType::String(None).def().null(),
Self::StartsAt => ColumnType::TimestampWithTimeZone.def(),
Self::EndsAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::UsageLimit => ColumnType::Integer.def().null(),
Self::UsageCount => ColumnType::Integer.def(),
Self::ValidDuration => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::DiscountRules => Entity::belongs_to(super::discount_rules::Entity)
.from(Column::RuleId)
.to(super::discount_rules::Column::Id)
.into(),
Self::SelfRef => Entity::belongs_to(Entity)
.from(Column::ParentDiscountId)
.to(Column::Id)
.into(),
Self::LineItemAdjustments => {
Entity::has_many(super::line_item_adjustments::Entity).into()
}
}
}
}
impl Related<super::discount_rules::Entity> for Entity {
fn to() -> RelationDef {
Relation::DiscountRules.def()
}
}
impl Related<super::line_item_adjustments::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItemAdjustments.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
super::order_discounts::Relation::Orders.def()
}
fn via() -> Option<RelationDef> {
Some(super::order_discounts::Relation::Discounts.def().rev())
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
super::cart_discounts::Relation::Carts.def()
}
fn via() -> Option<RelationDef> {
Some(super::cart_discounts::Relation::Discounts.def().rev())
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
super::discount_regions::Relation::Regions.def()
}
fn via() -> Option<RelationDef> {
Some(super::discount_regions::Relation::Discounts.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,114 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::DraftOrderStatuses;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"draft_orders"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub status: DraftOrderStatuses,
pub display_id: i32,
pub cart_id: Option<String>,
pub order_id: Option<String>,
pub canceled_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub completed_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
pub idempotency_key: Option<String>,
pub no_notification_order: Option<bool>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Status,
DisplayId,
CartId,
OrderId,
CanceledAt,
CreatedAt,
UpdatedAt,
CompletedAt,
Metadata,
IdempotencyKey,
NoNotificationOrder,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Carts,
Orders,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Status => DraftOrderStatuses::db_type().def(),
Self::DisplayId => ColumnType::Integer.def(),
Self::CartId => ColumnType::String(None).def().null().unique(),
Self::OrderId => ColumnType::String(None).def().null().unique(),
Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::CompletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
Self::NoNotificationOrder => ColumnType::Boolean.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Carts => Entity::belongs_to(super::carts::Entity)
.from(Column::CartId)
.to(super::carts::Column::Id)
.into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
}
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,86 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"fulfillment_items"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub fulfillment_id: String,
pub item_id: String,
pub quantity: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
FulfillmentId,
ItemId,
Quantity,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
FulfillmentId,
ItemId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Fulfillments,
LineItems,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::FulfillmentId => ColumnType::String(None).def(),
Self::ItemId => ColumnType::String(None).def(),
Self::Quantity => ColumnType::Integer.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Fulfillments => Entity::belongs_to(super::fulfillments::Entity)
.from(Column::FulfillmentId)
.to(super::fulfillments::Column::Id)
.into(),
Self::LineItems => Entity::belongs_to(super::line_items::Entity)
.from(Column::ItemId)
.to(super::line_items::Column::Id)
.into(),
}
}
}
impl Related<super::fulfillments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Fulfillments.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,89 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"fulfillment_providers"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub is_installed: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
IsInstalled,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Fulfillments,
ShippingOptions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::IsInstalled => ColumnType::Boolean.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Fulfillments => Entity::has_many(super::fulfillments::Entity).into(),
Self::ShippingOptions => Entity::has_many(super::shipping_options::Entity).into(),
}
}
}
impl Related<super::fulfillments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Fulfillments.def()
}
}
impl Related<super::shipping_options::Entity> for Entity {
fn to() -> RelationDef {
Relation::ShippingOptions.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
super::region_fulfillment_providers::Relation::Regions.def()
}
fn via() -> Option<RelationDef> {
Some(
super::region_fulfillment_providers::Relation::FulfillmentProviders
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,160 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"fulfillments"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub swap_id: Option<String>,
pub order_id: Option<String>,
pub tracking_numbers: Json,
pub data: Json,
pub shipped_at: Option<DateTimeWithTimeZone>,
pub canceled_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
pub idempotency_key: Option<String>,
pub provider_id: Option<String>,
pub claim_order_id: Option<String>,
pub no_notification: Option<bool>,
pub location_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
SwapId,
OrderId,
TrackingNumbers,
Data,
ShippedAt,
CanceledAt,
CreatedAt,
UpdatedAt,
Metadata,
IdempotencyKey,
ProviderId,
ClaimOrderId,
NoNotification,
LocationId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
ClaimOrders,
FulfillmentProviders,
Orders,
Swaps,
TrackingLinks,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::SwapId => ColumnType::String(None).def().null(),
Self::OrderId => ColumnType::String(None).def().null(),
Self::TrackingNumbers => ColumnType::JsonBinary.def(),
Self::Data => ColumnType::JsonBinary.def(),
Self::ShippedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
Self::ProviderId => ColumnType::String(None).def().null(),
Self::ClaimOrderId => ColumnType::String(None).def().null(),
Self::NoNotification => ColumnType::Boolean.def().null(),
Self::LocationId => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::ClaimOrders => Entity::belongs_to(super::claim_orders::Entity)
.from(Column::ClaimOrderId)
.to(super::claim_orders::Column::Id)
.into(),
Self::FulfillmentProviders => Entity::belongs_to(super::fulfillment_providers::Entity)
.from(Column::ProviderId)
.to(super::fulfillment_providers::Column::Id)
.into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
Self::Swaps => Entity::belongs_to(super::swaps::Entity)
.from(Column::SwapId)
.to(super::swaps::Column::Id)
.into(),
Self::TrackingLinks => Entity::has_many(super::tracking_links::Entity).into(),
}
}
}
impl Related<super::claim_orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimOrders.def()
}
}
impl Related<super::fulfillment_providers::Entity> for Entity {
fn to() -> RelationDef {
Relation::FulfillmentProviders.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::swaps::Entity> for Entity {
fn to() -> RelationDef {
Relation::Swaps.def()
}
}
impl Related<super::tracking_links::Entity> for Entity {
fn to() -> RelationDef {
Relation::TrackingLinks.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
super::fulfillment_items::Relation::LineItems.def()
}
fn via() -> Option<RelationDef> {
Some(super::fulfillment_items::Relation::Fulfillments.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,97 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"gift_card_transactions"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub gift_card_id: String,
pub order_id: String,
pub amount: i32,
pub created_at: DateTimeWithTimeZone,
pub is_taxable: Option<bool>,
pub tax_rate: Option<f32>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
GiftCardId,
OrderId,
Amount,
CreatedAt,
IsTaxable,
TaxRate,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
GiftCards,
Orders,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::GiftCardId => ColumnType::String(None).def(),
Self::OrderId => ColumnType::String(None).def(),
Self::Amount => ColumnType::Integer.def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::IsTaxable => ColumnType::Boolean.def().null(),
Self::TaxRate => ColumnType::Float.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::GiftCards => Entity::belongs_to(super::gift_cards::Entity)
.from(Column::GiftCardId)
.to(super::gift_cards::Column::Id)
.into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
}
}
}
impl Related<super::gift_cards::Entity> for Entity {
fn to() -> RelationDef {
Relation::GiftCards.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,137 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"gift_cards"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub code: String,
pub value: i32,
pub balance: i32,
pub region_id: String,
pub order_id: Option<String>,
pub is_disabled: bool,
pub ends_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
pub tax_rate: Option<f32>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Code,
Value,
Balance,
RegionId,
OrderId,
IsDisabled,
EndsAt,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
TaxRate,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
GiftCardTransactions,
Orders,
Regions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Code => ColumnType::String(None).def(),
Self::Value => ColumnType::Integer.def(),
Self::Balance => ColumnType::Integer.def(),
Self::RegionId => ColumnType::String(None).def(),
Self::OrderId => ColumnType::String(None).def().null(),
Self::IsDisabled => ColumnType::Boolean.def(),
Self::EndsAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::TaxRate => ColumnType::Float.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::GiftCardTransactions => {
Entity::has_many(super::gift_card_transactions::Entity).into()
}
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
}
}
}
impl Related<super::gift_card_transactions::Entity> for Entity {
fn to() -> RelationDef {
Relation::GiftCardTransactions.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
super::cart_gift_cards::Relation::Carts.def()
}
fn via() -> Option<RelationDef> {
Some(super::cart_gift_cards::Relation::GiftCards.def().rev())
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
super::order_gift_cards::Relation::Orders.def()
}
fn via() -> Option<RelationDef> {
Some(super::order_gift_cards::Relation::GiftCards.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,82 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"idempotency_keys"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub idempotency_key: String,
pub created_at: DateTimeWithTimeZone,
pub locked_at: Option<DateTimeWithTimeZone>,
pub request_method: Option<String>,
pub request_params: Option<Json>,
pub request_path: Option<String>,
pub response_code: Option<i32>,
pub response_body: Option<Json>,
pub recovery_point: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
IdempotencyKey,
CreatedAt,
LockedAt,
RequestMethod,
RequestParams,
RequestPath,
ResponseCode,
ResponseBody,
RecoveryPoint,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::IdempotencyKey => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::LockedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::RequestMethod => ColumnType::String(None).def().null(),
Self::RequestParams => ColumnType::JsonBinary.def().null(),
Self::RequestPath => ColumnType::String(None).def().null(),
Self::ResponseCode => ColumnType::Integer.def().null(),
Self::ResponseBody => ColumnType::JsonBinary.def().null(),
Self::RecoveryPoint => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,79 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"images"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub url: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Url,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Url => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl Related<super::products::Entity> for Entity {
fn to() -> RelationDef {
super::product_images::Relation::Products.def()
}
fn via() -> Option<RelationDef> {
Some(super::product_images::Relation::Images.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,84 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::InviteRoles;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"invites"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub user_email: String,
pub role: Option<InviteRoles>,
pub accepted: bool,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
pub token: String,
pub expires_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
UserEmail,
Role,
Accepted,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
Token,
ExpiresAt,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::UserEmail => ColumnType::String(None).def(),
Self::Role => InviteRoles::db_type().def().null(),
Self::Accepted => ColumnType::Boolean.def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::Token => ColumnType::String(None).def(),
Self::ExpiresAt => ColumnType::TimestampWithTimeZone.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,94 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"line_item_adjustments"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub item_id: String,
pub description: String,
pub discount_id: Option<String>,
pub amount: Decimal,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
ItemId,
Description,
DiscountId,
Amount,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Discounts,
LineItems,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::ItemId => ColumnType::String(None).def(),
Self::Description => ColumnType::String(None).def(),
Self::DiscountId => ColumnType::String(None).def().null(),
Self::Amount => ColumnType::Decimal(None).def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Discounts => Entity::belongs_to(super::discounts::Entity)
.from(Column::DiscountId)
.to(super::discounts::Column::Id)
.into(),
Self::LineItems => Entity::belongs_to(super::line_items::Entity)
.from(Column::ItemId)
.to(super::line_items::Column::Id)
.into(),
}
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Discounts.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,89 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"line_item_tax_lines"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub rate: f32,
pub name: String,
pub code: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
pub item_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Rate,
Name,
Code,
CreatedAt,
UpdatedAt,
Metadata,
ItemId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
LineItems,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Rate => ColumnType::Float.def(),
Self::Name => ColumnType::String(None).def(),
Self::Code => ColumnType::String(None).def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::ItemId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::LineItems => Entity::belongs_to(super::line_items::Entity)
.from(Column::ItemId)
.to(super::line_items::Column::Id)
.into(),
}
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,240 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"line_items"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub cart_id: Option<String>,
pub order_id: Option<String>,
pub swap_id: Option<String>,
pub title: String,
pub description: Option<String>,
pub thumbnail: Option<String>,
pub is_giftcard: bool,
pub should_merge: bool,
pub allow_discounts: bool,
pub has_shipping: Option<bool>,
pub unit_price: i32,
pub variant_id: Option<String>,
pub quantity: i32,
pub fulfilled_quantity: Option<i32>,
pub returned_quantity: Option<i32>,
pub shipped_quantity: Option<i32>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
pub claim_order_id: Option<String>,
pub is_return: bool,
pub original_item_id: Option<String>,
pub order_edit_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
CartId,
OrderId,
SwapId,
Title,
Description,
Thumbnail,
IsGiftcard,
ShouldMerge,
AllowDiscounts,
HasShipping,
UnitPrice,
VariantId,
Quantity,
FulfilledQuantity,
ReturnedQuantity,
ShippedQuantity,
CreatedAt,
UpdatedAt,
Metadata,
ClaimOrderId,
IsReturn,
OriginalItemId,
OrderEditId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Carts,
ClaimItems,
ClaimOrders,
LineItemAdjustments,
LineItemTaxLines,
SelfRef,
OrderEdits,
Orders,
ProductVariants,
ReturnItems,
Swaps,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::CartId => ColumnType::String(None).def().null(),
Self::OrderId => ColumnType::String(None).def().null(),
Self::SwapId => ColumnType::String(None).def().null(),
Self::Title => ColumnType::String(None).def(),
Self::Description => ColumnType::String(None).def().null(),
Self::Thumbnail => ColumnType::String(None).def().null(),
Self::IsGiftcard => ColumnType::Boolean.def(),
Self::ShouldMerge => ColumnType::Boolean.def(),
Self::AllowDiscounts => ColumnType::Boolean.def(),
Self::HasShipping => ColumnType::Boolean.def().null(),
Self::UnitPrice => ColumnType::Integer.def(),
Self::VariantId => ColumnType::String(None).def().null(),
Self::Quantity => ColumnType::Integer.def(),
Self::FulfilledQuantity => ColumnType::Integer.def().null(),
Self::ReturnedQuantity => ColumnType::Integer.def().null(),
Self::ShippedQuantity => ColumnType::Integer.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::ClaimOrderId => ColumnType::String(None).def().null(),
Self::IsReturn => ColumnType::Boolean.def(),
Self::OriginalItemId => ColumnType::String(None).def().null(),
Self::OrderEditId => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Carts => Entity::belongs_to(super::carts::Entity)
.from(Column::CartId)
.to(super::carts::Column::Id)
.into(),
Self::ClaimItems => Entity::has_many(super::claim_items::Entity).into(),
Self::ClaimOrders => Entity::belongs_to(super::claim_orders::Entity)
.from(Column::ClaimOrderId)
.to(super::claim_orders::Column::Id)
.into(),
Self::LineItemAdjustments => {
Entity::has_many(super::line_item_adjustments::Entity).into()
}
Self::LineItemTaxLines => Entity::has_many(super::line_item_tax_lines::Entity).into(),
Self::SelfRef => Entity::belongs_to(Entity)
.from(Column::OriginalItemId)
.to(Column::Id)
.into(),
Self::OrderEdits => Entity::belongs_to(super::order_edits::Entity)
.from(Column::OrderEditId)
.to(super::order_edits::Column::Id)
.into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
Self::ProductVariants => Entity::belongs_to(super::product_variants::Entity)
.from(Column::VariantId)
.to(super::product_variants::Column::Id)
.into(),
Self::ReturnItems => Entity::has_many(super::return_items::Entity).into(),
Self::Swaps => Entity::belongs_to(super::swaps::Entity)
.from(Column::SwapId)
.to(super::swaps::Column::Id)
.into(),
}
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::claim_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimItems.def()
}
}
impl Related<super::claim_orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimOrders.def()
}
}
impl Related<super::line_item_adjustments::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItemAdjustments.def()
}
}
impl Related<super::line_item_tax_lines::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItemTaxLines.def()
}
}
impl Related<super::order_edits::Entity> for Entity {
fn to() -> RelationDef {
Relation::OrderEdits.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::product_variants::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductVariants.def()
}
}
impl Related<super::return_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::ReturnItems.def()
}
}
impl Related<super::swaps::Entity> for Entity {
fn to() -> RelationDef {
Relation::Swaps.def()
}
}
impl Related<super::fulfillments::Entity> for Entity {
fn to() -> RelationDef {
super::fulfillment_items::Relation::Fulfillments.def()
}
fn via() -> Option<RelationDef> {
Some(super::fulfillment_items::Relation::LineItems.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,61 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"migrations"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: i32,
pub timestamp: i64,
pub name: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Timestamp,
Name,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = i32;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::Integer.def(),
Self::Timestamp => ColumnType::BigInteger.def(),
Self::Name => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}

103
crates/model/src/v4/mod.rs Normal file
View File

@ -0,0 +1,103 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
pub mod prelude ;
pub mod addresses ;
pub mod analytics_configs ;
pub mod batch_jobs ;
pub mod cart_discounts ;
pub mod cart_gift_cards ;
pub mod carts ;
pub mod claim_images ;
pub mod claim_item_tags ;
pub mod claim_items ;
pub mod claim_orders ;
pub mod claim_tags ;
pub mod countries ;
pub mod currencies ;
pub mod custom_shipping_options ;
pub mod customer_group_customers ;
pub mod customer_groups ;
pub mod customers ;
pub mod discount_condition_customer_groups ;
pub mod discount_condition_product_collections ;
pub mod discount_condition_product_tags ;
pub mod discount_condition_product_types ;
pub mod discount_condition_products ;
pub mod discount_conditions ;
pub mod discount_regions ;
pub mod discount_rule_products ;
pub mod discount_rules ;
pub mod discounts ;
pub mod draft_orders ;
pub mod fulfillment_items ;
pub mod fulfillment_providers ;
pub mod fulfillments ;
pub mod gift_card_transactions ;
pub mod gift_cards ;
pub mod idempotency_keys ;
pub mod images ;
pub mod invites ;
pub mod line_item_adjustments ;
pub mod line_item_tax_lines ;
pub mod line_items ;
pub mod migrations ;
pub mod money_amounts ;
pub mod notes ;
pub mod notification_providers ;
pub mod notifications ;
pub mod oauth ;
pub mod order_discounts ;
pub mod order_edits ;
pub mod order_gift_cards ;
pub mod order_item_changes ;
pub mod orders ;
pub mod payment_collection_payments ;
pub mod payment_collection_sessions ;
pub mod payment_collections ;
pub mod payment_providers ;
pub mod payment_sessions ;
pub mod payments ;
pub mod price_list_customer_groups ;
pub mod price_lists ;
pub mod product_categories ;
pub mod product_category_products ;
pub mod product_collections ;
pub mod product_images ;
pub mod product_option_values ;
pub mod product_options ;
pub mod product_sales_channels ;
pub mod product_tags ;
pub mod product_tax_rates ;
pub mod product_to_tags ;
pub mod product_type_tax_rates ;
pub mod product_types ;
pub mod product_variant_inventory_items ;
pub mod product_variants ;
pub mod products ;
pub mod publishable_api_key_sales_channels ;
pub mod publishable_api_keys ;
pub mod refunds ;
pub mod region_fulfillment_providers ;
pub mod region_payment_providers ;
pub mod regions ;
pub mod return_items ;
pub mod return_reasons ;
pub mod returns ;
pub mod sales_channel_locations ;
pub mod sales_channels ;
pub mod shipping_method_tax_lines ;
pub mod shipping_methods ;
pub mod shipping_option_requirements ;
pub mod shipping_options ;
pub mod shipping_profiles ;
pub mod shipping_tax_rates ;
pub mod staged_jobs ;
pub mod store_currencies ;
pub mod stores ;
pub mod swaps ;
pub mod tax_providers ;
pub mod tax_rates ;
pub mod tracking_links ;
pub mod users ;
pub mod sea_orm_active_enums ;

View File

@ -0,0 +1,131 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"money_amounts"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub currency_code: String,
pub amount: i32,
pub variant_id: Option<String>,
pub region_id: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub min_quantity: Option<i32>,
pub max_quantity: Option<i32>,
pub price_list_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
CurrencyCode,
Amount,
VariantId,
RegionId,
CreatedAt,
UpdatedAt,
DeletedAt,
MinQuantity,
MaxQuantity,
PriceListId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Currencies,
PriceLists,
ProductVariants,
Regions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::CurrencyCode => ColumnType::String(None).def(),
Self::Amount => ColumnType::Integer.def(),
Self::VariantId => ColumnType::String(None).def().null(),
Self::RegionId => ColumnType::String(None).def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::MinQuantity => ColumnType::Integer.def().null(),
Self::MaxQuantity => ColumnType::Integer.def().null(),
Self::PriceListId => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Currencies => Entity::belongs_to(super::currencies::Entity)
.from(Column::CurrencyCode)
.to(super::currencies::Column::Code)
.into(),
Self::PriceLists => Entity::belongs_to(super::price_lists::Entity)
.from(Column::PriceListId)
.to(super::price_lists::Column::Id)
.into(),
Self::ProductVariants => Entity::belongs_to(super::product_variants::Entity)
.from(Column::VariantId)
.to(super::product_variants::Column::Id)
.into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
}
}
}
impl Related<super::currencies::Entity> for Entity {
fn to() -> RelationDef {
Relation::Currencies.def()
}
}
impl Related<super::price_lists::Entity> for Entity {
fn to() -> RelationDef {
Relation::PriceLists.def()
}
}
impl Related<super::product_variants::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductVariants.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,79 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"notes"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub value: String,
pub resource_type: String,
pub resource_id: String,
pub author_id: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub metadata: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Value,
ResourceType,
ResourceId,
AuthorId,
CreatedAt,
UpdatedAt,
DeletedAt,
Metadata,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Value => ColumnType::String(None).def(),
Self::ResourceType => ColumnType::String(None).def(),
Self::ResourceId => ColumnType::String(None).def(),
Self::AuthorId => ColumnType::String(None).def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,68 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"notification_providers"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub is_installed: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
IsInstalled,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Notifications,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::IsInstalled => ColumnType::Boolean.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Notifications => Entity::has_many(super::notifications::Entity).into(),
}
}
}
impl Related<super::notifications::Entity> for Entity {
fn to() -> RelationDef {
Relation::Notifications.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,116 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"notifications"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub event_name: Option<String>,
pub resource_type: String,
pub resource_id: String,
pub customer_id: Option<String>,
pub to: String,
pub data: Json,
pub parent_id: Option<String>,
pub provider_id: Option<String>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
EventName,
ResourceType,
ResourceId,
CustomerId,
To,
Data,
ParentId,
ProviderId,
CreatedAt,
UpdatedAt,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Customers,
NotificationProviders,
SelfRef,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::EventName => ColumnType::String(None).def().null(),
Self::ResourceType => ColumnType::String(None).def(),
Self::ResourceId => ColumnType::String(None).def(),
Self::CustomerId => ColumnType::String(None).def().null(),
Self::To => ColumnType::String(None).def(),
Self::Data => ColumnType::JsonBinary.def(),
Self::ParentId => ColumnType::String(None).def().null(),
Self::ProviderId => ColumnType::String(None).def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Customers => Entity::belongs_to(super::customers::Entity)
.from(Column::CustomerId)
.to(super::customers::Column::Id)
.into(),
Self::NotificationProviders => {
Entity::belongs_to(super::notification_providers::Entity)
.from(Column::ProviderId)
.to(super::notification_providers::Column::Id)
.into()
}
Self::SelfRef => Entity::belongs_to(Entity)
.from(Column::ParentId)
.to(Column::Id)
.into(),
}
}
}
impl Related<super::customers::Entity> for Entity {
fn to() -> RelationDef {
Relation::Customers.def()
}
}
impl Related<super::notification_providers::Entity> for Entity {
fn to() -> RelationDef {
Relation::NotificationProviders.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,70 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"oauth"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub display_name: String,
pub application_name: String,
pub install_url: Option<String>,
pub uninstall_url: Option<String>,
pub data: Option<Json>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
DisplayName,
ApplicationName,
InstallUrl,
UninstallUrl,
Data,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::DisplayName => ColumnType::String(None).def(),
Self::ApplicationName => ColumnType::String(None).def(),
Self::InstallUrl => ColumnType::String(None).def().null(),
Self::UninstallUrl => ColumnType::String(None).def().null(),
Self::Data => ColumnType::JsonBinary.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,250 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::{OrderFulfillmentStatuses, OrderPaymentStatuses, OrderStatuses};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"order"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub status: OrderStatuses,
pub fulfillment_status: OrderFulfillmentStatuses,
pub payment_status: OrderPaymentStatuses,
pub display_id: i32,
pub cart_id: Option<String>,
pub customer_id: String,
pub email: String,
pub billing_address_id: Option<String>,
pub shipping_address_id: Option<String>,
pub region_id: String,
pub currency_code: String,
pub tax_rate: i32,
pub canceled_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
pub idempotency_key: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Status,
FulfillmentStatus,
PaymentStatus,
DisplayId,
CartId,
CustomerId,
Email,
BillingAddressId,
ShippingAddressId,
RegionId,
CurrencyCode,
TaxRate,
CanceledAt,
CreatedAt,
UpdatedAt,
Metadata,
IdempotencyKey,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Addresses2,
Addresses1,
Cart,
Currencies,
Customers,
Fulfillments,
GiftCardTransactions,
GiftCards,
LineItems,
Payments,
Refunds,
Regions,
Return,
ShippingMethods,
Swap,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Status => OrderStatuses::db_type().def(),
Self::FulfillmentStatus => OrderFulfillmentStatuses::db_type().def(),
Self::PaymentStatus => OrderPaymentStatuses::db_type().def(),
Self::DisplayId => ColumnType::Integer.def(),
Self::CartId => ColumnType::String(None).def().null().unique(),
Self::CustomerId => ColumnType::String(None).def(),
Self::Email => ColumnType::String(None).def(),
Self::BillingAddressId => ColumnType::String(None).def().null(),
Self::ShippingAddressId => ColumnType::String(None).def().null(),
Self::RegionId => ColumnType::String(None).def(),
Self::CurrencyCode => ColumnType::String(None).def(),
Self::TaxRate => ColumnType::Integer.def(),
Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Addresses2 => Entity::belongs_to(super::addresses::Entity)
.from(Column::ShippingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::Addresses1 => Entity::belongs_to(super::addresses::Entity)
.from(Column::BillingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::Cart => Entity::belongs_to(super::cart::Entity)
.from(Column::CartId)
.to(super::cart::Column::Id)
.into(),
Self::Currencies => Entity::belongs_to(super::currencies::Entity)
.from(Column::CurrencyCode)
.to(super::currencies::Column::Code)
.into(),
Self::Customers => Entity::belongs_to(super::customers::Entity)
.from(Column::CustomerId)
.to(super::customers::Column::Id)
.into(),
Self::Fulfillments => Entity::has_many(super::fulfillments::Entity).into(),
Self::GiftCardTransactions => {
Entity::has_many(super::gift_card_transactions::Entity).into()
}
Self::GiftCards => Entity::has_one(super::gift_cards::Entity).into(),
Self::LineItems => Entity::has_many(super::line_items::Entity).into(),
Self::Payments => Entity::has_many(super::payments::Entity).into(),
Self::Refunds => Entity::has_many(super::refunds::Entity).into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
Self::Return => Entity::has_many(super::r#return::Entity).into(),
Self::ShippingMethods => Entity::has_many(super::shipping_methods::Entity).into(),
Self::Swap => Entity::has_many(super::swap::Entity).into(),
}
}
}
impl Related<super::cart::Entity> for Entity {
fn to() -> RelationDef {
Relation::Cart.def()
}
}
impl Related<super::currencies::Entity> for Entity {
fn to() -> RelationDef {
Relation::Currencies.def()
}
}
impl Related<super::customers::Entity> for Entity {
fn to() -> RelationDef {
Relation::Customers.def()
}
}
impl Related<super::fulfillments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Fulfillments.def()
}
}
impl Related<super::gift_card_transactions::Entity> for Entity {
fn to() -> RelationDef {
Relation::GiftCardTransactions.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl Related<super::payments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Payments.def()
}
}
impl Related<super::refunds::Entity> for Entity {
fn to() -> RelationDef {
Relation::Refunds.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl Related<super::r#return::Entity> for Entity {
fn to() -> RelationDef {
Relation::Return.def()
}
}
impl Related<super::shipping_methods::Entity> for Entity {
fn to() -> RelationDef {
Relation::ShippingMethods.def()
}
}
impl Related<super::swap::Entity> for Entity {
fn to() -> RelationDef {
Relation::Swap.def()
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
super::order_discounts::Relation::Discounts.def()
}
fn via() -> Option<RelationDef> {
Some(super::order_discounts::Relation::Order.def().rev())
}
}
impl Related<super::gift_cards::Entity> for Entity {
fn to() -> RelationDef {
super::order_gift_cards::Relation::GiftCards.def()
}
fn via() -> Option<RelationDef> {
Some(super::order_gift_cards::Relation::Order.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"order_discounts"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub order_id: String,
pub discount_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
OrderId,
DiscountId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
OrderId,
DiscountId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Discounts,
Orders,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::OrderId => ColumnType::String(None).def(),
Self::DiscountId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Discounts => Entity::belongs_to(super::discounts::Entity)
.from(Column::DiscountId)
.to(super::discounts::Column::Id)
.into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
}
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Discounts.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,140 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"order_edits"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub order_id: String,
pub internal_note: Option<String>,
pub created_by: String,
pub requested_by: Option<String>,
pub requested_at: Option<DateTimeWithTimeZone>,
pub confirmed_by: Option<String>,
pub confirmed_at: Option<DateTimeWithTimeZone>,
pub declined_by: Option<String>,
pub declined_reason: Option<String>,
pub declined_at: Option<DateTimeWithTimeZone>,
pub canceled_by: Option<String>,
pub canceled_at: Option<DateTimeWithTimeZone>,
pub payment_collection_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
CreatedAt,
UpdatedAt,
OrderId,
InternalNote,
CreatedBy,
RequestedBy,
RequestedAt,
ConfirmedBy,
ConfirmedAt,
DeclinedBy,
DeclinedReason,
DeclinedAt,
CanceledBy,
CanceledAt,
PaymentCollectionId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
LineItems,
OrderItemChanges,
Orders,
PaymentCollections,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::OrderId => ColumnType::String(None).def(),
Self::InternalNote => ColumnType::String(None).def().null(),
Self::CreatedBy => ColumnType::String(None).def(),
Self::RequestedBy => ColumnType::String(None).def().null(),
Self::RequestedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::ConfirmedBy => ColumnType::String(None).def().null(),
Self::ConfirmedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::DeclinedBy => ColumnType::String(None).def().null(),
Self::DeclinedReason => ColumnType::String(None).def().null(),
Self::DeclinedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CanceledBy => ColumnType::String(None).def().null(),
Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::PaymentCollectionId => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::LineItems => Entity::has_many(super::line_items::Entity).into(),
Self::OrderItemChanges => Entity::has_many(super::order_item_changes::Entity).into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
Self::PaymentCollections => Entity::belongs_to(super::payment_collections::Entity)
.from(Column::PaymentCollectionId)
.to(super::payment_collections::Column::Id)
.into(),
}
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl Related<super::order_item_changes::Entity> for Entity {
fn to() -> RelationDef {
Relation::OrderItemChanges.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::payment_collections::Entity> for Entity {
fn to() -> RelationDef {
Relation::PaymentCollections.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"order_gift_cards"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub order_id: String,
pub gift_card_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
OrderId,
GiftCardId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
OrderId,
GiftCardId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
GiftCards,
Orders,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::OrderId => ColumnType::String(None).def(),
Self::GiftCardId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::GiftCards => Entity::belongs_to(super::gift_cards::Entity)
.from(Column::GiftCardId)
.to(super::gift_cards::Column::Id)
.into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
}
}
}
impl Related<super::gift_cards::Entity> for Entity {
fn to() -> RelationDef {
Relation::GiftCards.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,101 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::OrderItemChangeTypes;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"order_item_changes"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub r#type: OrderItemChangeTypes,
pub order_edit_id: String,
pub original_line_item_id: Option<String>,
pub line_item_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
CreatedAt,
UpdatedAt,
DeletedAt,
Type,
OrderEditId,
OriginalLineItemId,
LineItemId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
LineItems2,
LineItems1,
OrderEdits,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Type => OrderItemChangeTypes::db_type().def(),
Self::OrderEditId => ColumnType::String(None).def(),
Self::OriginalLineItemId => ColumnType::String(None).def().null(),
Self::LineItemId => ColumnType::String(None).def().null().unique(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::LineItems2 => Entity::belongs_to(super::line_items::Entity)
.from(Column::LineItemId)
.to(super::line_items::Column::Id)
.into(),
Self::LineItems1 => Entity::belongs_to(super::line_items::Entity)
.from(Column::OriginalLineItemId)
.to(super::line_items::Column::Id)
.into(),
Self::OrderEdits => Entity::belongs_to(super::order_edits::Entity)
.from(Column::OrderEditId)
.to(super::order_edits::Column::Id)
.into(),
}
}
}
impl Related<super::order_edits::Entity> for Entity {
fn to() -> RelationDef {
Relation::OrderEdits.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,300 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::{OrderFulfillmentStatuses, OrderPaymentStatuses, OrderStatuses};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"orders"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub status: OrderStatuses,
pub fulfillment_status: OrderFulfillmentStatuses,
pub payment_status: OrderPaymentStatuses,
pub display_id: i32,
pub cart_id: Option<String>,
pub customer_id: String,
pub email: String,
pub billing_address_id: Option<String>,
pub shipping_address_id: Option<String>,
pub region_id: String,
pub currency_code: String,
pub tax_rate: Option<f32>,
pub canceled_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
pub idempotency_key: Option<String>,
pub draft_order_id: Option<String>,
pub no_notification: Option<bool>,
pub external_id: Option<String>,
pub sales_channel_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Status,
FulfillmentStatus,
PaymentStatus,
DisplayId,
CartId,
CustomerId,
Email,
BillingAddressId,
ShippingAddressId,
RegionId,
CurrencyCode,
TaxRate,
CanceledAt,
CreatedAt,
UpdatedAt,
Metadata,
IdempotencyKey,
DraftOrderId,
NoNotification,
ExternalId,
SalesChannelId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
true
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Addresses2,
Addresses1,
Carts,
ClaimOrders,
Currencies,
Customers,
DraftOrders,
Fulfillments,
GiftCardTransactions,
GiftCards,
LineItems,
OrderEdits,
Payments,
Refunds,
Regions,
Returns,
SalesChannels,
ShippingMethods,
Swaps,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Status => OrderStatuses::db_type().def(),
Self::FulfillmentStatus => OrderFulfillmentStatuses::db_type().def(),
Self::PaymentStatus => OrderPaymentStatuses::db_type().def(),
Self::DisplayId => ColumnType::Integer.def(),
Self::CartId => ColumnType::String(None).def().null().unique(),
Self::CustomerId => ColumnType::String(None).def(),
Self::Email => ColumnType::String(None).def(),
Self::BillingAddressId => ColumnType::String(None).def().null(),
Self::ShippingAddressId => ColumnType::String(None).def().null(),
Self::RegionId => ColumnType::String(None).def(),
Self::CurrencyCode => ColumnType::String(None).def(),
Self::TaxRate => ColumnType::Float.def().null(),
Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
Self::DraftOrderId => ColumnType::String(None).def().null().unique(),
Self::NoNotification => ColumnType::Boolean.def().null(),
Self::ExternalId => ColumnType::String(None).def().null(),
Self::SalesChannelId => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Addresses2 => Entity::belongs_to(super::addresses::Entity)
.from(Column::ShippingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::Addresses1 => Entity::belongs_to(super::addresses::Entity)
.from(Column::BillingAddressId)
.to(super::addresses::Column::Id)
.into(),
Self::Carts => Entity::belongs_to(super::carts::Entity)
.from(Column::CartId)
.to(super::carts::Column::Id)
.into(),
Self::ClaimOrders => Entity::has_many(super::claim_orders::Entity).into(),
Self::Currencies => Entity::belongs_to(super::currencies::Entity)
.from(Column::CurrencyCode)
.to(super::currencies::Column::Code)
.into(),
Self::Customers => Entity::belongs_to(super::customers::Entity)
.from(Column::CustomerId)
.to(super::customers::Column::Id)
.into(),
Self::DraftOrders => Entity::belongs_to(super::draft_orders::Entity)
.from(Column::DraftOrderId)
.to(super::draft_orders::Column::Id)
.into(),
Self::Fulfillments => Entity::has_many(super::fulfillments::Entity).into(),
Self::GiftCardTransactions => {
Entity::has_many(super::gift_card_transactions::Entity).into()
}
Self::GiftCards => Entity::has_many(super::gift_cards::Entity).into(),
Self::LineItems => Entity::has_many(super::line_items::Entity).into(),
Self::OrderEdits => Entity::has_many(super::order_edits::Entity).into(),
Self::Payments => Entity::has_many(super::payments::Entity).into(),
Self::Refunds => Entity::has_many(super::refunds::Entity).into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
Self::Returns => Entity::has_many(super::returns::Entity).into(),
Self::SalesChannels => Entity::belongs_to(super::sales_channels::Entity)
.from(Column::SalesChannelId)
.to(super::sales_channels::Column::Id)
.into(),
Self::ShippingMethods => Entity::has_many(super::shipping_methods::Entity).into(),
Self::Swaps => Entity::has_many(super::swaps::Entity).into(),
}
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::claim_orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClaimOrders.def()
}
}
impl Related<super::currencies::Entity> for Entity {
fn to() -> RelationDef {
Relation::Currencies.def()
}
}
impl Related<super::customers::Entity> for Entity {
fn to() -> RelationDef {
Relation::Customers.def()
}
}
impl Related<super::draft_orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::DraftOrders.def()
}
}
impl Related<super::fulfillments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Fulfillments.def()
}
}
impl Related<super::gift_card_transactions::Entity> for Entity {
fn to() -> RelationDef {
Relation::GiftCardTransactions.def()
}
}
impl Related<super::line_items::Entity> for Entity {
fn to() -> RelationDef {
Relation::LineItems.def()
}
}
impl Related<super::order_edits::Entity> for Entity {
fn to() -> RelationDef {
Relation::OrderEdits.def()
}
}
impl Related<super::payments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Payments.def()
}
}
impl Related<super::refunds::Entity> for Entity {
fn to() -> RelationDef {
Relation::Refunds.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl Related<super::returns::Entity> for Entity {
fn to() -> RelationDef {
Relation::Returns.def()
}
}
impl Related<super::sales_channels::Entity> for Entity {
fn to() -> RelationDef {
Relation::SalesChannels.def()
}
}
impl Related<super::shipping_methods::Entity> for Entity {
fn to() -> RelationDef {
Relation::ShippingMethods.def()
}
}
impl Related<super::swaps::Entity> for Entity {
fn to() -> RelationDef {
Relation::Swaps.def()
}
}
impl Related<super::discounts::Entity> for Entity {
fn to() -> RelationDef {
super::order_discounts::Relation::Discounts.def()
}
fn via() -> Option<RelationDef> {
Some(super::order_discounts::Relation::Orders.def().rev())
}
}
impl Related<super::gift_cards::Entity> for Entity {
fn to() -> RelationDef {
super::order_gift_cards::Relation::GiftCards.def()
}
fn via() -> Option<RelationDef> {
Some(super::order_gift_cards::Relation::Orders.def().rev())
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"payment_collection_payments"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub payment_collection_id: String,
pub payment_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
PaymentCollectionId,
PaymentId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
PaymentCollectionId,
PaymentId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
PaymentCollections,
Payments,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::PaymentCollectionId => ColumnType::String(None).def(),
Self::PaymentId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::PaymentCollections => Entity::belongs_to(super::payment_collections::Entity)
.from(Column::PaymentCollectionId)
.to(super::payment_collections::Column::Id)
.into(),
Self::Payments => Entity::belongs_to(super::payments::Entity)
.from(Column::PaymentId)
.to(super::payments::Column::Id)
.into(),
}
}
}
impl Related<super::payment_collections::Entity> for Entity {
fn to() -> RelationDef {
Relation::PaymentCollections.def()
}
}
impl Related<super::payments::Entity> for Entity {
fn to() -> RelationDef {
Relation::Payments.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"payment_collection_sessions"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub payment_collection_id: String,
pub payment_session_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
PaymentCollectionId,
PaymentSessionId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
PaymentCollectionId,
PaymentSessionId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
PaymentCollections,
PaymentSessions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::PaymentCollectionId => ColumnType::String(None).def(),
Self::PaymentSessionId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::PaymentCollections => Entity::belongs_to(super::payment_collections::Entity)
.from(Column::PaymentCollectionId)
.to(super::payment_collections::Column::Id)
.into(),
Self::PaymentSessions => Entity::belongs_to(super::payment_sessions::Entity)
.from(Column::PaymentSessionId)
.to(super::payment_sessions::Column::Id)
.into(),
}
}
}
impl Related<super::payment_collections::Entity> for Entity {
fn to() -> RelationDef {
Relation::PaymentCollections.def()
}
}
impl Related<super::payment_sessions::Entity> for Entity {
fn to() -> RelationDef {
Relation::PaymentSessions.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,140 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::{PaymentCollectionStatuses, PaymentCollectionTypes};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"payment_collections"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
pub r#type: PaymentCollectionTypes,
pub status: PaymentCollectionStatuses,
pub description: Option<String>,
pub amount: i32,
pub authorized_amount: Option<i32>,
pub region_id: String,
pub currency_code: String,
pub metadata: Option<Json>,
pub created_by: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
CreatedAt,
UpdatedAt,
DeletedAt,
Type,
Status,
Description,
Amount,
AuthorizedAmount,
RegionId,
CurrencyCode,
Metadata,
CreatedBy,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
OrderEdits,
Regions,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Type => PaymentCollectionTypes::db_type().def(),
Self::Status => PaymentCollectionStatuses::db_type().def(),
Self::Description => ColumnType::Text.def().null(),
Self::Amount => ColumnType::Integer.def(),
Self::AuthorizedAmount => ColumnType::Integer.def().null(),
Self::RegionId => ColumnType::String(None).def(),
Self::CurrencyCode => ColumnType::String(None).def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::CreatedBy => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::OrderEdits => Entity::has_many(super::order_edits::Entity).into(),
Self::Regions => Entity::belongs_to(super::regions::Entity)
.from(Column::RegionId)
.to(super::regions::Column::Id)
.into(),
}
}
}
impl Related<super::order_edits::Entity> for Entity {
fn to() -> RelationDef {
Relation::OrderEdits.def()
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
Relation::Regions.def()
}
}
impl Related<super::payments::Entity> for Entity {
fn to() -> RelationDef {
super::payment_collection_payments::Relation::Payments.def()
}
fn via() -> Option<RelationDef> {
Some(
super::payment_collection_payments::Relation::PaymentCollections
.def()
.rev(),
)
}
}
impl Related<super::payment_sessions::Entity> for Entity {
fn to() -> RelationDef {
super::payment_collection_sessions::Relation::PaymentSessions.def()
}
fn via() -> Option<RelationDef> {
Some(
super::payment_collection_sessions::Relation::PaymentCollections
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,71 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"payment_providers"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub is_installed: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
IsInstalled,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::IsInstalled => ColumnType::Boolean.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}
impl Related<super::regions::Entity> for Entity {
fn to() -> RelationDef {
super::region_payment_providers::Relation::Regions.def()
}
fn via() -> Option<RelationDef> {
Some(
super::region_payment_providers::Relation::PaymentProviders
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,116 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::PaymentSessionStatuses;
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"payment_sessions"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub cart_id: Option<String>,
pub provider_id: String,
pub is_selected: Option<bool>,
pub status: PaymentSessionStatuses,
pub data: Json,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub idempotency_key: Option<String>,
pub payment_authorized_at: Option<DateTimeWithTimeZone>,
pub amount: Option<i32>,
pub is_initiated: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
CartId,
ProviderId,
IsSelected,
Status,
Data,
CreatedAt,
UpdatedAt,
IdempotencyKey,
PaymentAuthorizedAt,
Amount,
IsInitiated,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Carts,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::CartId => ColumnType::String(None).def().null(),
Self::ProviderId => ColumnType::String(None).def(),
Self::IsSelected => ColumnType::Boolean.def().null(),
Self::Status => PaymentSessionStatuses::db_type().def(),
Self::Data => ColumnType::JsonBinary.def(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
Self::PaymentAuthorizedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::Amount => ColumnType::Integer.def().null(),
Self::IsInitiated => ColumnType::Boolean.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Carts => Entity::belongs_to(super::carts::Entity)
.from(Column::CartId)
.to(super::carts::Column::Id)
.into(),
}
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::payment_collections::Entity> for Entity {
fn to() -> RelationDef {
super::payment_collection_sessions::Relation::PaymentCollections.def()
}
fn via() -> Option<RelationDef> {
Some(
super::payment_collection_sessions::Relation::PaymentSessions
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,164 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"payments"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub swap_id: Option<String>,
pub cart_id: Option<String>,
pub order_id: Option<String>,
pub amount: i32,
pub currency_code: String,
pub amount_refunded: i32,
pub provider_id: String,
pub data: Json,
pub captured_at: Option<DateTimeWithTimeZone>,
pub canceled_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub metadata: Option<Json>,
pub idempotency_key: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
SwapId,
CartId,
OrderId,
Amount,
CurrencyCode,
AmountRefunded,
ProviderId,
Data,
CapturedAt,
CanceledAt,
CreatedAt,
UpdatedAt,
Metadata,
IdempotencyKey,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Carts,
Currencies,
Orders,
Refunds,
Swaps,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::SwapId => ColumnType::String(None).def().null().unique(),
Self::CartId => ColumnType::String(None).def().null(),
Self::OrderId => ColumnType::String(None).def().null(),
Self::Amount => ColumnType::Integer.def(),
Self::CurrencyCode => ColumnType::String(None).def(),
Self::AmountRefunded => ColumnType::Integer.def(),
Self::ProviderId => ColumnType::String(None).def(),
Self::Data => ColumnType::JsonBinary.def(),
Self::CapturedAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CanceledAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Metadata => ColumnType::JsonBinary.def().null(),
Self::IdempotencyKey => ColumnType::String(None).def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Carts => Entity::belongs_to(super::carts::Entity)
.from(Column::CartId)
.to(super::carts::Column::Id)
.into(),
Self::Currencies => Entity::belongs_to(super::currencies::Entity)
.from(Column::CurrencyCode)
.to(super::currencies::Column::Code)
.into(),
Self::Orders => Entity::belongs_to(super::orders::Entity)
.from(Column::OrderId)
.to(super::orders::Column::Id)
.into(),
Self::Refunds => Entity::has_many(super::refunds::Entity).into(),
Self::Swaps => Entity::belongs_to(super::swaps::Entity)
.from(Column::SwapId)
.to(super::swaps::Column::Id)
.into(),
}
}
}
impl Related<super::carts::Entity> for Entity {
fn to() -> RelationDef {
Relation::Carts.def()
}
}
impl Related<super::currencies::Entity> for Entity {
fn to() -> RelationDef {
Relation::Currencies.def()
}
}
impl Related<super::orders::Entity> for Entity {
fn to() -> RelationDef {
Relation::Orders.def()
}
}
impl Related<super::refunds::Entity> for Entity {
fn to() -> RelationDef {
Relation::Refunds.def()
}
}
impl Related<super::swaps::Entity> for Entity {
fn to() -> RelationDef {
Relation::Swaps.def()
}
}
impl Related<super::payment_collections::Entity> for Entity {
fn to() -> RelationDef {
super::payment_collection_payments::Relation::PaymentCollections.def()
}
fn via() -> Option<RelationDef> {
Some(
super::payment_collection_payments::Relation::Payments
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,100 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
pub use super :: addresses :: Entity as Addresses ;
pub use super :: analytics_configs :: Entity as AnalyticsConfigs ;
pub use super :: batch_jobs :: Entity as BatchJobs ;
pub use super :: cart_discounts :: Entity as CartDiscounts ;
pub use super :: cart_gift_cards :: Entity as CartGiftCards ;
pub use super :: carts :: Entity as Carts ;
pub use super :: claim_images :: Entity as ClaimImages ;
pub use super :: claim_item_tags :: Entity as ClaimItemTags ;
pub use super :: claim_items :: Entity as ClaimItems ;
pub use super :: claim_orders :: Entity as ClaimOrders ;
pub use super :: claim_tags :: Entity as ClaimTags ;
pub use super :: countries :: Entity as Countries ;
pub use super :: currencies :: Entity as Currencies ;
pub use super :: custom_shipping_options :: Entity as CustomShippingOptions ;
pub use super :: customer_group_customers :: Entity as CustomerGroupCustomers ;
pub use super :: customer_groups :: Entity as CustomerGroups ;
pub use super :: customers :: Entity as Customers ;
pub use super :: discount_condition_customer_groups :: Entity as DiscountConditionCustomerGroups ;
pub use super :: discount_condition_product_collections :: Entity as DiscountConditionProductCollections ;
pub use super :: discount_condition_product_tags :: Entity as DiscountConditionProductTags ;
pub use super :: discount_condition_product_types :: Entity as DiscountConditionProductTypes ;
pub use super :: discount_condition_products :: Entity as DiscountConditionProducts ;
pub use super :: discount_conditions :: Entity as DiscountConditions ;
pub use super :: discount_regions :: Entity as DiscountRegions ;
pub use super :: discount_rule_products :: Entity as DiscountRuleProducts ;
pub use super :: discount_rules :: Entity as DiscountRules ;
pub use super :: discounts :: Entity as Discounts ;
pub use super :: draft_orders :: Entity as DraftOrders ;
pub use super :: fulfillment_items :: Entity as FulfillmentItems ;
pub use super :: fulfillment_providers :: Entity as FulfillmentProviders ;
pub use super :: fulfillments :: Entity as Fulfillments ;
pub use super :: gift_card_transactions :: Entity as GiftCardTransactions ;
pub use super :: gift_cards :: Entity as GiftCards ;
pub use super :: idempotency_keys :: Entity as IdempotencyKeys ;
pub use super :: images :: Entity as Images ;
pub use super :: invites :: Entity as Invites ;
pub use super :: line_item_adjustments :: Entity as LineItemAdjustments ;
pub use super :: line_item_tax_lines :: Entity as LineItemTaxLines ;
pub use super :: line_items :: Entity as LineItems ;
pub use super :: migrations :: Entity as Migrations ;
pub use super :: money_amounts :: Entity as MoneyAmounts ;
pub use super :: notes :: Entity as Notes ;
pub use super :: notification_providers :: Entity as NotificationProviders ;
pub use super :: notifications :: Entity as Notifications ;
pub use super :: oauth :: Entity as Oauth ;
pub use super :: order_discounts :: Entity as OrderDiscounts ;
pub use super :: order_edits :: Entity as OrderEdits ;
pub use super :: order_gift_cards :: Entity as OrderGiftCards ;
pub use super :: order_item_changes :: Entity as OrderItemChanges ;
pub use super :: orders :: Entity as Orders ;
pub use super :: payment_collection_payments :: Entity as PaymentCollectionPayments ;
pub use super :: payment_collection_sessions :: Entity as PaymentCollectionSessions ;
pub use super :: payment_collections :: Entity as PaymentCollections ;
pub use super :: payment_providers :: Entity as PaymentProviders ;
pub use super :: payment_sessions :: Entity as PaymentSessions ;
pub use super :: payments :: Entity as Payments ;
pub use super :: price_list_customer_groups :: Entity as PriceListCustomerGroups ;
pub use super :: price_lists :: Entity as PriceLists ;
pub use super :: product_categories :: Entity as ProductCategories ;
pub use super :: product_category_products :: Entity as ProductCategoryProducts ;
pub use super :: product_collections :: Entity as ProductCollections ;
pub use super :: product_images :: Entity as ProductImages ;
pub use super :: product_option_values :: Entity as ProductOptionValues ;
pub use super :: product_options :: Entity as ProductOptions ;
pub use super :: product_sales_channels :: Entity as ProductSalesChannels ;
pub use super :: product_tags :: Entity as ProductTags ;
pub use super :: product_tax_rates :: Entity as ProductTaxRates ;
pub use super :: product_to_tags :: Entity as ProductToTags ;
pub use super :: product_type_tax_rates :: Entity as ProductTypeTaxRates ;
pub use super :: product_types :: Entity as ProductTypes ;
pub use super :: product_variant_inventory_items :: Entity as ProductVariantInventoryItems ;
pub use super :: product_variants :: Entity as ProductVariants ;
pub use super :: products :: Entity as Products ;
pub use super :: publishable_api_key_sales_channels :: Entity as PublishableApiKeySalesChannels ;
pub use super :: publishable_api_keys :: Entity as PublishableApiKeys ;
pub use super :: refunds :: Entity as Refunds ;
pub use super :: region_fulfillment_providers :: Entity as RegionFulfillmentProviders ;
pub use super :: region_payment_providers :: Entity as RegionPaymentProviders ;
pub use super :: regions :: Entity as Regions ;
pub use super :: return_items :: Entity as ReturnItems ;
pub use super :: return_reasons :: Entity as ReturnReasons ;
pub use super :: returns :: Entity as Returns ;
pub use super :: sales_channel_locations :: Entity as SalesChannelLocations ;
pub use super :: sales_channels :: Entity as SalesChannels ;
pub use super :: shipping_method_tax_lines :: Entity as ShippingMethodTaxLines ;
pub use super :: shipping_methods :: Entity as ShippingMethods ;
pub use super :: shipping_option_requirements :: Entity as ShippingOptionRequirements ;
pub use super :: shipping_options :: Entity as ShippingOptions ;
pub use super :: shipping_profiles :: Entity as ShippingProfiles ;
pub use super :: shipping_tax_rates :: Entity as ShippingTaxRates ;
pub use super :: staged_jobs :: Entity as StagedJobs ;
pub use super :: store_currencies :: Entity as StoreCurrencies ;
pub use super :: stores :: Entity as Stores ;
pub use super :: swaps :: Entity as Swaps ;
pub use super :: tax_providers :: Entity as TaxProviders ;
pub use super :: tax_rates :: Entity as TaxRates ;
pub use super :: tracking_links :: Entity as TrackingLinks ;
pub use super :: users :: Entity as Users ;

View File

@ -0,0 +1,83 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"price_list_customer_groups"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub price_list_id: String,
pub customer_group_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
PriceListId,
CustomerGroupId,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
PriceListId,
CustomerGroupId,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = (String, String);
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
CustomerGroups,
PriceLists,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::PriceListId => ColumnType::String(None).def(),
Self::CustomerGroupId => ColumnType::String(None).def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::CustomerGroups => Entity::belongs_to(super::customer_groups::Entity)
.from(Column::CustomerGroupId)
.to(super::customer_groups::Column::Id)
.into(),
Self::PriceLists => Entity::belongs_to(super::price_lists::Entity)
.from(Column::PriceListId)
.to(super::price_lists::Column::Id)
.into(),
}
}
}
impl Related<super::customer_groups::Entity> for Entity {
fn to() -> RelationDef {
Relation::CustomerGroups.def()
}
}
impl Related<super::price_lists::Entity> for Entity {
fn to() -> RelationDef {
Relation::PriceLists.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,107 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
use super::sea_orm_active_enums::{PriceListStatuses, PriceListTypes};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"price_lists"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub name: String,
pub description: String,
pub r#type: PriceListTypes,
pub status: PriceListStatuses,
pub starts_at: Option<DateTimeWithTimeZone>,
pub ends_at: Option<DateTimeWithTimeZone>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub deleted_at: Option<DateTimeWithTimeZone>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Name,
Description,
Type,
Status,
StartsAt,
EndsAt,
CreatedAt,
UpdatedAt,
DeletedAt,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
MoneyAmounts,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Name => ColumnType::String(None).def(),
Self::Description => ColumnType::String(None).def(),
Self::Type => PriceListTypes::db_type().def(),
Self::Status => PriceListStatuses::db_type().def(),
Self::StartsAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::EndsAt => ColumnType::TimestampWithTimeZone.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::DeletedAt => ColumnType::TimestampWithTimeZone.def().null(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::MoneyAmounts => Entity::has_many(super::money_amounts::Entity).into(),
}
}
}
impl Related<super::money_amounts::Entity> for Entity {
fn to() -> RelationDef {
Relation::MoneyAmounts.def()
}
}
impl Related<super::customer_groups::Entity> for Entity {
fn to() -> RelationDef {
super::price_list_customer_groups::Relation::CustomerGroups.def()
}
fn via() -> Option<RelationDef> {
Some(
super::price_list_customer_groups::Relation::PriceLists
.def()
.rev(),
)
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,97 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;
impl EntityName for Entity {
fn table_name(&self) -> &str {
"product_categories"
}
}
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Eq, Serialize, Deserialize)]
pub struct Model {
pub id: String,
pub name: String,
pub handle: String,
pub parent_category_id: Option<String>,
pub mpath: Option<String>,
pub is_active: Option<bool>,
pub is_internal: Option<bool>,
pub created_at: DateTimeWithTimeZone,
pub updated_at: DateTimeWithTimeZone,
pub rank: i32,
pub description: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
Name,
Handle,
ParentCategoryId,
Mpath,
IsActive,
IsInternal,
CreatedAt,
UpdatedAt,
Rank,
Description,
}
#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}
impl PrimaryKeyTrait for PrimaryKey {
type ValueType = String;
fn auto_increment() -> bool {
false
}
}
#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
ProductCategoryProducts,
}
impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::String(None).def(),
Self::Name => ColumnType::Text.def(),
Self::Handle => ColumnType::Text.def(),
Self::ParentCategoryId => ColumnType::String(None).def().null(),
Self::Mpath => ColumnType::Text.def().null(),
Self::IsActive => ColumnType::Boolean.def().null(),
Self::IsInternal => ColumnType::Boolean.def().null(),
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::UpdatedAt => ColumnType::TimestampWithTimeZone.def(),
Self::Rank => ColumnType::Integer.def(),
Self::Description => ColumnType::Text.def(),
}
}
}
impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::ProductCategoryProducts => {
Entity::has_many(super::product_category_products::Entity).into()
}
}
}
}
impl Related<super::product_category_products::Entity> for Entity {
fn to() -> RelationDef {
Relation::ProductCategoryProducts.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_category_products" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_category_id : String , pub product_id : String , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductCategoryId , ProductId , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductCategories , Products , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductCategoryId => ColumnType :: String (None) . def () , Self :: ProductId => ColumnType :: String (None) . def () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductCategories => Entity :: belongs_to (super :: product_categories :: Entity) . from (Column :: ProductCategoryId) . to (super :: product_categories :: Column :: Id) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } }
impl Related < super :: product_categories :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductCategories . def () } }
impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_collections" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub title : String , pub handle : Option < String > , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Title , Handle , CreatedAt , UpdatedAt , DeletedAt , Metadata , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Products , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Title => ColumnType :: String (None) . def () , Self :: Handle => ColumnType :: String (None) . def () . null () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Products => Entity :: has_many (super :: products :: Entity) . into () , } } }
impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } }
impl Related < super :: discount_conditions :: Entity > for Entity { fn to () -> RelationDef { super :: discount_condition_product_collections :: Relation :: DiscountConditions . def () } fn via () -> Option < RelationDef > { Some (super :: discount_condition_product_collections :: Relation :: ProductCollections . def () . rev ()) } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_images" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_id : String , pub image_id : String , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductId , ImageId , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductId , ImageId , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Images , Products , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductId => ColumnType :: String (None) . def () , Self :: ImageId => ColumnType :: String (None) . def () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Images => Entity :: belongs_to (super :: images :: Entity) . from (Column :: ImageId) . to (super :: images :: Column :: Id) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } }
impl Related < super :: images :: Entity > for Entity { fn to () -> RelationDef { Relation :: Images . def () } }
impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_option_values" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub value : String , pub option_id : String , pub variant_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Value , OptionId , VariantId , CreatedAt , UpdatedAt , DeletedAt , Metadata , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductOptions , ProductVariants , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Value => ColumnType :: String (None) . def () , Self :: OptionId => ColumnType :: String (None) . def () , Self :: VariantId => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductOptions => Entity :: belongs_to (super :: product_options :: Entity) . from (Column :: OptionId) . to (super :: product_options :: Column :: Id) . into () , Self :: ProductVariants => Entity :: belongs_to (super :: product_variants :: Entity) . from (Column :: VariantId) . to (super :: product_variants :: Column :: Id) . into () , } } }
impl Related < super :: product_options :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductOptions . def () } }
impl Related < super :: product_variants :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductVariants . def () } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_options" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub title : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , pub product_id : Option < String > , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Title , CreatedAt , UpdatedAt , DeletedAt , Metadata , ProductId , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductOptionValues , Products , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Title => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , Self :: ProductId => ColumnType :: String (None) . def () . null () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductOptionValues => Entity :: has_many (super :: product_option_values :: Entity) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } }
impl Related < super :: product_option_values :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductOptionValues . def () } }
impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_sales_channels" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_id : String , pub sales_channel_id : String , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductId , SalesChannelId , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductId , SalesChannelId , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Products , SalesChannels , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductId => ColumnType :: String (None) . def () , Self :: SalesChannelId => ColumnType :: String (None) . def () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , Self :: SalesChannels => Entity :: belongs_to (super :: sales_channels :: Entity) . from (Column :: SalesChannelId) . to (super :: sales_channels :: Column :: Id) . into () , } } }
impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } }
impl Related < super :: sales_channels :: Entity > for Entity { fn to () -> RelationDef { Relation :: SalesChannels . def () } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_tags" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub id : String , pub value : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub deleted_at : Option < DateTimeWithTimeZone > , pub metadata : Option < Json > , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { Id , Value , CreatedAt , UpdatedAt , DeletedAt , Metadata , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { Id , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = String ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: Id => ColumnType :: String (None) . def () , Self :: Value => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: DeletedAt => ColumnType :: TimestampWithTimeZone . def () . null () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { panic ! ("No RelationDef") } }
impl Related < super :: discount_conditions :: Entity > for Entity { fn to () -> RelationDef { super :: discount_condition_product_tags :: Relation :: DiscountConditions . def () } fn via () -> Option < RelationDef > { Some (super :: discount_condition_product_tags :: Relation :: ProductTags . def () . rev ()) } }
impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { super :: product_to_tags :: Relation :: Products . def () } fn via () -> Option < RelationDef > { Some (super :: product_to_tags :: Relation :: ProductTags . def () . rev ()) } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_tax_rates" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_id : String , pub rate_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductId , RateId , CreatedAt , UpdatedAt , Metadata , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductId , RateId , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { Products , TaxRates , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductId => ColumnType :: String (None) . def () , Self :: RateId => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , Self :: TaxRates => Entity :: belongs_to (super :: tax_rates :: Entity) . from (Column :: RateId) . to (super :: tax_rates :: Column :: Id) . into () , } } }
impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } }
impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { Relation :: TaxRates . def () } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_to_tags" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_id : String , pub product_tag_id : String , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductId , ProductTagId , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductId , ProductTagId , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductTags , Products , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductId => ColumnType :: String (None) . def () , Self :: ProductTagId => ColumnType :: String (None) . def () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductTags => Entity :: belongs_to (super :: product_tags :: Entity) . from (Column :: ProductTagId) . to (super :: product_tags :: Column :: Id) . into () , Self :: Products => Entity :: belongs_to (super :: products :: Entity) . from (Column :: ProductId) . to (super :: products :: Column :: Id) . into () , } } }
impl Related < super :: product_tags :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductTags . def () } }
impl Related < super :: products :: Entity > for Entity { fn to () -> RelationDef { Relation :: Products . def () } }
impl ActiveModelBehavior for ActiveModel { }

View File

@ -0,0 +1,29 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm :: entity :: prelude :: * ; use serde :: { Deserialize , Serialize } ;
# [derive (Copy , Clone , Default , Debug , DeriveEntity)] pub struct Entity ;
impl EntityName for Entity { fn table_name (& self) -> & str { "product_type_tax_rates" } }
# [derive (Clone , Debug , PartialEq , DeriveModel , DeriveActiveModel , Eq , Serialize , Deserialize)] pub struct Model { pub product_type_id : String , pub rate_id : String , pub created_at : DateTimeWithTimeZone , pub updated_at : DateTimeWithTimeZone , pub metadata : Option < Json > , }
# [derive (Copy , Clone , Debug , EnumIter , DeriveColumn)] pub enum Column { ProductTypeId , RateId , CreatedAt , UpdatedAt , Metadata , }
# [derive (Copy , Clone , Debug , EnumIter , DerivePrimaryKey)] pub enum PrimaryKey { ProductTypeId , RateId , }
impl PrimaryKeyTrait for PrimaryKey { type ValueType = (String , String) ; fn auto_increment () -> bool { false } }
# [derive (Copy , Clone , Debug , EnumIter)] pub enum Relation { ProductTypes , TaxRates , }
impl ColumnTrait for Column { type EntityName = Entity ; fn def (& self) -> ColumnDef { match self { Self :: ProductTypeId => ColumnType :: String (None) . def () , Self :: RateId => ColumnType :: String (None) . def () , Self :: CreatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: UpdatedAt => ColumnType :: TimestampWithTimeZone . def () , Self :: Metadata => ColumnType :: JsonBinary . def () . null () , } } }
impl RelationTrait for Relation { fn def (& self) -> RelationDef { match self { Self :: ProductTypes => Entity :: belongs_to (super :: product_types :: Entity) . from (Column :: ProductTypeId) . to (super :: product_types :: Column :: Id) . into () , Self :: TaxRates => Entity :: belongs_to (super :: tax_rates :: Entity) . from (Column :: RateId) . to (super :: tax_rates :: Column :: Id) . into () , } } }
impl Related < super :: product_types :: Entity > for Entity { fn to () -> RelationDef { Relation :: ProductTypes . def () } }
impl Related < super :: tax_rates :: Entity > for Entity { fn to () -> RelationDef { Relation :: TaxRates . def () } }
impl ActiveModelBehavior for ActiveModel { }

Some files were not shown because too many files have changed in this diff Show More