chore: make IssueState unrelated to issues

This commit is contained in:
Aravinth Manivannan 2023-01-03 13:07:13 +05:30
parent 7003b3ff05
commit 855717781a
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
2 changed files with 23 additions and 18 deletions

View File

@ -17,23 +17,7 @@
//! Issues associated to a repository within a forge (Gitea, GitLab, etc.).
use serde::{Deserialize, Serialize};
use crate::Reaction;
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "lowercase")]
/// states of an issue
pub enum IssueState {
/// A 'closed' issue will not see any activity in the future
Closed,
/// An 'open' issue will see activity in the future
Open,
}
impl Default for IssueState {
fn default() -> Self {
Self::Open
}
}
use crate::{OpenCloseState, Reaction};
/// Issues associated to a repository within a forge (Gitea, GitLab, etc.).
#[derive(Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)]
@ -62,7 +46,7 @@ pub struct Issue {
pub milestone: Option<String>,
/// state of the issue
pub state: IssueState,
pub state: OpenCloseState,
/// A locked issue can only be modified by privileged users
pub is_locked: bool,

View File

@ -18,10 +18,13 @@
//!
//! Please refer to the [main documentation](https://f3.forgefriends.org/) for a complete overview.
//! This is an incomplete Rust port of the F3 library created by the ForgeFriends project.
use serde::{Deserialize, Serialize};
pub mod comment;
pub mod identities;
pub mod issue;
pub mod label;
pub mod milestone;
pub mod reaction;
pub mod repository;
pub mod topic;
@ -31,7 +34,25 @@ pub use comment::Comment;
pub use identities::Identities;
pub use issue::Issue;
pub use label::Label;
pub use milestone::Milestone;
pub use reaction::Reaction;
pub use repository::Repository;
pub use topic::Topic;
pub use user::User;
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
#[serde(rename_all = "lowercase")]
/// states of issue, milestone, etc with only "open" and "closed" states and "closed" states and
/// "closed" states and "closed" states
pub enum OpenCloseState {
/// A 'closed' issue will not see any activity in the future
Closed,
/// An 'open' issue will see activity in the future
Open,
}
impl Default for OpenCloseState {
fn default() -> Self {
Self::Open
}
}