Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
9 changes: 5 additions & 4 deletions src/graphql/discussion.rs → src/api/discussion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ use async_graphql::{
};

use crate::{
api,
database::{self, Database, DiscussionDbSchema, TryFromKeyValue},
github::discussions::ReactionContent,
outbound::discussions::ReactionContent,
};

scalar!(ReactionContent);
Expand Down Expand Up @@ -53,7 +54,7 @@ impl DiscussionQuery {
first,
last,
|after, before, first, last| async move {
super::load_connection(ctx, Database::discussions, after, before, first, last)
api::load_connection(ctx, Database::discussions, after, before, first, last)
},
)
.await
Expand All @@ -79,14 +80,14 @@ impl fmt::Display for Discussion {
#[cfg(test)]
mod tests {
use crate::{
api::TestSchema,
database::{
discussion::{
Answer, Category, Comment, Comments, Labels, Reaction, Reactions, Replies, Reply,
},
DiscussionDbSchema,
},
github::discussions::ReactionContent,
graphql::TestSchema,
outbound::discussions::ReactionContent,
};

#[tokio::test]
Expand Down
9 changes: 5 additions & 4 deletions src/graphql/issue.rs → src/api/issue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@ use async_graphql::{
use serde::{Deserialize, Serialize};

use crate::{
api,
api::DateTimeUtc,
database::{self, Database, TryFromKeyValue},
github::{
outbound::{
issues::{IssueState, PullRequestState},
GitHubIssue,
},
graphql::DateTimeUtc,
};

scalar!(IssueState);
Expand Down Expand Up @@ -231,7 +232,7 @@ impl IssueQuery {
first,
last,
|after, before, first, last| async move {
super::load_connection(ctx, Database::issues, after, before, first, last)
api::load_connection(ctx, Database::issues, after, before, first, last)
},
)
.await
Expand All @@ -240,7 +241,7 @@ impl IssueQuery {

#[cfg(test)]
mod tests {
use crate::{github::GitHubIssue, graphql::TestSchema};
use crate::{api::TestSchema, outbound::GitHubIssue};

fn create_issues(n: usize) -> Vec<GitHubIssue> {
(1..=n)
Expand Down
6 changes: 3 additions & 3 deletions src/graphql/issue_stat.rs → src/api/issue_stat.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use async_graphql::{Context, InputObject, Object, Result, SimpleObject};

use crate::{
api::{issue::Issue, DateTimeUtc},
database::Iter,
github::issues::IssueState,
graphql::{issue::Issue, DateTimeUtc},
outbound::issues::IssueState,
Database,
};

Expand Down Expand Up @@ -80,7 +80,7 @@ impl IssueStatQuery {
mod tests {
use jiff::Timestamp;

use crate::{github::GitHubIssue, graphql::TestSchema};
use crate::{api::TestSchema, outbound::GitHubIssue};

fn create_issues(n: usize) -> Vec<GitHubIssue> {
(0..n)
Expand Down
9 changes: 6 additions & 3 deletions src/graphql/pull_request.rs → src/api/pull_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use async_graphql::{
Context, Object, Result, SimpleObject,
};

use crate::database::{self, Database, TryFromKeyValue};
use crate::{
api,
database::{self, Database, TryFromKeyValue},
};

#[derive(SimpleObject)]
pub(crate) struct PullRequest {
Expand Down Expand Up @@ -61,7 +64,7 @@ impl PullRequestQuery {
first,
last,
|after, before, first, last| async move {
super::load_connection(ctx, Database::pull_requests, after, before, first, last)
api::load_connection(ctx, Database::pull_requests, after, before, first, last)
},
)
.await
Expand All @@ -70,7 +73,7 @@ impl PullRequestQuery {

#[cfg(test)]
mod tests {
use crate::{github::GitHubPullRequests, graphql::TestSchema};
use crate::{api::TestSchema, outbound::GitHubPullRequests};

#[tokio::test]
async fn pull_requests_empty() {
Expand Down
4 changes: 2 additions & 2 deletions src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ pub mod discussion;
pub(crate) use discussion::DiscussionDbSchema;

use crate::{
github::{GitHubIssue, GitHubPullRequests},
graphql::{issue::Issue, pull_request::PullRequest},
api::{issue::Issue, pull_request::PullRequest},
outbound::{GitHubIssue, GitHubPullRequests},
};

const ISSUE_TREE_NAME: &str = "issues";
Expand Down
4 changes: 2 additions & 2 deletions src/database/discussion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ use anyhow::Result;
use serde::{Deserialize, Serialize};

use super::{Database, Iter};
use crate::github::discussions::{
use crate::api::Discussion;
use crate::outbound::discussions::{
DiscussionsRepositoryDiscussionsNodes, DiscussionsRepositoryDiscussionsNodesAnswer,
DiscussionsRepositoryDiscussionsNodesAnswerAuthor,
DiscussionsRepositoryDiscussionsNodesAnswerReplies,
Expand All @@ -18,7 +19,6 @@ use crate::github::discussions::{
DiscussionsRepositoryDiscussionsNodesLabels, DiscussionsRepositoryDiscussionsNodesReactions,
ReactionContent,
};
use crate::graphql::Discussion;

#[derive(Debug, Serialize, Deserialize)]
pub struct DiscussionDbSchema {
Expand Down
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
mod api;
mod checkout;
mod database;
mod github;
mod google;
mod graphql;
mod outbound;
mod settings;
mod web;

Expand Down Expand Up @@ -39,7 +39,7 @@ async fn main() -> Result<()> {

// Fetches issues and pull requests from GitHub every hour, and stores them
// in the database.
task::spawn(github::fetch_periodically(
task::spawn(outbound::fetch_periodically(
Arc::clone(&repositories),
settings.certification.token,
time::Duration::from_secs(ONE_HOUR),
Expand All @@ -53,7 +53,7 @@ async fn main() -> Result<()> {
settings.certification.ssh,
));

let schema = graphql::schema(database);
let schema = api::schema(database);

web::serve(schema, settings.web.address, &args.key, &args.cert).await;
Ok(())
Expand Down
14 changes: 7 additions & 7 deletions src/github.rs → src/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tracing::error;

use crate::{
database::Database,
github::{
outbound::{
issues::{
IssueState, IssuesRepositoryIssuesNodesAuthor::User as IssueAuthor,
IssuesRepositoryIssuesNodesClosedByPullRequestsReferencesEdgesNodeAuthor::User as PullRequestRefAuthor,
Expand Down Expand Up @@ -41,23 +41,23 @@ type URI = String;

#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/github/schema.graphql",
query_path = "src/github/issues.graphql",
schema_path = "src/outbound/graphql/schema.graphql",
query_path = "src/outbound/graphql/issues.graphql",
response_derives = "Debug, Clone"
)]
pub(crate) struct Issues;

#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/github/schema.graphql",
query_path = "src/github/pull_requests.graphql"
schema_path = "src/outbound/graphql/schema.graphql",
query_path = "src/outbound/graphql/pull_requests.graphql"
)]
struct PullRequests;

#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/github/schema.graphql",
query_path = "src/github/discussions.graphql",
schema_path = "src/outbound/graphql/schema.graphql",
query_path = "src/outbound/graphql/discussions.graphql",
response_derives = "Debug"
)]
pub(crate) struct Discussions;
Expand Down
2 changes: 1 addition & 1 deletion src/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{convert::Infallible, net::SocketAddr, path::Path};
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig};
use warp::{http::Response as HttpResponse, Filter};

use crate::graphql::Schema;
use crate::api::Schema;

pub(super) async fn serve(schema: Schema, socketaddr: SocketAddr, key: &Path, cert: &Path) {
let filter = async_graphql_warp::graphql(schema).and_then(
Expand Down
Loading