Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop projecting projects contributors #34

Merged
merged 2 commits into from
Nov 29, 2023
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
10 changes: 0 additions & 10 deletions api/src/domain/projectors/projections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ pub struct Projector {
project_repository: Arc<dyn ImmutableRepository<Project>>,
project_lead_repository: Arc<dyn ImmutableRepository<ProjectLead>>,
project_github_repos_repository: Arc<dyn ImmutableRepository<ProjectGithubRepo>>,
projects_contributors_repository: Arc<dyn ProjectsContributorRepository>,
projects_pending_contributors_repository: Arc<dyn ProjectsPendingContributorRepository>,
project_budgets_repository: Arc<dyn ImmutableRepository<ProjectsBudget>>,
applications_repository: Arc<dyn Repository<Application>>,
budget_repository: Arc<dyn Repository<Budget>>,
Expand Down Expand Up @@ -240,20 +238,12 @@ impl EventListener<Event> for Projector {
github_repo_id,
})?;
self.github_repo_index_repository.start_indexing(github_repo_id)?;
self.projects_contributors_repository
.refresh_project_contributor_list(&project_id)?;
self.projects_pending_contributors_repository
.refresh_project_pending_contributor_list(&project_id)?;
},
ProjectEvent::GithubRepoUnlinked {
id: project_id,
github_repo_id,
} => {
self.project_github_repos_repository.delete((project_id, github_repo_id))?;
self.projects_contributors_repository
.refresh_project_contributor_list(&project_id)?;
self.projects_pending_contributors_repository
.refresh_project_pending_contributor_list(&project_id)?;
},
ProjectEvent::Applied { .. } => (),
},
Expand Down
33 changes: 0 additions & 33 deletions api/src/models/crypto_usd_quotes copy.rs

This file was deleted.

6 changes: 0 additions & 6 deletions api/src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ mod project_github_repos;
mod project_leads;
mod projects;
mod projects_budgets;
mod projects_contributors;
mod projects_pending_contributors;
mod projects_rewarded_users;
mod projects_sponsors;
mod sponsors;
Expand Down Expand Up @@ -55,10 +53,6 @@ pub use project_github_repos::{ProjectGithubRepo, Repository as ProjectGithubRep
pub use project_leads::ProjectLead;
pub use projects::Project;
pub use projects_budgets::ProjectsBudget;
pub use projects_contributors::{ProjectsContributor, Repository as ProjectsContributorRepository};
pub use projects_pending_contributors::{
ProjectsPendingContributor, Repository as ProjectsPendingContributorRepository,
};
pub use projects_rewarded_users::{
ProjectsRewardedUser, Repository as ProjectsRewardedUserRepository,
};
Expand Down
20 changes: 0 additions & 20 deletions api/src/models/projects_contributors/mod.rs

This file was deleted.

64 changes: 0 additions & 64 deletions api/src/models/projects_contributors/repository.rs

This file was deleted.

20 changes: 0 additions & 20 deletions api/src/models/projects_pending_contributors/mod.rs

This file was deleted.

62 changes: 0 additions & 62 deletions api/src/models/projects_pending_contributors/repository.rs

This file was deleted.

2 changes: 0 additions & 2 deletions api/src/presentation/http/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ pub async fn bootstrap(config: Config) -> Result<Rocket<Build>> {
database.clone(),
database.clone(),
database.clone(),
database.clone(),
database.clone(),
);

let event_publisher = CompositePublisher::new(vec![
Expand Down
2 changes: 0 additions & 2 deletions api/tests/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,6 @@ impl<'a> Context<'a> {
database.client.clone(),
database.client.clone(),
database.client.clone(),
database.client.clone(),
database.client.clone(),
))),
]);

Expand Down
2 changes: 1 addition & 1 deletion api/tests/crypto_quotes_sync_it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<'a> Test<'a> {
info!("should_fetch_and_store_all_usd_prices");

// Given
self.context.database.client.insert_all(vec![
self.context.database.client.try_insert_all(vec![
CryptoUsdQuote {
currency: Currency::Eth,
price: Decimal::ZERO,
Expand Down
81 changes: 0 additions & 81 deletions api/tests/payment_it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ pub async fn payment_processing(docker: &'static Cli) {
test.project_lead_can_request_payments_in_eth()
.await
.expect("project_lead_can_request_payments_in_eth");
test.indexing_can_block_payment().await.expect("indexing_can_block_payment");
test.anyone_cannot_request_payments()
.await
.expect("anyone_cannot_request_payments");
Expand Down Expand Up @@ -317,86 +316,6 @@ impl<'a> Test<'a> {
Ok(())
}

async fn indexing_can_block_payment(&mut self) -> Result<()> {
info!("indexing_can_block_payment");

// Given
let project_id = ProjectId::new();
let budget_id = BudgetId::new();

self.context
.event_publisher
.publish_many(&[
ProjectEvent::Created { id: project_id }.into(),
ProjectEvent::BudgetLinked {
id: project_id,
budget_id,
currency: currencies::USD,
}
.into(),
BudgetEvent::Created {
id: budget_id,
currency: currencies::USD,
}
.into(),
BudgetEvent::Allocated {
id: budget_id,
amount: Decimal::from(1_000),
sponsor_id: None,
}
.into(),
])
.await?;

let request = json!({
"projectId": project_id,
"recipientId": 595505,
"amount": 10,
"currency": "USD",
"hoursWorked": 1,
"reason": {
"workItems": [{
"type": "PULL_REQUEST",
"id": "123456",
"repoId": 498695724,
"number": 111
},
{
"type": "PULL_REQUEST",
"id": "123456",
"repoId": 1181927,
"number": 111
}]
}
});

// When
let response = self
.context
.http_client
.post("/api/payments")
.header(ContentType::JSON)
.header(api_key_header())
.header(Header::new("x-hasura-role", "registered_user"))
.header(Header::new(
"Authorization",
format!("Bearer {}", jwt(Some(project_id.to_string()))),
))
.body(request.to_string())
.dispatch()
.await;

// Then
assert_eq!(
response.status(),
Status::InternalServerError,
"{}",
response.into_string().await.unwrap_or_default()
);

Ok(())
}

async fn anyone_cannot_request_payments(&mut self) -> Result<()> {
info!("anyone_cannot_request_payments");

Expand Down
1 change: 1 addition & 0 deletions api/tests/quote_sync_upon_budget_creation_it.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ impl<'a> Test<'a> {

// Given
let before = Utc::now().naive_utc();
ImmutableRepository::<CryptoUsdQuote>::clear(self.context.database.client.as_ref())?;

// When
self.context
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CREATE TYPE contribution_type AS enum('issue', 'pull_request', 'code_review');
CREATE TYPE contribution_type AS enum('ISSUE', 'PULL_REQUEST', 'CODE_REVIEW');


CREATE TABLE
Expand Down
Loading
Loading