Major cleanup, fix shortids, and more

This commit is contained in:
oitsjustjose 2023-04-22 01:13:04 -05:00
commit f74d0ee58a
9 changed files with 436 additions and 249 deletions

44
api/src/data.py Normal file
View file

@ -0,0 +1,44 @@
"""
Houses data classes
Author: oitsjustjose @ modrinth/curseforge/twitter
"""
from dataclasses import dataclass
from enum import Enum
from typing import List, Union
class Status(Enum):
"""Job Status"""
ENQUEUED = 0
PROCESSING = 1
COMPLETE = 2
SUCCESS = 3
PARTIAL_FAIL = 4
FAIL = 5
NOTFOUND = -1
@dataclass
class Job:
"""A single job"""
github_pat: str
curseforge_slug: str
modrinth_id: str
job_id: str = ""
delimiter: str = "-"
logs: str = ""
status: Status = Status.ENQUEUED
queue_place: int = 0
@dataclass
class ModInfo:
"""Stores metadata about a jarfile to be extrapolated"""
name: str
mod_version: str
modrinth_name: str
game_version: str # representative game ver
game_versions: List[str] # actual game vers