Skip to content
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
9 changes: 0 additions & 9 deletions Cargo.lock

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

33 changes: 0 additions & 33 deletions TODO.md

This file was deleted.

1 change: 0 additions & 1 deletion charts/pkgly/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ data:
# Security Configuration
# ==========================================================================
[security]
allow_basic_without_tokens = {{ .Values.security.allowBasicWithoutTokens }}

[security.password_rules]
min_length = {{ .Values.security.passwordRules.minLength }}
Expand Down
1 change: 0 additions & 1 deletion charts/pkgly/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ sessions:

# Security configuration
security:
allowBasicWithoutTokens: true
passwordRules:
minLength: 12
requireUppercase: false
Expand Down
6 changes: 1 addition & 5 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ clap.workspace = true
pretty_assertions = "1"
tokio.workspace = true
[features]
default = ["migrations"]
migrations = []
testing = [
"migrations",
]
testing = []
[lints]
workspace = true
3 changes: 2 additions & 1 deletion crates/core/src/database/entities/project/members.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ABOUTME: Defines project membership rows and their database mapping.
// ABOUTME: Carries user access flags for project-level authorization.
use crate::database::prelude::*;
use serde::Serialize;
use utoipa::ToSchema;
Expand All @@ -14,4 +16,3 @@ pub struct DBProjectMember {
pub can_manage: bool,
pub added: chrono::DateTime<chrono::FixedOffset>,
}
impl DBProjectMember {}
3 changes: 2 additions & 1 deletion crates/core/src/database/entities/project/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// ABOUTME: Defines project entities and reusable project/version queries.
// ABOUTME: Exposes database models used by repository catalog operations.
use serde::Serialize;
use sqlx::{FromRow, PgPool, postgres::PgRow};
use tracing::instrument;
use utoipa::ToSchema;
use uuid::Uuid;
use versions::{DBProjectVersion, DBProjectVersionColumn, ProjectVersionType};
mod new;
pub mod utils;
pub use new::*;

use crate::{database::prelude::*, repository::project::ReleaseType};
Expand Down
14 changes: 0 additions & 14 deletions crates/core/src/database/entities/project/utils.rs

This file was deleted.

20 changes: 3 additions & 17 deletions crates/core/src/database/entities/repository.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::fmt::Debug;

// ABOUTME: Defines repository database rows and configuration persistence APIs.
// ABOUTME: Provides typed lookups for repositories and storage associations.
use serde::{Deserialize, Serialize};
use serde_json::Value;
use sqlx::{PgPool, Row, postgres::PgRow, prelude::FromRow, types::Json};
use sqlx::{PgPool, Row, prelude::FromRow, types::Json};
use tracing::info;
use utoipa::ToSchema;
use uuid::Uuid;
Expand All @@ -15,20 +15,6 @@ use crate::{
storage::StorageName,
};

pub trait RepositoryDBType: for<'r> FromRow<'r, PgRow> + Unpin + Send + Sync {
fn columns() -> Vec<&'static str>;
fn format_columns(prefix: Option<&str>) -> String {
if let Some(prefix) = prefix {
Self::columns()
.iter()
.map(|column| format!("{}.`{}`", prefix, column))
.collect::<Vec<String>>()
.join(", ")
} else {
Self::columns().join(", ")
}
}
}
#[derive(Debug, Clone, Serialize, FromRow, ToSchema, Deserialize)]

pub struct DBRepositoryWithStorageName {
Expand Down
3 changes: 2 additions & 1 deletion crates/core/src/database/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// ABOUTME: Groups database entities, configuration, and migration helpers.
// ABOUTME: Exposes the shared database result types used across the workspace.
pub mod entities;
#[cfg(feature = "migrations")]
pub mod migration;
pub type DateTime = chrono::DateTime<chrono::FixedOffset>;
mod config;
Expand Down
13 changes: 0 additions & 13 deletions crates/core/src/user/permissions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use uuid::Uuid;

use super::scopes::NRScope;
use crate::database::entities::user::{
UserType,
auth_token::AuthToken,
permissions::{NewUserRepositoryPermissions, UserRepositoryPermissions},
};
Expand Down Expand Up @@ -51,18 +50,6 @@ impl<HS: HasPermissions> HasPermissions for Option<HS> {
self.as_ref().and_then(HasPermissions::user_id)
}
}
pub trait HasUserType {
type UserType: UserType;

fn user(&self) -> Option<&Self::UserType>;
}
impl<HS: HasUserType> HasUserType for Option<HS> {
type UserType = HS::UserType;

fn user(&self) -> Option<&Self::UserType> {
self.as_ref().and_then(HasUserType::user)
}
}
pub trait HasPermissions {
fn user_id(&self) -> Option<i32>;
/// Get the permissions of the user. If the user or not logged in, return None
Expand Down
3 changes: 2 additions & 1 deletion crates/core/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod time;
// ABOUTME: Provides shared encoding, hashing, duration, and URL utilities.
// ABOUTME: Keeps serialization helpers consistent across core and application crates.
pub mod utopia;
pub mod base64_utils {
use base64::{DecodeError, Engine, engine::general_purpose::STANDARD};
Expand Down
30 changes: 0 additions & 30 deletions crates/core/src/utils/time.rs

This file was deleted.

7 changes: 0 additions & 7 deletions crates/core/src/utils/time/iso_8601/tests.rs

This file was deleted.

1 change: 0 additions & 1 deletion crates/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ aws-types = "1"
aws-smithy-types = { version = "1", features = ["rt-tokio"] }
aws-smithy-runtime-api = "1"
lru = "0.16"
hex = "0.4"
url = { version = "2.4", features = ["serde"] }
ipnet.workspace = true
aws-smithy-http-client = { version = "1", features = ["rustls-ring"] }
Expand Down
19 changes: 13 additions & 6 deletions crates/storage/src/fs/file_meta.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ABOUTME: Reads, writes, and updates repository metadata sidecar files.
// ABOUTME: Computes content hashes and maintains metadata during local storage changes.
use std::{
fs::File,
io::{self, BufReader, Read, Write},
Expand All @@ -16,10 +18,7 @@ use tracing::{
instrument, trace, warn,
};

use crate::{
fs::utils::MetadataUtils, local::error::LocalStorageError, meta::RepositoryMeta,
path::PathUtils,
};
use crate::{local::error::LocalStorageError, meta::RepositoryMeta, path::PathUtils};
use uuid::Uuid;
pub static HIDDEN_FILE_EXTENSIONS: &[&str] = &["nr-meta"];
pub static PKGLY_REPO_META_EXTENSION: &str = "nr-meta";
Expand Down Expand Up @@ -271,8 +270,16 @@ impl LocationMeta {
let (created, modified) = {
let file = File::open(path_ref)?;
let metadata = file.metadata()?;
let modified = metadata.modified_as_chrono_or_now()?;
let created = metadata.created_as_chrono_or_now()?;
let modified = metadata
.modified()
.ok()
.map(|time| DateTime::<Local>::from(time).fixed_offset())
.unwrap_or_else(|| Local::now().fixed_offset());
let created = metadata
.created()
.ok()
.map(|time| DateTime::<Local>::from(time).fixed_offset())
.unwrap_or_else(|| Local::now().fixed_offset());
(created, modified)
};
let location_meta = if path_ref.is_dir() {
Expand Down
4 changes: 3 additions & 1 deletion crates/storage/src/fs/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ABOUTME: Groups local filesystem storage primitives and metadata helpers.
// ABOUTME: Re-exports the file, stream, path, and content interfaces.
mod content;
mod file;
mod file_meta;
Expand All @@ -7,7 +9,7 @@ pub(crate) mod utils;
pub use content::*;
pub use file::*;
pub use file_meta::*;
pub use path::{ExtensionError, ParentDirectoryDoesNotExist};
pub use path::ExtensionError;
mod file_reader;
pub use file_reader::*;
use nr_core::storage::StoragePath;
Expand Down
15 changes: 3 additions & 12 deletions crates/storage/src/fs/path.rs
Original file line number Diff line number Diff line change
@@ -1,32 +1,23 @@
use std::path::{Path, PathBuf};
// ABOUTME: Provides small path transformations used by local storage metadata.
// ABOUTME: Reports non-UTF-8 extensions without hiding filesystem errors.
use std::path::PathBuf;

use thiserror::Error;
use tracing::instrument;

#[derive(Debug, Error)]
#[error("Parent directory for {0} does not exist")]
pub struct ParentDirectoryDoesNotExist(pub PathBuf);

#[derive(Debug, Error)]
pub enum ExtensionError {
#[error("The extension of path {0} is not UTF-8")]
ExtensionNotUtf8(PathBuf),
}

pub trait PathUtils {
/// Gets the parent directory of the path or returns an error if it does not exist.
#[allow(unused)]
fn parent_or_err(&self) -> Result<&Path, ParentDirectoryDoesNotExist>;
/// Appends an extension to the path.
fn add_extension(&self, extension: &str) -> Result<PathBuf, ExtensionError>;
/// Gets the current extension and attempts to convert it to a string.
fn extension_to_string(&self) -> Result<Option<&str>, ExtensionError>;
}
impl PathUtils for PathBuf {
fn parent_or_err(&self) -> Result<&Path, ParentDirectoryDoesNotExist> {
self.parent()
.ok_or_else(|| ParentDirectoryDoesNotExist(self.clone()))
}
fn extension_to_string(&self) -> Result<Option<&str>, ExtensionError> {
self.extension()
.map(|v| {
Expand Down
Loading