Skip to content

Commit 3990ad3

Browse files
committed
Merge branch 'main' of github.com:HushNet/HushNet-Backend
2 parents 4820198 + 234a6fd commit 3990ad3

3 files changed

Lines changed: 14 additions & 18 deletions

File tree

src/controllers/device_controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub async fn get_devices_for_user(
3333
Ok(data) => (StatusCode::OK, Json(data)).into_response(),
3434
Err(e) => {
3535
eprintln!("Error when fetching devices {}", e);
36-
(
36+
(
3737
StatusCode::INTERNAL_SERVER_ERROR,
3838
Json(json!({
3939
"error": "Internal server error"

src/controllers/messages_controller.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,16 @@ pub async fn send_message(
2121
let from_user_id: Uuid = device.user_id;
2222

2323
match insert_message(&state.pool, device.id, from_user_id, msg).await {
24-
Ok(()) => {
25-
(
26-
StatusCode::OK,
27-
Json(json!({
28-
"success": "true"
29-
})),
30-
)
31-
.into_response()
32-
}
24+
Ok(()) => (
25+
StatusCode::OK,
26+
Json(json!({
27+
"success": "true"
28+
})),
29+
)
30+
.into_response(),
3331
Err(e) => {
3432
eprintln!("Error when inserting message {}", e);
35-
(
33+
(
3634
StatusCode::INTERNAL_SERVER_ERROR,
3735
Json(json!({"error": "Internal server error"})),
3836
)
@@ -46,10 +44,10 @@ pub async fn get_pending_messages(
4644
AuthenticatedDevice(device): AuthenticatedDevice,
4745
) -> impl IntoResponse {
4846
match fetch_pending_messages(&state.pool, AuthenticatedDevice(device)).await {
49-
Ok(messages) => (StatusCode::OK, Json(messages)).into_response(),
47+
Ok(messages) => (StatusCode::OK, Json(messages)).into_response(),
5048
Err(e) => {
5149
eprintln!("Error when fetching pending messages {}", e);
52-
(
50+
(
5351
StatusCode::INTERNAL_SERVER_ERROR,
5452
Json(json!({"error": "Internal server error"})),
5553
)

src/controllers/user_controller.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,10 @@ pub async fn login_user(
8383
.into_response();
8484
}
8585
match user_repository::find_user_by_pubkey(&state.pool, &payload.identity_pubkey).await {
86-
Ok(user) => {
87-
(StatusCode::OK, Json(json!(user))).into_response()
88-
}
86+
Ok(user) => (StatusCode::OK, Json(json!(user))).into_response(),
8987
Err(e) => {
9088
eprintln!("error : {}", e);
91-
(
89+
(
9290
StatusCode::UNAUTHORIZED,
9391
Json(json!({"error": "Unauthorized"})),
9492
)
@@ -105,7 +103,7 @@ pub async fn get_user_by_id(
105103
Ok(data) => (StatusCode::OK, Json(data)).into_response(),
106104
Err(e) => {
107105
eprintln!("Error when fetching devices {}", e);
108-
(
106+
(
109107
StatusCode::INTERNAL_SERVER_ERROR,
110108
Json(json!({
111109
"error": "Internal server error"

0 commit comments

Comments
 (0)