Skip to content

Commit

Permalink
chore: update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoBorai committed Jun 2, 2024
1 parent 5e0897a commit 742a113
Show file tree
Hide file tree
Showing 23 changed files with 608 additions and 490 deletions.
906 changes: 516 additions & 390 deletions Cargo.lock

Large diffs are not rendered by default.

38 changes: 23 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,28 @@ default-members = ["crates/cli"]
resolver = "2"

[workspace.dependencies]
anyhow = "1.0.75"
async-graphql = { version = "6.0.7", features = ["chrono", "decimal", "tracing"] }
async-trait = "0.1.73"
chrono = { version = "0.4.26" }
anyhow = "1.0.86"
async-graphql = { version = "7.0.5", features = ["chrono", "decimal", "tracing"] }
async-graphql-axum = "7.0.5"
async-trait = "0.1.80"
axum = "0.7.5"
base64 = "0.22.1"
chrono = "0.4.38"
dotenv = "0.15.0"
pxid = { version = "0.3", features = ["async-graphql"] }
rust-argon2 = "1"
sea-orm = "0.12.1"
sea-orm-cli = { version = "0.12.3", default-features = false }
sea-orm-migration = "0.12.1"
serde = { version = "1.0.188" }
serde_json = { version = "1.0.104" }
fake = "2.9.2"
jsonwebtoken = "9.3"
pxid = { version = "0.5", features = ["async-graphql"] }
rand = "0.8.5"
rust-argon2 = "2.1.0"
rust-s3 = { version = "0.33.0", features = ["tokio-rustls-tls", "fail-on-err"], default-features = false }
sea-orm = "0.12"
sea-orm-cli = { version = "0.12", default-features = false }
sea-orm-migration = "0.12"
serde = "1.0"
serde_json = "1.0"
thiserror = "1.0.38"
tokio = { version = "1.33.0", features = ["rt", "macros"] }
tracing = "0.1.37"
tracing-subscriber = "0.3.15"
url = { version = "2.4.1", features = ["serde"] }
tokio = { version = "1.38", features = ["rt", "macros"] }
tracing = "0.1"
tracing-subscriber = "0.3"
tower-http = { version = "0.5", features = ["cors"] }
url = { version = "2.5", features = ["serde"] }
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2023 Whizzes Contributors
Copyright 2024 TownHall HQ Contributors on GitHub

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div align="center">
<span style="font-size: 64px;">🏖️</span>
<h1 align="center">townhall</h1>
<h1 align="center">TownHall</h1>
<p align="center">
Decentralized Social Platform powered by Rust and Whizzes Contributors
</p>
Expand All @@ -9,13 +9,13 @@
<div align="center">

[![Discord](https://img.shields.io/discord/1011702194925490186?color=blue&label=discord&logo=discord)](https://discord.gg/yde6mcgs2C)
![Build](https://github.com/whizzes/townhall/workflows/build/badge.svg)
![Clippy](https://github.com/whizzes/townhall/workflows/clippy/badge.svg)
![Formatter](https://github.com/whizzes/townhall/workflows/fmt/badge.svg)
![Build](https://github.com/TownHall-HQ/TownHall/workflows/build/badge.svg)
![Clippy](https://github.com/TownHall-HQ/TownHall/workflows/clippy/badge.svg)
![Formatter](https://github.com/TownHall-HQ/TownHall/workflows/fmt/badge.svg)

</div>

### Collab Strategy
### Collab Strategy

townhall is collaborative project for novice-to-intermediate Rust (backend) and JS/TS (frontend) web developers. We’re learning-by-doing together, in the making of a community platform modeled after the likes of Discord (chat) and Discourse (forum).

Expand Down Expand Up @@ -64,7 +64,7 @@ the services.

<div align="center">

![softarq](https://github.com/whizzes/townhall/assets/34756077/86abfb8d-8e96-4e93-9677-4e0864f53da6)
![softarq](https://github.com/TownHall-HQ/TownHall/assets/34756077/86abfb8d-8e96-4e93-9677-4e0864f53da6)

</div>

Expand Down Expand Up @@ -128,7 +128,7 @@ Teardown containers using `just undev`.
</sub>
</a>
<br />
<a href="https://github.com/whizzes/townhall/commits?author=EstebanBorai" title="Code">💻</a>
<a href="https://github.com/TownHall-HQ/TownHall/commits?author=EstebanBorai" title="Code">💻</a>
</td>
<td align="center" valign="top" width="14.28%">
<a href="https://github.com/Michael-Liendo">
Expand All @@ -139,7 +139,7 @@ Teardown containers using `just undev`.
</sub>
</a>
<br />
<a href="https://github.com/whizzes/townhall/commits?author=Michael-Liendo" title="Code">💻</a>
<a href="https://github.com/TownHall-HQ/TownHall/commits?author=Michael-Liendo" title="Code">💻</a>
</td>
<td align="center" valign="top" width="14.28%">
<a href="https://github.com/Dave136">
Expand All @@ -150,7 +150,7 @@ Teardown containers using `just undev`.
</sub>
</a>
<br />
<a href="https://github.com/whizzes/townhall/commits?author=Dave136" title="Code">💻</a>
<a href="https://github.com/TownHall-HQ/TownHall/commits?author=Dave136" title="Code">💻</a>
</td>
<td align="center" valign="top" width="14.28%">
<a href="https://github.com/CudiLala">
Expand All @@ -161,7 +161,7 @@ Teardown containers using `just undev`.
</sub>
</a>
<br />
<a href="https://github.com/whizzes/townhall/commits?author=CudiLala" title="Code">💻</a>
<a href="https://github.com/TownHall-HQ/TownHall/commits?author=CudiLala" title="Code">💻</a>
</td>
<td align="center" valign="top" width="14.28%">
<a href="https://github.com/PalyZambrano">
Expand All @@ -172,7 +172,7 @@ Teardown containers using `just undev`.
</sub>
</a>
<br />
<a href="https://github.com/whizzes/townhall/commits?author=PalyZambrano" title="Code">💻</a>
<a href="https://github.com/TownHall-HQ/TownHall/commits?author=PalyZambrano" title="Code">💻</a>
</td>
<td align="center" valign="top" width="14.28%">
<a href="https://github.com/Phosphorus-M">
Expand All @@ -183,7 +183,7 @@ Teardown containers using `just undev`.
</sub>
</a>
<br />
<a href="https://github.com/whizzes/townhall/commits?author=Phosphorus-M" title="Code">💻</a>
<a href="https://github.com/TownHall-HQ/TownHall/commits?author=Phosphorus-M" title="Code">💻</a>
</td>
<td align="center" valign="top" width="14.28%">
<a href="https://github.com/dararod">
Expand All @@ -194,7 +194,7 @@ Teardown containers using `just undev`.
</sub>
</a>
<br />
<a href="https://github.com/whizzes/townhall/commits?author=dararod" title="Code">💻</a>
<a href="https://github.com/TownHall-HQ/TownHall/commits?author=dararod" title="Code">💻</a>
</td>
</tr>
</tbody>
Expand Down
6 changes: 3 additions & 3 deletions client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
<div align="center">

[![Discord](https://img.shields.io/discord/1011702194925490186?color=blue&label=discord&logo=discord)](https://discord.gg/yde6mcgs2C)
![Build](https://github.com/whizzes/townhall/workflows/build/badge.svg)
![Tests](https://github.com/whizzes/townhall/workflows/test/badge.svg)
![Lint](https://github.com/whizzes/townhall/workflows/lint/badge.svg)
![Build](https://github.com/TownHall-HQ/TownHall/workflows/build/badge.svg)
![Tests](https://github.com/TownHall-HQ/TownHall/workflows/test/badge.svg)
![Lint](https://github.com/TownHall-HQ/TownHall/workflows/lint/badge.svg)

</div>

Expand Down
2 changes: 2 additions & 0 deletions crates/cli/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ impl DatabseSub {
model_extra_derives: Vec::default(),
model_extra_attributes: Vec::default(),
seaography: false,
enum_extra_derives: Vec::default(),
enum_extra_attributes: Vec::default(),
};

tracing::info!("Generating Database Entities");
Expand Down
18 changes: 8 additions & 10 deletions crates/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,23 @@ name = "libserver"
path = "src/lib.rs"

[dependencies]
async-graphql-axum = "6.0.6"
axum = "0.6.20"
base64 = "0.21.2"
jsonwebtoken = "8.3"
rand = "0.8.5"
rust-s3 = { version = "0.33.0", features = ["tokio-rustls-tls", "fail-on-err"], default-features = false }
tower-http = { version = "0.4.1", features = ["cors"] }

# Workspace Dependencies
anyhow = { workspace = true }
async-graphql = { workspace = true }
async-graphql-axum = { workspace = true }
async-trait = { workspace = true }
axum = { workspace = true }
base64 = { workspace = true }
chrono = { workspace = true }
dotenv = { workspace = true }
pxid = { workspace = true, features = ["serde"] }
jsonwebtoken = { workspace = true }
pxid = { workspace = true, features = ["async-graphql", "serde"] }
rand = { workspace = true }
rust-argon2 = { workspace = true }
rust-s3 = { workspace = true, features = ["tokio-rustls-tls", "fail-on-err"], default-features = false }
serde = { workspace = true, features = ["derive"] }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["rt", "rt-multi-thread", "macros"] }
tower-http = { workspace = true, features = ["cors"] }
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
url = { workspace = true }
Expand Down
2 changes: 0 additions & 2 deletions crates/server/src/graphql/guard.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use async_graphql::{Context, Error, ErrorExtensions, Guard, Result};
use async_trait::async_trait;

use crate::context::SharedContext;
use crate::services::auth::Token;
Expand All @@ -18,7 +17,6 @@ impl AuthenticationGuard {
}
}

#[async_trait]
impl Guard for AuthenticationGuard {
async fn check(&self, ctx: &Context<'_>) -> Result<()> {
let context = ctx.data_unchecked::<SharedContext>();
Expand Down
4 changes: 2 additions & 2 deletions crates/server/src/graphql/modules/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod post;
pub mod user;

use async_graphql::{MergedObject, SimpleObject};
use pxid::graphql::Pxid;
use pxid::Pxid;
use serde::{Deserialize, Serialize};

use self::auth::mutation::AuthMutationRoot;
Expand All @@ -28,7 +28,7 @@ pub struct Image {
impl From<townhall::image::model::Image> for Image {
fn from(value: townhall::image::model::Image) -> Self {
Image {
id: Pxid::from(value.id),
id: value.id,
url: value.url,
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_graphql::{Context, InputObject, Result, SimpleObject};
use pxid::graphql::Pxid;
use pxid::Pxid;
use serde::{Deserialize, Serialize};

use townhall::post::service::CreatePostDto;
Expand Down Expand Up @@ -27,7 +27,7 @@ impl PostCreate {
let token = ctx.data_unchecked::<Token>();

let claims = context.services.auth.verify_token(token).unwrap();
let parent_id = input.parent_id.map(|id| id.into_inner());
let parent_id = input.parent_id;
let dto = CreatePostDto {
author_id: claims.uid,
parent_id,
Expand Down
2 changes: 1 addition & 1 deletion crates/server/src/graphql/modules/post/query/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod posts;

use async_graphql::{Context, Object, Result};
use pxid::graphql::Pxid;
use pxid::Pxid;

use self::posts::{Posts, PostsConnection};

Expand Down
9 changes: 2 additions & 7 deletions crates/server/src/graphql/modules/post/query/posts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_graphql::connection::{query, Connection, Edge, EmptyFields};
use async_graphql::{Context, Result};
use pxid::graphql::Pxid;
use pxid::Pxid;

use townhall::shared::pagination::Pagination;

Expand Down Expand Up @@ -33,12 +33,7 @@ impl Posts {
before: Option<Pxid>,
first: Option<usize>,
last: Option<usize>| async move {
let pagination = Pagination::new(
after.map(|id| id.into_inner()),
before.map(|id| id.into_inner()),
first,
last,
)?;
let pagination = Pagination::new(after, before, first, last)?;
let query_set = context.services.post.list(Some(pagination), None).await?;
let total_count = query_set.count();
let posts = query_set.records();
Expand Down
10 changes: 5 additions & 5 deletions crates/server/src/graphql/modules/post/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use async_graphql::{ComplexObject, Context, Enum, SimpleObject};
use chrono::{DateTime, Utc};
use pxid::graphql::Pxid;
use pxid::Pxid;
use serde::{Deserialize, Serialize};

use townhall::shared::pagination::Pagination;
Expand Down Expand Up @@ -46,7 +46,7 @@ impl Post {
.list(
Some(Pagination::first()),
Some(UserFilter {
id: Some(self.author_id.into_inner()),
id: Some(self.author_id),
..Default::default()
}),
)
Expand All @@ -61,9 +61,9 @@ impl Post {
impl From<townhall::post::model::Post> for Post {
fn from(value: townhall::post::model::Post) -> Self {
Post {
id: value.id.into(),
author_id: value.author_id.into(),
parent_id: value.parent_id.map(|id| id.into()),
id: value.id,
author_id: value.author_id,
parent_id: value.parent_id,
head: value.head,
title: value.title,
content: value.content,
Expand Down
2 changes: 1 addition & 1 deletion crates/server/src/graphql/modules/user/mutation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mod user_unfollow;
mod user_update;

use async_graphql::{Context, Object, Result, Upload};
use pxid::graphql::Pxid;
use pxid::Pxid;

use crate::graphql::guard::AuthenticationGuard;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_graphql::{Context, Result, SimpleObject};
use pxid::graphql::Pxid;
use pxid::Pxid;
use serde::{Deserialize, Serialize};

use townhall::user::service::FollowPeers;
Expand All @@ -22,8 +22,8 @@ impl UserFollow {
.services
.user
.follow(FollowPeers {
followee_id,
follower_id: user_id,
followee_id: followee_id.into_inner(),
})
.await
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use async_graphql::{Context, Result, SimpleObject};
use pxid::graphql::Pxid;
use pxid::Pxid;
use serde::{Deserialize, Serialize};

use townhall::user::service::FollowPeers;
Expand All @@ -23,7 +23,7 @@ impl UserUnfollow {
.user
.unfollow(FollowPeers {
follower_id: user_id,
followee_id: followee_id.into_inner(),
followee_id,
})
.await
{
Expand Down
2 changes: 1 addition & 1 deletion crates/server/src/graphql/modules/user/query/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod users;

use async_graphql::{Context, Object, Result};
use pxid::graphql::Pxid;
use pxid::Pxid;

use self::users::{UserFilterInput, Users, UsersConnection};

Expand Down
11 changes: 3 additions & 8 deletions crates/server/src/graphql/modules/user/query/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::str::FromStr;

use async_graphql::connection::{query, Connection, Edge, EmptyFields};
use async_graphql::{Context, InputObject, Result};
use pxid::graphql::Pxid;
use pxid::Pxid;

use townhall::shared::pagination::Pagination;
use townhall::user::model::{Email, Username};
Expand All @@ -24,7 +24,7 @@ pub struct UserFilterInput {
impl From<UserFilterInput> for UserFilter {
fn from(value: UserFilterInput) -> Self {
UserFilter {
id: value.id.map(|id| id.into_inner()),
id: value.id,
email: value.email.and_then(|s| Email::from_str(&s).ok()),
username: value.username.and_then(|s| Username::from_str(&s).ok()),
}
Expand Down Expand Up @@ -55,12 +55,7 @@ impl Users {
before: Option<Pxid>,
first: Option<usize>,
last: Option<usize>| async move {
let pagination = Pagination::new(
after.map(|id| id.into_inner()),
before.map(|id| id.into_inner()),
first,
last,
)?;
let pagination = Pagination::new(after, before, first, last)?;
let query_set = context
.services
.user
Expand Down
Loading

0 comments on commit 742a113

Please sign in to comment.