Skip to content

Commit 9eb8c82

Browse files
committed
Revert "feat: adding gc endpoint"
This reverts commit 9d0f3ac. (cherry picked from commit 05eb19a)
1 parent 7d629a5 commit 9eb8c82

File tree

3 files changed

+1
-51
lines changed

3 files changed

+1
-51
lines changed

modules/fundamental/src/purl/endpoints/mod.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
use actix_web::{HttpResponse, Responder, get, web};
1010
use sea_orm::prelude::Uuid;
1111
use std::str::FromStr;
12-
use trustify_auth::{DeleteSbom, ReadSbom, authorizer::Require};
12+
use trustify_auth::{ReadSbom, authorizer::Require};
1313
use trustify_common::{
1414
db::Database, db::query::Query, id::IdError, model::Paginated, model::PaginatedResults,
1515
purl::Purl,
@@ -25,7 +25,6 @@ pub fn configure(config: &mut utoipa_actix_web::service_config::ServiceConfig, d
2525
.app_data(web::Data::new(purl_service))
2626
.service(base::get_base_purl)
2727
.service(base::all_base_purls)
28-
.service(gc)
2928
.service(get)
3029
.service(all);
3130
}
@@ -82,22 +81,5 @@ pub async fn all(
8281
Ok(HttpResponse::Ok().json(service.purls(search, paginated, db.as_ref()).await?))
8382
}
8483

85-
#[utoipa::path(
86-
operation_id = "garbageCollect",
87-
tag = "purl",
88-
responses(
89-
(status = 200, description = "Performs garbage collection for orphaned packages", body = String),
90-
),
91-
)]
92-
#[get("/v2/purl/gc")]
93-
pub async fn gc(
94-
service: web::Data<PurlService>,
95-
db: web::Data<Database>,
96-
_: Require<DeleteSbom>,
97-
) -> actix_web::Result<impl Responder> {
98-
let result = service.gc_purls(db.as_ref()).await?;
99-
Ok(HttpResponse::Ok().body(result.to_string()))
100-
}
101-
10284
#[cfg(test)]
10385
mod test;

modules/fundamental/src/purl/endpoints/test.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::purl::model::details::base_purl::BasePurlDetails;
22
use crate::purl::model::summary::base_purl::BasePurlSummary;
33
use crate::purl::model::summary::purl::PurlSummary;
44
use crate::test::caller;
5-
use actix_web::http::StatusCode;
65
use actix_web::test::TestRequest;
76
use serde_json::{Value, json};
87
use std::str::FromStr;
@@ -294,22 +293,3 @@ async fn test_purl_license_details(ctx: &TrustifyContext) -> Result<(), anyhow::
294293
assert!(expected_result.contains_subset(response.clone()));
295294
Ok(())
296295
}
297-
298-
#[test_context(TrustifyContext)]
299-
#[test(actix_web::test)]
300-
async fn garbage_collect(ctx: &TrustifyContext) -> Result<(), anyhow::Error> {
301-
setup(&ctx.db, &ctx.graph).await?;
302-
let app = caller(ctx).await?;
303-
304-
let uri = "/api/v2/purl/gc";
305-
let request = TestRequest::get().uri(uri).to_request();
306-
let response = app.call_service(request).await;
307-
308-
assert_eq!(response.status(), StatusCode::OK);
309-
310-
let body_bytes = actix_web::test::read_body(response).await;
311-
let body_str = std::str::from_utf8(&body_bytes)?;
312-
assert_eq!(body_str, "8");
313-
314-
Ok(())
315-
}

openapi.yaml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,18 +2057,6 @@ paths:
20572057
application/json:
20582058
schema:
20592059
$ref: '#/components/schemas/BasePurlDetails'
2060-
/api/v2/purl/gc:
2061-
get:
2062-
tags:
2063-
- purl
2064-
operationId: garbageCollect
2065-
responses:
2066-
'200':
2067-
description: Performs garbage collection for orphaned packages
2068-
content:
2069-
text/plain:
2070-
schema:
2071-
type: string
20722060
/api/v2/purl/{key}:
20732061
get:
20742062
tags:

0 commit comments

Comments
 (0)