add types and decouple packs functions from flask

This commit is contained in:
Kentai Radiquum 2025-05-14 23:49:01 +05:00
parent ee133e9111
commit f4d15c5eaf
Signed by: Radiquum
GPG key ID: 858E8EE696525EED
7 changed files with 174 additions and 48 deletions

38
src/type/pack.py Normal file
View file

@ -0,0 +1,38 @@
import json
from .mod import Mod
class Pack:
def __init__(
self,
_id: str,
title: str,
author: str,
version: str,
modloader: str,
updateURL: str,
mods: list[Mod],
modpackVersion: int = 0,
formatVersion: int = 0,
):
self._id = _id
self.title = title
self.author = author
self.version = version
self.modloader = modloader
self.updateURL = updateURL
self.mods = mods
self.modpackVersion = modpackVersion
self.formatVersion = formatVersion
def json(self):
return {
"title": self.title,
"author": self.author,
"version": self.version,
"modloader": self.modloader,
"updateURL": self.updateURL,
"mods": self.mods,
"modpackVersion": self.modpackVersion,
"formatVersion": self.formatVersion,
}