-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from dadleyy/table-admin
table admin background
- Loading branch information
Showing
13 changed files
with
121 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "bankah" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "stickbot" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
edition = "2018" | ||
|
||
[lib] | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use bankah::jobs::{JobError, TableAdminJob, TableJobOutput}; | ||
|
||
use crate::db::doc; | ||
use crate::Services; | ||
|
||
pub async fn reindex<'a>(services: &Services, job: &TableAdminJob) -> Result<TableJobOutput, JobError> { | ||
log::info!("attempting to reindex table populations - {:?}", job); | ||
let tables = services.tables(); | ||
let pipeline = vec![ | ||
doc! { "$project": { "id": 1, "name": 1, "seats": { "$objectToArray": "$seats" } } }, | ||
doc! { "$project": { "id": 1, "name": 1, "population": { | ||
"$map": { | ||
"input": "$seats", | ||
"as": "seat", | ||
"in": ["$$seat.k", "$$seat.v.nickname"], | ||
}, | ||
} } }, | ||
doc! { "$merge": { "into": crate::constants::MONGO_DB_TABLE_LIST_COLLECTION_NAME } }, | ||
]; | ||
tables.aggregate(pipeline, None).await.map_err(|error| { | ||
log::warn!("unable to perform aggregate - {}", error); | ||
JobError::Retryable | ||
})?; | ||
Ok(TableJobOutput::AdminOk) | ||
} |
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,5 +1,6 @@ | ||
mod bets; | ||
mod rolls; | ||
|
||
pub mod admin; | ||
pub use bets::bet; | ||
pub use rolls::roll; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "twowaiyo" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
edition = "2018" | ||
|
||
[lib] | ||
|