feat: setup forgeflux forge type in DB

This commit is contained in:
Aravinth Manivannan 2025-02-09 12:59:48 +05:30
parent 66e9ec20f9
commit d1606fa2ac
Signed by: realaravinth
GPG key ID: F8F50389936984FF

View file

@ -309,6 +309,8 @@ impl Clone for Box<dyn SCDatabase> {
pub enum ForgeImplementation {
/// [Gitea](https://gitea.io) softare forge
Gitea,
/// [ForgeFlux](https://net.forgeflux.net)
ForgeFlux,
}
impl ForgeImplementation {
@ -316,6 +318,7 @@ impl ForgeImplementation {
pub const fn to_str(&self) -> &'static str {
match self {
ForgeImplementation::Gitea => "gitea",
ForgeImplementation::ForgeFlux => "forgeflux",
}
}
}
@ -326,9 +329,11 @@ impl FromStr for ForgeImplementation {
/// Convert [str] to [ForgeImplementation]
fn from_str(s: &str) -> DBResult<Self> {
const GITEA: &str = ForgeImplementation::Gitea.to_str();
const FORGEFLUX: &str = ForgeImplementation::ForgeFlux.to_str();
let s = s.trim();
match s {
GITEA => Ok(Self::Gitea),
FORGEFLUX => Ok(Self::ForgeFlux),
_ => Err(DBError::UnknownForgeType(s.to_owned())),
}
}