use crate::setting::Contents; use crate::value::{Author, CommentCount, CreationDate, Name}; use crate::IssuesPluginState; use crate::{ operations::{ CreateIssueRequest, IssueCreationError, IssueEditError, IssueEditRequest, IssuePostCommentError, IssuePostCommentRequest, IssueQueryError, QueryIssuesRequest, }, Issue, }; use giterated_models::{error::OperationError, repository::Repository}; pub async fn create_issue_request( _state: IssuesPluginState, repository: Repository, _request: CreateIssueRequest, ) -> Result> { // // TODO: AUTHN & AUTHZ // let issue = sqlx::query_as!( // IssueRow, // r#"INSERT INTO issues VALUES (null, $1, $2, $3, $4, $5) RETURNING *"#, // repository.to_string(), // request.author.to_string(), // 0, // request.name, // request.contents, // ) // .fetch_one(&state.pool) // .await // .as_internal_error_with_context("creating issue in db")?; // Ok(Issue { // repository, // id: issue.id as u32, // }) Ok(Issue { repository, id: 1 }) } pub async fn query_issues_request( _state: IssuesPluginState, _repository: Repository, _request: QueryIssuesRequest, ) -> Result, OperationError> { // TODO: AUTHN & AUTHZ todo!() } pub async fn edit_issue_request( _state: IssuesPluginState, _issue: Issue, _request: IssueEditRequest, ) -> Result<(), OperationError> { // TODO: AUTHN & AUTHZ todo!() } pub async fn issue_post_comment_request( _state: IssuesPluginState, _issue: Issue, _request: IssuePostCommentRequest, ) -> Result> { // TODO: AUTHN & AUTHZ todo!() } pub async fn issue_value_author( _state: IssuesPluginState, _issue: Issue, ) -> Result> { todo!() } pub async fn issue_value_creation_date( _state: IssuesPluginState, _issue: Issue, ) -> Result> { todo!() } pub async fn issue_value_comment_count( _state: IssuesPluginState, _issue: Issue, ) -> Result> { todo!() } pub async fn issue_set_setting_name( _state: IssuesPluginState, _issue: Issue, _name: Name, ) -> Result<(), OperationError> { todo!() } pub async fn issue_get_setting_name( _state: IssuesPluginState, _issue: Issue, ) -> Result> { todo!() } pub async fn issue_set_setting_contents( _state: IssuesPluginState, _issue: Issue, _contents: Contents, ) -> Result<(), OperationError> { todo!() } pub async fn issue_get_setting_contents( _state: IssuesPluginState, _issue: Issue, ) -> Result> { todo!() }