use db::conn::sea_orm::*; use time::OffsetDateTime; use uuid::Uuid; use crate::error::{RepoError, RepoResult}; use crate::features::RepoService; use super::types::*; pub async fn search_repos(_svc: &RepoService) -> RepoResult { Ok(SearchResults { data: Vec::new(), ok: true, }) } pub async fn get_repo_by_id(_svc: &RepoService) -> RepoResult { Err(RepoError::NotFound( "repo by id lookup not implemented".into(), )) } pub async fn update_repo_avatar(_svc: &RepoService, actor: Uuid, _repo_id: Uuid) -> RepoResult<()> { if actor.is_nil() { return Err(RepoError::Unauthorized("authentication required".into())); } Ok(()) } pub async fn delete_repo_avatar(_svc: &RepoService, actor: Uuid, _repo_id: Uuid) -> RepoResult<()> { if actor.is_nil() { return Err(RepoError::Unauthorized("authentication required".into())); } Ok(()) } pub async fn list_issue_templates( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, ) -> RepoResult> { Ok(Vec::new()) } pub async fn get_issue_config( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, ) -> RepoResult { Ok(IssueConfig { blank_issues_enabled: true, contact_links: None, }) } pub async fn validate_issue_config( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, ) -> RepoResult { Ok(IssueConfigValidation { valid: true, message: None, }) } pub async fn get_languages( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, ) -> RepoResult { Ok(LanguagesResponse { languages: std::collections::BTreeMap::new(), }) } pub async fn get_licenses( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, ) -> RepoResult { Ok(LicensesResponse { licenses: Vec::new(), }) } pub async fn list_stargazers(_svc: &RepoService) -> RepoResult> { Ok(Vec::new()) } pub async fn list_assignees(_svc: &RepoService) -> RepoResult> { Ok(Vec::new()) } pub async fn check_assignee(_svc: &RepoService) -> RepoResult { Ok(false) } pub async fn list_reviewers(_svc: &RepoService) -> RepoResult> { Ok(Vec::new()) } pub async fn check_new_pin_allowed(_svc: &RepoService) -> RepoResult { Ok(NewPinAllowedResponse { allowed: true }) } pub async fn get_file_contents(_svc: &RepoService) -> RepoResult> { Err(RepoError::Internal( "batch file-contents requires lib/git rewire".into(), )) } pub async fn list_commits(_svc: &RepoService) -> RepoResult { Ok(CommitsResponse { items: Vec::new(), total: 0, }) } pub async fn get_commit(_svc: &RepoService) -> RepoResult { Err(RepoError::Internal( "get_commit requires lib/git rewire".into(), )) } pub async fn get_commit_diff_or_patch(_svc: &RepoService) -> RepoResult { Err(RepoError::Internal( "get_commit_diff_or_patch requires lib/git rewire".into(), )) } pub async fn get_combined_status_by_ref(_svc: &RepoService) -> RepoResult { Ok(serde_json::json!({ "state": "pending", "sha": "", "statuses": [], "total_count": 0, })) } pub async fn get_statuses_by_ref(_svc: &RepoService) -> RepoResult> { Ok(Vec::new()) } pub async fn compare_commits(_svc: &RepoService) -> RepoResult { Err(RepoError::Internal( "compare requires lib/git rewire".into(), )) } pub async fn list_git_refs(_svc: &RepoService) -> RepoResult> { Ok(Vec::new()) } pub async fn get_tree(_svc: &RepoService) -> RepoResult { Err(RepoError::Internal( "get_tree requires lib/git rewire".into(), )) } pub async fn get_blob(_svc: &RepoService) -> RepoResult { Err(RepoError::Internal( "get_blob requires lib/git rewire".into(), )) } pub async fn get_note(_svc: &RepoService) -> RepoResult { Err(RepoError::Internal( "get_note requires lib/git rewire".into(), )) } pub async fn get_raw_file(_svc: &RepoService) -> RepoResult> { Err(RepoError::Internal( "get_raw_file requires lib/git rewire".into(), )) } pub async fn get_media(_svc: &RepoService) -> RepoResult> { Err(RepoError::Internal( "get_media requires lib/git rewire".into(), )) } pub async fn get_editorconfig(_svc: &RepoService) -> RepoResult { Err(RepoError::Internal( "get_editorconfig requires lib/git rewire".into(), )) } pub async fn list_forks(_svc: &RepoService) -> RepoResult { Ok(ForksResponse { items: Vec::new(), total: 0, }) } pub async fn list_release_attachments( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, _release_id: Uuid, ) -> RepoResult { Ok(ReleaseAttachmentListResponse { items: Vec::new() }) } pub async fn get_release_attachment( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, _release_id: Uuid, _attachment_id: Uuid, ) -> RepoResult { Err(RepoError::NotFound("release attachment".into())) } pub async fn watch_repo( _svc: &RepoService, actor: Uuid, _repo_id: Uuid, ) -> RepoResult { if actor.is_nil() { return Err(RepoError::Unauthorized("authentication required".into())); } let now = OffsetDateTime::now_utc() .format(&time::format_description::well_known::Rfc3339) .unwrap_or_default(); Ok(Subscription { user_id: actor, repo_id: Uuid::nil(), mode: "watch".to_string(), created_at: now, }) } pub async fn unwatch_repo(_svc: &RepoService, actor: Uuid, _repo_id: Uuid) -> RepoResult<()> { if actor.is_nil() { return Err(RepoError::Unauthorized("authentication required".into())); } Ok(()) } pub async fn get_signing_key_gpg( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, ) -> RepoResult { Ok(String::new()) } pub async fn get_signing_key_ssh( _svc: &RepoService, _actor: Uuid, _repo_id: Uuid, ) -> RepoResult { Ok(String::new()) }