Skip to content

Commit d26f10d

Browse files
committed
fix: ensure project public status consistency
1 parent 6062359 commit d26f10d

File tree

5 files changed

+24
-6
lines changed

5 files changed

+24
-6
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ resolver = "2"
88
[package]
99
name = "backend"
1010
description = "Backend API and services for StackClass"
11-
version = "0.37.0"
11+
version = "0.38.0"
1212
edition = "2024"
1313

1414
default-run = "stackclass-server"

crates/harbor-client/src/types/project.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ impl CreateProjectRequest {
4747
pub fn new(name: impl ToString) -> Self {
4848
Self { project_name: name.to_string(), ..Default::default() }
4949
}
50+
51+
/// Sets the public status of the project, updating both the top-level
52+
/// `public` field and the `metadata.public` field for consistency.
53+
pub fn with_public(mut self, value: bool) -> Self {
54+
self.public = Some(value);
55+
56+
// Ensure metadata exists
57+
if self.metadata.is_none() {
58+
self.metadata = Some(ProjectMetadata::default());
59+
}
60+
61+
// Update the metadata public field
62+
if let Some(ref mut metadata) = self.metadata {
63+
metadata.public = Some(value.to_string());
64+
}
65+
66+
self
67+
}
5068
}
5169

5270
/// Project metadata configuration

openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": {
77
"name": ""
88
},
9-
"version": "0.37.0"
9+
"version": "0.38.0"
1010
},
1111
"paths": {
1212
"/v1/courses": {

src/service/registry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ impl RegistryService {
2727
match ctx.harbor.head_project(name).await {
2828
Ok(_) => Ok(()), // Project exists, nothing to do
2929
Err(ClientError::NotFound) => {
30-
info!("Creating project '{}' in Harbor registry", name);
31-
let request = CreateProjectRequest::new(name);
30+
let request = CreateProjectRequest::new(name).with_public(true);
3231
ctx.harbor.create_project(request).await?;
33-
info!("Project '{}' created successfully", name);
32+
info!("Project '{}' created successfully in Harbor registry", name);
33+
3434
Ok(())
3535
}
3636
Err(e) => Err(e.into()), // Propagate other errors

0 commit comments

Comments
 (0)