forked from polka_billy/porridger
Merge branch 'main' of https://github.com/dm1sh/porridger_tmp
This commit is contained in:
@ -162,12 +162,12 @@ async def login_for_access_token(
|
||||
return {"access_token":access_token}
|
||||
|
||||
|
||||
@app.get("/api/users/me/", response_model=schemas.User) #
|
||||
@app.get("/api/users/me", response_model=schemas.User) #
|
||||
async def read_users_me(current_user: Annotated[schemas.User, Depends(utils.get_current_active_user)]):
|
||||
return current_user
|
||||
|
||||
|
||||
@app.get("/api/users/me/items/")
|
||||
@app.get("/api/users/me/items")
|
||||
async def read_own_items(
|
||||
current_user: Annotated[schemas.User, Depends(utils.get_current_active_user)]
|
||||
):
|
||||
@ -205,7 +205,7 @@ def poems_to_front(): # db: Annotated[Session, Depends(utils.get_db)]
|
||||
rand_id = random.randint(1, kolvo_stixov) # номер стихотворения
|
||||
poem_json = dict()
|
||||
poem = database.query(models.Poems).filter(models.Poems.id == rand_id).first()
|
||||
poem_json = {"title": poem.title, "text": poem.text, "author": poem.author}
|
||||
poem_json = {"id": rand_id, "title": poem.title, "text": poem.text, "author": poem.author}
|
||||
return poem_json
|
||||
else:
|
||||
raise HTTPException(status_code=404, detail="Poems not found")
|
||||
@ -256,4 +256,4 @@ def dispose(data: schemas.DisposeRequest, current_user_schema: Annotated[schemas
|
||||
database.add(new_trashox)
|
||||
database.commit()
|
||||
database.refresh(new_trashox) # обновляем состояние объекта
|
||||
|
||||
|
||||
|
@ -58,8 +58,6 @@ class TokenData(BaseModel):
|
||||
class User(BaseModel):
|
||||
id: int
|
||||
nickname: str
|
||||
name: Union[str, None] = None
|
||||
surname: Union[str, None] = None
|
||||
reg_date: date
|
||||
disabled: Union[bool, None] = False
|
||||
items: list[Announcement] = []
|
||||
@ -102,4 +100,4 @@ class SortAnnouncements(BaseModel):
|
||||
# схема для начисления баллов
|
||||
class AddRating(BaseModel):
|
||||
user_id: int
|
||||
rate: int
|
||||
rate: int
|
||||
|
@ -29,8 +29,6 @@ def add_poems_to_db(db: Session):
|
||||
flag = True
|
||||
else:
|
||||
author += str1
|
||||
if(str1 != f"стих {a+1}\n"):
|
||||
stixi+=str1#удаление /n и заключение в список
|
||||
poem = models.Poems(title=name, text=stixi, author=author)
|
||||
# В конце каждой итерации добавляем в базу данных
|
||||
db.add(poem)
|
||||
|
Reference in New Issue
Block a user