a06673b
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<SearchResults> {
Ok(SearchResults {
data: Vec::new(),
ok: true,
})
}
pub async fn get_repo_by_id(_svc: &RepoService) -> RepoResult<RepoSummary> {
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<Vec<IssueTemplate>> {
Ok(Vec::new())
}
pub async fn get_issue_config(
_svc: &RepoService,
_actor: Uuid,
_repo_id: Uuid,
) -> RepoResult<IssueConfig> {
Ok(IssueConfig {
blank_issues_enabled: true,
contact_links: None,
})
}
pub async fn validate_issue_config(
_svc: &RepoService,
_actor: Uuid,
_repo_id: Uuid,
) -> RepoResult<IssueConfigValidation> {
Ok(IssueConfigValidation {
valid: true,
message: None,
})
}
pub async fn get_languages(
_svc: &RepoService,
_actor: Uuid,
_repo_id: Uuid,
) -> RepoResult<LanguagesResponse> {
Ok(LanguagesResponse {
languages: std::collections::BTreeMap::new(),
})
}
pub async fn get_licenses(
_svc: &RepoService,
_actor: Uuid,
_repo_id: Uuid,
) -> RepoResult<LicensesResponse> {
Ok(LicensesResponse {
licenses: Vec::new(),
})
}
pub async fn list_stargazers(_svc: &RepoService) -> RepoResult<Vec<UserMini>> {
Ok(Vec::new())
}
pub async fn list_assignees(_svc: &RepoService) -> RepoResult<Vec<UserMini>> {
Ok(Vec::new())
}
pub async fn check_assignee(_svc: &RepoService) -> RepoResult<bool> {
Ok(false)
}
pub async fn list_reviewers(_svc: &RepoService) -> RepoResult<Vec<UserMini>> {
Ok(Vec::new())
}
pub async fn check_new_pin_allowed(_svc: &RepoService) -> RepoResult<NewPinAllowedResponse> {
Ok(NewPinAllowedResponse { allowed: true })
}
pub async fn get_file_contents(_svc: &RepoService) -> RepoResult<Vec<serde_json::Value>> {
Err(RepoError::Internal(
"batch file-contents requires lib/git rewire".into(),
))
}
pub async fn list_commits(_svc: &RepoService) -> RepoResult<CommitsResponse> {
Ok(CommitsResponse {
items: Vec::new(),
total: 0,
})
}
pub async fn get_commit(_svc: &RepoService) -> RepoResult<CommitSummary> {
Err(RepoError::Internal(
"get_commit requires lib/git rewire".into(),
))
}
pub async fn get_commit_diff_or_patch(_svc: &RepoService) -> RepoResult<String> {
Err(RepoError::Internal(
"get_commit_diff_or_patch requires lib/git rewire".into(),
))
}
pub async fn get_combined_status_by_ref(_svc: &RepoService) -> RepoResult<serde_json::Value> {
Ok(serde_json::json!({
"state": "pending",
"sha": "",
"statuses": [],
"total_count": 0,
}))
}
pub async fn get_statuses_by_ref(_svc: &RepoService) -> RepoResult<Vec<serde_json::Value>> {
Ok(Vec::new())
}
pub async fn compare_commits(_svc: &RepoService) -> RepoResult<CommitComparison> {
Err(RepoError::Internal(
"compare requires lib/git rewire".into(),
))
}
pub async fn list_git_refs(_svc: &RepoService) -> RepoResult<Vec<GitRef>> {
Ok(Vec::new())
}
pub async fn get_tree(_svc: &RepoService) -> RepoResult<GitTreeResponse> {
Err(RepoError::Internal(
"get_tree requires lib/git rewire".into(),
))
}
pub async fn get_blob(_svc: &RepoService) -> RepoResult<GitBlobResponse> {
Err(RepoError::Internal(
"get_blob requires lib/git rewire".into(),
))
}
pub async fn get_note(_svc: &RepoService) -> RepoResult<GitNote> {
Err(RepoError::Internal(
"get_note requires lib/git rewire".into(),
))
}
pub async fn get_raw_file(_svc: &RepoService) -> RepoResult<Vec<u8>> {
Err(RepoError::Internal(
"get_raw_file requires lib/git rewire".into(),
))
}
pub async fn get_media(_svc: &RepoService) -> RepoResult<Vec<u8>> {
Err(RepoError::Internal(
"get_media requires lib/git rewire".into(),
))
}
pub async fn get_editorconfig(_svc: &RepoService) -> RepoResult<String> {
Err(RepoError::Internal(
"get_editorconfig requires lib/git rewire".into(),
))
}
pub async fn list_forks(_svc: &RepoService) -> RepoResult<ForksResponse> {
Ok(ForksResponse {
items: Vec::new(),
total: 0,
})
}
pub async fn list_release_attachments(
_svc: &RepoService,
_actor: Uuid,
_repo_id: Uuid,
_release_id: Uuid,
) -> RepoResult<ReleaseAttachmentListResponse> {
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<ReleaseAttachmentView> {
Err(RepoError::NotFound("release attachment".into()))
}
pub async fn watch_repo(
_svc: &RepoService,
actor: Uuid,
_repo_id: Uuid,
) -> RepoResult<Subscription> {
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<String> {
Ok(String::new())
}
pub async fn get_signing_key_ssh(
_svc: &RepoService,
_actor: Uuid,
_repo_id: Uuid,
) -> RepoResult<String> {
Ok(String::new())
}