RESCIND_OFFER_QUERY should return number of the deleted rows (iirc it's the default behavior of relational DBs), so return type of OffersRepository.rescind_offer() should be int (also change type in offers:rescind-offer-from-user route from OfferPublic to int).
However, with pytetst --pdb, the error states that it received None type, so the test fails with int and OfferPublic type hints. It's expected as the original query has no RETURNING statement.
I added RETURNING user_id; to RESCIND_OFFER_QUERY and changed type hints to int. The test passes this way.
What would be the correct solution if we want to return empty body on successful Offer DELETE request?
I'm on part-11-marketplace-functionality-in-fastapi/ branch.
TestRescindOffers.test_user_can_successfully_rescind_pending_offer()
fails because of Pydantic model type check:RESCIND_OFFER_QUERY
should return number of the deleted rows (iirc it's the default behavior of relational DBs), so return type ofOffersRepository.rescind_offer()
should beint
(also change type inoffers:rescind-offer-from-user
route fromOfferPublic
toint
).However, with
pytetst --pdb
, the error states that it receivedNone
type, so the test fails withint
andOfferPublic
type hints. It's expected as the original query has noRETURNING
statement.I added
RETURNING user_id;
toRESCIND_OFFER_QUERY
and changed type hints toint
. The test passes this way.What would be the correct solution if we want to return empty body on successful Offer DELETE request?