Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix response model #303

Merged
merged 4 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/endpoints/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ async def get_event_applicant(

@router.post(
"/calendar/events/",
response_model=schemas_calendar.EventComplete,
response_model=schemas_calendar.EventReturn,
status_code=201,
tags=[Tags.calendar],
)
Expand Down
4 changes: 2 additions & 2 deletions app/endpoints/raffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def get_raffle(

@router.post(
"/tombola/raffles",
response_model=schemas_raffle.RaffleSimple,
response_model=schemas_raffle.RaffleComplete,
status_code=201,
tags=[Tags.raffle],
)
Expand Down Expand Up @@ -155,7 +155,7 @@ async def delete_raffle(

@router.get(
"/tombola/group/{group_id}/raffles",
response_model=list[schemas_raffle.RaffleSimple],
response_model=list[schemas_raffle.RaffleComplete],
status_code=200,
tags=[Tags.raffle],
)
Expand Down
13 changes: 3 additions & 10 deletions app/schemas/schemas_raffle.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import BaseModel

from app.schemas.schemas_core import CoreGroupSimple, CoreUserSimple
from app.schemas.schemas_core import CoreUserSimple
from app.utils.types.raffle_types import RaffleStatusType


Expand All @@ -20,20 +20,13 @@ class RaffleEdit(BaseModel):
description: str | None = None


class RaffleSimple(RaffleBase):
class RaffleComplete(RaffleBase):
id: str

class Config:
orm_mode = True


class RaffleComplete(RaffleSimple):
group: CoreGroupSimple

class Config:
orm_mode = True


class RaffleStats(BaseModel):
tickets_sold: int
amount_raised: float
Expand Down Expand Up @@ -97,7 +90,7 @@ class Config:


class PackTicketComplete(PackTicketSimple):
raffle: RaffleSimple
raffle: RaffleComplete

class Config:
orm_mode = True
Expand Down