You've already forked Promocode-API
mirror of
https://github.com/devitq/Promocode-API.git
synced 2026-05-22 22:07:12 +00:00
fix: removed null values output from some comments endpoints
This commit is contained in:
@@ -282,6 +282,7 @@ def delete_like(
|
|||||||
status.CREATED: schemas.CommentOut,
|
status.CREATED: schemas.CommentOut,
|
||||||
status.BAD_REQUEST: global_schemas.BadRequestError,
|
status.BAD_REQUEST: global_schemas.BadRequestError,
|
||||||
},
|
},
|
||||||
|
exclude_none=True,
|
||||||
)
|
)
|
||||||
def add_comment(
|
def add_comment(
|
||||||
request: HttpRequest, promocode_id: str, comment: schemas.CommentIn
|
request: HttpRequest, promocode_id: str, comment: schemas.CommentIn
|
||||||
@@ -314,6 +315,7 @@ def list_comments(
|
|||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
filters: Query[schemas.PromocodeCommentsFilters],
|
filters: Query[schemas.PromocodeCommentsFilters],
|
||||||
promocode_id: str,
|
promocode_id: str,
|
||||||
|
response: HttpResponse
|
||||||
) -> tuple[int, schemas.CommentOut]:
|
) -> tuple[int, schemas.CommentOut]:
|
||||||
promocodes = Promocode.objects.filter(id=promocode_id)
|
promocodes = Promocode.objects.filter(id=promocode_id)
|
||||||
|
|
||||||
@@ -324,6 +326,8 @@ def list_comments(
|
|||||||
|
|
||||||
comments = promocodes.first().comments.all()
|
comments = promocodes.first().comments.all()
|
||||||
|
|
||||||
|
response["X-Total-Count"] = len(comments)
|
||||||
|
|
||||||
comments = comments[filters.offset : filters.offset + filters.limit]
|
comments = comments[filters.offset : filters.offset + filters.limit]
|
||||||
|
|
||||||
return status.OK, [
|
return status.OK, [
|
||||||
@@ -362,6 +366,7 @@ def get_comment(
|
|||||||
status.OK: schemas.CommentOut,
|
status.OK: schemas.CommentOut,
|
||||||
status.BAD_REQUEST: global_schemas.BadRequestError,
|
status.BAD_REQUEST: global_schemas.BadRequestError,
|
||||||
},
|
},
|
||||||
|
exclude_none=True,
|
||||||
)
|
)
|
||||||
def update_comment(
|
def update_comment(
|
||||||
request: HttpRequest,
|
request: HttpRequest,
|
||||||
|
|||||||
Reference in New Issue
Block a user