fix db impl to match current approach

This commit is contained in:
Kohaku-Blueleaf
2025-10-11 22:28:11 +08:00
parent 21dad7e691
commit 614211b493
7 changed files with 7 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import hashlib
import struct
import zlib
def compute_git_object_sha1(obj_type: str, content: bytes) -> str:
"""Compute Git object SHA-1.

View File

@@ -7,6 +7,7 @@ from typing import Optional
from fastapi.responses import Response
class HFErrorCode:
"""HuggingFace error codes for X-Error-Code header.

View File

@@ -6,6 +6,7 @@ from fastapi import HTTPException
from kohakuhub.db import Organization, Repository, User, UserOrganization
def check_namespace_permission(
namespace: str, user: User, require_admin: bool = False
) -> bool:

View File

@@ -6,6 +6,7 @@ import secrets
import bcrypt
def hash_password(password: str) -> str:
"""Hash password with bcrypt."""
return bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()

View File

@@ -21,6 +21,7 @@ from kohakuhub.db import (
db,
)
# User operations
def get_user_by_id(user_id: int) -> User | None:
"""Get user by ID."""

View File

@@ -7,6 +7,7 @@ from datetime import datetime
from enum import Enum
from typing import Optional
class Color:
"""ANSI color codes for terminal output."""

View File

@@ -3,6 +3,7 @@
from kohakuhub.config import cfg
from kohakuhub.lakefs_rest_client import LakeFSRestClient, get_lakefs_rest_client
def get_lakefs_client() -> LakeFSRestClient:
"""Get configured LakeFS REST client.