Skip to content

Commit

Permalink
refactor(api-keys): extract es-entity-rs boilerplate (#3808)
Browse files Browse the repository at this point in the history
* chore: notifications boilerplate

* chore: es-entity-rs boilerplate

* chore(es-entity): add EntityError w deps

* chore: use es-entity in api-keys

* fix(api-keys): add es-entity dep to test
  • Loading branch information
bodymindarts authored Jan 10, 2024
1 parent daaa640 commit 9bc6385
Show file tree
Hide file tree
Showing 25 changed files with 726 additions and 17 deletions.
6 changes: 6 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ api-keys:
- core/api-keys/*
- flake.lock
- Cargo.lock

notifications:
- third-party/rust/*
- core/notifications/*
- flake.lock
- Cargo.lock
4 changes: 2 additions & 2 deletions .github/workflows/buck2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
${{ toJSON(github.event.pull_request.labels.*.name) }}
EOF
DEFAULT_LABELS=("dashboard" "consent" "pay" "core", "api-keys")
DEFAULT_LABELS=("dashboard" "consent" "pay" "core", "api-keys", "notfications")
LABELS=($(jq -r '.[]' < labels.json))
if [ ${#LABELS[@]} -eq 0 ]; then
LABELS=("${DEFAULT_LABELS[@]}")
Expand All @@ -37,7 +37,7 @@ jobs:
core)
ARGS+=" //core/api:test"
;;
api-keys)
api-keys|notifications)
ARGS+=" //core/$LABEL:test"
;;
esac
Expand Down
113 changes: 108 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ debug = true
resolver = "2"
members = [
"core/api-keys",
"core/notifications",
"lib/tracing-rs",
"lib/es-entity-rs",
]

[workspace.dependencies]
Expand All @@ -15,6 +17,7 @@ async-graphql-axum = "6.0.9"
axum = { version = "0.6.20", features = ["headers", "macros"] }
jsonwebtoken = "9.2.0"
clap = { version = "4.4", features = ["derive", "env"] }
derive_builder = "0.12.0"
serde = { version = "1.0.158", features = ["derive"] }
tokio = { version = "1.33.0", features = ["full"] }
reqwest = { version = "0.11.23", default-features = false, features = ["json", "rustls-tls"] }
Expand Down
2 changes: 2 additions & 0 deletions core/api-keys/BUCK
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ rust_library(
edition = "2021",
deps = [
"//lib/tracing-rs:tracing",
"//lib/es-entity-rs:es-entity",
"//third-party/rust:tokio",
"//third-party/rust:anyhow",
"//third-party/rust:async-graphql",
Expand Down Expand Up @@ -88,6 +89,7 @@ rust_test(
crate_root = "src/lib.rs",
deps = [
"//lib/tracing-rs:tracing",
"//lib/es-entity-rs:es-entity",
"//third-party/rust:tokio",
"//third-party/rust:anyhow",
"//third-party/rust:async-graphql",
Expand Down
1 change: 1 addition & 0 deletions core/api-keys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ fail-on-warnings = []

[dependencies]
tracing = { path = "../../lib/tracing-rs" }
es-entity = { path = "../../lib/es-entity-rs" }

anyhow = { workspace = true }
async-graphql = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions core/api-keys/src/identity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ use std::sync::Arc;

pub use error::*;

crate::entity_id! { IdentityApiKeyId }
crate::entity_id! { IdentityId }
es_entity::entity_id! { IdentityApiKeyId }
es_entity::entity_id! { IdentityId }

#[derive(Debug)]
pub struct IdentityApiKey {
Expand Down
1 change: 0 additions & 1 deletion core/api-keys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

pub mod app;
pub mod cli;
mod entity;
pub mod graphql;
pub mod identity;
pub mod scope;
Expand Down
Loading

0 comments on commit 9bc6385

Please sign in to comment.