Implement an update to the UserBase model

This commit is contained in:
Colin Bassett 2025-02-26 13:41:37 -05:00
parent c4217c5132
commit 838d34cc4d
3 changed files with 18 additions and 7 deletions

View File

@ -1,9 +1,6 @@
## CHANGELOG
## VER: Alpha #7
## VER: Alpha #8
## What's new?
- Updated the file structure to hold all the FastAPI files in its own dedicated 'api' folder
- Updated the 'main.py' file to have a working login and register feature
- Updated the 'sql.py' file to have a 'VerifyHero' model for verifying the hero's email & password
- Added a 'functions.py' file to hold all the functions for the main app. (The functions.py file for the API is in the 'api' folder)
- Added CHANGELOG and README files to the project
- Added an update to the UserBase model to add weapons, pickaxes, and upgrades to the users inventory
- Started work on the load_options functions that will allow the user to choose specific options for the game

View File

@ -1,5 +1,6 @@
# Imports
from typing import Annotated
from typing import List
from fastapi import Depends
from sqlmodel import Field, Session, SQLModel, create_engine
from pydantic import BaseModel
@ -9,6 +10,9 @@ class HeroBase(SQLModel):
name: str
gold: int | None = Field(default=0)
health: int | None = Field(default=100)
weapons: List[str] | None = Field(default=["basic_sword"])
pickaxe: List[str] | None = Field(default=["basic_pickaxe"])
upgrades: List[str] | None = Field(default=[])
# The main hero class. It inherits the name, gold, and health
class Hero(HeroBase, table=True):

View File

@ -30,4 +30,14 @@ def login(email, password):
user_response = requests.get(f"{url}/heroes/{response.json()['hero_id']}")
return user_response.json()
else:
return False
return False
def load_options() -> int:
print("""
Here are the available options:
* To select an option just enter its number *
1. Home - View the inventory
""")
option = int(input(""))
return option