Skip to content

Commit

Permalink
. update to modql 0.4.0-rc.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremychone committed Apr 19, 2024
1 parent 3515abd commit e999801
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 28 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ members = [
# -- Serde
serde_with = {version = "3", features = ["time_0_3"] }
# -- Data
modql = { version = "0.4.0-rc", features = ["with-sea-query"]}
# Note: we lock modql version during rcs
modql = { version = "=0.4.0-rc.4", features = ["with-sea-query"]}
# -- JSON-RPC
# Lock to specific version during 0.1.x
rpc-router = { version = "=0.1.3" }
# -- Others
# NOTE: time is set as `<0.3.35` to match sea-query-binder version 0.6.0-rc.2 (see https://github.com/SeaQL/sea-query/issues/772)
# will set back to `0.3` as soon as sea-query-binder 0.6.0-rc is fix
time = {version = "<0.3.35", features = ["formatting", "parsing", "serde"]}
derive_more = {version = "1.0.0-beta", features = ["from", "display"] }
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
More info at: https://rust10x.com/web-app
Discord: https://discord.gg/XuKWrNGKpC

# Note last commit with `modql 0.4.0-rc.4`

- There is a small change in the `SeaField::new(iden, value)` where the value is now `impl Into<SimpleExpr>`.
- `so change:` `SeaField::new(UserIden::Pwd, pwd.into())`
- ` to:` `SeaField::new(UserIden::Pwd, pwd)`

You can find this change in the `. update to modql 0.4.0-rc.4`

# IMPORTANT NOTE on E06 - 2024-01-23 BIG UPDATE

This update ([GitHub tag: E06](https://github.com/rust10x/rust-web-app/releases/tag/E06)) is significant in many respects:
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/lib-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ modql = { workspace = true }
tracing = "0.1"
# -- Others
uuid = {version = "1", features = ["v4","fast-rng",]}
time = {version = "0.3", features = ["formatting", "parsing", "serde"]}
time = { workspace = true }
derive_more = { workspace = true }

# -- Feature: with-rpc
Expand Down
26 changes: 7 additions & 19 deletions crates/libs/lib-core/src/model/base/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ where
MC: DbBmc,
{
if MC::has_owner_id() {
fields.push(SeaField::new(
CommonIden::OwnerId.into_iden(),
user_id.into(),
));
fields.push(SeaField::new(CommonIden::OwnerId.into_iden(), user_id));
}
if MC::has_timestamps() {
add_timestamps_for_create(fields, user_id);
Expand All @@ -33,26 +30,17 @@ where
/// (e.g., cid, ctime, and mid, mtime will be updated with the same values)
fn add_timestamps_for_create(fields: &mut SeaFields, user_id: i64) {
let now = now_utc();
fields.push(SeaField::new(
TimestampIden::Cid.into_iden(),
user_id.into(),
));
fields.push(SeaField::new(TimestampIden::Ctime.into_iden(), now.into()));
fields.push(SeaField::new(TimestampIden::Cid, user_id));
fields.push(SeaField::new(TimestampIden::Ctime, now));

fields.push(SeaField::new(
TimestampIden::Mid.into_iden(),
user_id.into(),
));
fields.push(SeaField::new(TimestampIden::Mtime.into_iden(), now.into()));
fields.push(SeaField::new(TimestampIden::Mid, user_id));
fields.push(SeaField::new(TimestampIden::Mtime, now));
}

/// Update the timestamps info only for update.
/// (.e.g., only mid, mtime will be udpated)
fn add_timestamps_for_update(fields: &mut SeaFields, user_id: i64) {
let now = now_utc();
fields.push(SeaField::new(
TimestampIden::Mid.into_iden(),
user_id.into(),
));
fields.push(SeaField::new(TimestampIden::Mtime.into_iden(), now.into()));
fields.push(SeaField::new(TimestampIden::Mid, user_id));
fields.push(SeaField::new(TimestampIden::Mtime, now));
}
3 changes: 1 addition & 2 deletions crates/libs/lib-core/src/model/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ impl UserBmc {
.await?;

// -- Prep the data
let mut fields =
SeaFields::new(vec![SeaField::new(UserIden::Pwd, pwd.into())]);
let mut fields = SeaFields::new(vec![SeaField::new(UserIden::Pwd, pwd)]);
prep_fields_for_update::<Self>(&mut fields, ctx.user_id());

// -- Build query
Expand Down
4 changes: 2 additions & 2 deletions crates/libs/lib-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ doctest = false
workspace = true

[dependencies]
base64 = "0.21"
time = {version = "0.3", features = ["formatting", "parsing", "serde"]}
base64 = "0.22"
time = { workspace = true }
5 changes: 2 additions & 3 deletions crates/services/web-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# -- Rpc
rpc-router = { workspace = true }
# -- Others
time = "0.3"
time = { workspace = true }
uuid = {version = "1", features = ["v4","fast-rng",]}
strum_macros = "0.26"
derive_more = { workspace = true }

[dev-dependencies]
httpc-test = "0.1"
time = "0.3"
httpc-test = "0.1"

0 comments on commit e999801

Please sign in to comment.