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}; use giterated_plugin::StateExtractor; pub async fn create_issue_request( repository: Repository, _request: CreateIssueRequest, _state: StateExtractor, ) -> 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( _repository: Repository, _request: QueryIssuesRequest, _state: StateExtractor, ) -> Result, OperationError> { // TODO: AUTHN & AUTHZ todo!() } pub async fn edit_issue_request( _issue: Issue, _request: IssueEditRequest, _state: StateExtractor, ) -> Result<(), OperationError> { // TODO: AUTHN & AUTHZ todo!() } pub async fn issue_post_comment_request( _issue: Issue, _request: IssuePostCommentRequest, _state: StateExtractor, ) -> Result> { // TODO: AUTHN & AUTHZ todo!() } pub async fn issue_value_author( _issue: Issue, _state: StateExtractor, ) -> Result> { todo!() } pub async fn issue_value_creation_date( _issue: Issue, _state: StateExtractor, ) -> Result> { todo!() } pub async fn issue_value_comment_count( _issue: Issue, _state: StateExtractor, ) -> Result> { todo!() } pub async fn issue_set_setting_name( _issue: Issue, _name: Name, _state: StateExtractor, ) -> Result<(), OperationError> { todo!() } pub async fn issue_get_setting_name( _issue: Issue, _state: StateExtractor, ) -> Result> { todo!() } pub async fn issue_set_setting_contents( _issue: Issue, _contents: Contents, _state: StateExtractor, ) -> Result<(), OperationError> { todo!() } pub async fn issue_get_setting_contents( _issue: Issue, _state: StateExtractor, ) -> Result> { todo!() }