feat: revamp authentication -- remove twitch's tokens from our own wrapper token
This commit is contained in:
parent
3186afe96d
commit
50900986fa
31 changed files with 736 additions and 155 deletions
|
|
@ -1,12 +1,13 @@
|
|||
from typing import Literal
|
||||
|
||||
from litestar import MediaType, Response, get, put
|
||||
from litestar import MediaType, Response, get, post, put
|
||||
from litestar.response import Template
|
||||
from pydantic import BaseModel
|
||||
|
||||
from src.huesoporro.bot import BotsManager
|
||||
from src.huesoporro.models import ChatbotSettings, User
|
||||
from src.huesoporro.svc.get_chatbot_settings import ChatbotSettingsGetterSvc
|
||||
from src.huesoporro.svc.get_sentences_svc import SentencesGetterSvc
|
||||
from src.huesoporro.svc.store_settings import ChatbotSettingsStorerSvc
|
||||
|
||||
|
||||
|
|
@ -98,3 +99,17 @@ async def save_bot_settings(
|
|||
) -> dict:
|
||||
await sbs.run(user=user, bot_settings=data)
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@get("/sentences")
|
||||
async def get_sentences(user: User, sgs: SentencesGetterSvc) -> Template:
|
||||
sentences = await sgs.run(user=user)
|
||||
return Template(
|
||||
template_name="sentences.html",
|
||||
context={"sentences": [sentence.model_dump() for sentence in sentences]},
|
||||
)
|
||||
|
||||
|
||||
@post("/api/v1/sentences")
|
||||
async def save_new_sentence(user: User, data: dict) -> dict:
|
||||
return {"id": 54, "sentence": data["sentence"]}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue