Implement an update to the UserBase model
This commit is contained in:
parent
c4217c5132
commit
838d34cc4d
@ -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
|
||||
|
@ -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):
|
||||
|
10
functions.py
10
functions.py
@ -31,3 +31,13 @@ def login(email, password):
|
||||
return user_response.json()
|
||||
else:
|
||||
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
|
Loading…
Reference in New Issue
Block a user