Skip to content

Commit

Permalink
Setup diesel initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ndelvalle committed Sep 8, 2024
1 parent c08de40 commit d47bc85
Show file tree
Hide file tree
Showing 21 changed files with 476 additions and 266 deletions.
223 changes: 220 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tower-http = { version = "0.4.4", features = [
"sensitive-headers",
"cors",
] }
chrono = "0.4.38"
chrono = { version = "0.4", features = ["serde"] }
async-trait = "0.1.81"
# Investigate if wither::bson can be used instead and activate this feature.
bson = { version = "2.10.0", features = ["serde_with", "chrono-0_4"] }
Expand All @@ -35,6 +35,8 @@ bcrypt = "0.15.1"
validator = { version = "0.18.1", features = ["derive"] }
mime = "0.3.17"
bytes = "1.6.0"
diesel = { version = "2.1", features = ["chrono"] }
diesel-async = { version = "0.5", features = ["postgres", "deadpool"] }

[dev-dependencies]
assert-json-diff = "2.0.2"
Expand Down
6 changes: 1 addition & 5 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
{
"environment": "development",

"server": {
"port": 8080
},

"database": {
"uri": "mongodb://localhost:27017",
"uri": "postgresql://localhost:5432",
"name": "rustapi"
},

"auth": {
"secret": "secret"
},

"logger": {
"level": "debug"
}
Expand Down
9 changes: 9 additions & 0 deletions diesel.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# For documentation on how to configure this file,
# see https://diesel.rs/guides/configuring-diesel-cli

[print_schema]
file = "src/schema.rs"
custom_type_derives = ["diesel::query_builder::QueryId", "Clone"]

[migrations_directory]
dir = "/Users/ndelvalle/Code/ndelvalle/rustapi/migrations"
Empty file added migrations/.keep
Empty file.
Loading

0 comments on commit d47bc85

Please sign in to comment.