-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
462a545
commit 84b811e
Showing
20 changed files
with
358 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use actix_web::{get, web, Error, HttpResponse, Scope}; | ||
use serde::{Deserialize, Serialize}; | ||
use trackscape_discord_shared::database::BotMongoDb; | ||
use web::Data; | ||
|
||
#[derive(Deserialize, Serialize)] | ||
struct ClanViewModel { | ||
id: String, | ||
name: String, | ||
} | ||
|
||
#[get("/list")] | ||
async fn list_clans(mongodb: Data<BotMongoDb>) -> Result<HttpResponse, Error> { | ||
let result = mongodb.guilds.list_clans().await; | ||
|
||
match result { | ||
Ok(clans) => { | ||
let view_models: Vec<ClanViewModel> = clans | ||
.into_iter() | ||
.map(|clan| ClanViewModel { | ||
id: clan.id.to_string(), | ||
name: clan.clan_name.unwrap(), | ||
}) | ||
.collect(); | ||
Ok(HttpResponse::Ok().json(view_models)) | ||
} | ||
Err(_) => Ok(HttpResponse::InternalServerError().body("Failed to list clans.")), | ||
} | ||
} | ||
|
||
pub fn clan_controller() -> Scope { | ||
web::scope("/clans").service(list_clans) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod bot_info_controller; | ||
pub mod chat_controller; | ||
pub mod clan_controller; | ||
pub mod drop_log_controller; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
trackscape-discord-ui/src/components/__tests__/HelloWorld.spec.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.