Compare commits

..

No commits in common. "fast-api-rework" and "master" have entirely different histories.

19 changed files with 0 additions and 84 deletions

Binary file not shown.

View file

@ -1,3 +0,0 @@
fastapi
uvicorn[standard]
peewee

View file

View file

@ -1 +0,0 @@
DATABASE = "./db.sqlite3"

View file

@ -1,12 +0,0 @@
from typing import List
from fastapi import APIRouter
from ..storage import Streak
router = APIRouter()
@router.get("/list", tags=["streak"])
def get_streaks() -> str:
return "Hellow"

View file

@ -1,21 +0,0 @@
from fastapi import FastAPI
from .config import DATABASE
from .storage import *
from .endpoints.streak_api import router as streak_router
import os
# Setup database
def create_database():
with database:
database.create_tables([Activity, ActivityRecord, Streak, StreakRecord])
if not os.path.exists(DATABASE):
create_database()
app = FastAPI()
app.include_router(streak_router, prefix="/streak", tags=["streak"])

View file

@ -1,3 +0,0 @@
from .activity import Activity, ActivityRecord
from .streak import Streak, StreakRecord
from .database import database

View file

@ -1,15 +0,0 @@
from .database import BaseModel
from peewee import BooleanField, TextField, DateTimeField, ForeignKeyField
class Activity(BaseModel):
name = TextField()
description = TextField()
is_available = BooleanField()
is_working = BooleanField()
class ActivityRecord(BaseModel):
started_at = DateTimeField()
activity = ForeignKeyField(Activity, backref='records')

View file

@ -1,12 +0,0 @@
from peewee import Model, SqliteDatabase, UUIDField
from ..config import DATABASE
database = SqliteDatabase(DATABASE)
class BaseModel(Model):
id = UUIDField(primary_key=True)
class Meta:
database = database

View file

@ -1,17 +0,0 @@
from datetime import date
from .database import BaseModel
from peewee import TextField, ForeignKeyField, FloatField, BooleanField, DateField
class Streak(BaseModel):
name = TextField()
description = TextField
class StreakRecord(BaseModel):
reference_date = DateField(default=date.today)
is_achieved = BooleanField()
value = FloatField()
streak = ForeignKeyField(Streak, backref='records')