Skip to content

DEV-446 Delete Stuff Post Handler & DEV-445 Create Stuff Post Handler#73

Open
ZhaoSongZh7 wants to merge 3 commits intopreviewfrom
delete_and_post_handler
Open

DEV-446 Delete Stuff Post Handler & DEV-445 Create Stuff Post Handler#73
ZhaoSongZh7 wants to merge 3 commits intopreviewfrom
delete_and_post_handler

Conversation

@ZhaoSongZh7
Copy link
Contributor

@ZhaoSongZh7 ZhaoSongZh7 commented Feb 24, 2026

References

Proposed Changes

  • Added the delete and post handler in stuff_user_view.py

@ZhaoSongZh7 ZhaoSongZh7 requested a review from jfmath04 February 24, 2026 04:42
@linear
Copy link

linear bot commented Feb 24, 2026

@vercel
Copy link

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mail Ready Ready Preview, Comment Feb 24, 2026 4:42am

Request Review

@@ -1,4 +1,4 @@
.controls {
an.controls {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was this needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we put this file back lol

{"error": "You already have a post."},
status=status.HTTP_400_BAD_REQUEST
)
StuffPost.objects.create(author=user, title=request.data.get("title"), description=request.data.get("description"), thumbnail_url=request.data.get("thumbnail_url"), category=request.data.get("category"), link_url=request.data.get("link_url"), tags=request.data.get("tags"), has_sent=False, created_at=timezone.now())
Copy link
Contributor

@jfmath04 jfmath04 Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we turn this into a Model Serializer for StuffPost? It can go at the top of this file. It should be similar to the EventSerializer in the calendar repo. author should be a read_only field. The author info can be injected in after.

StuffPost.objects.filter(author=user).delete();
return Response({"Status": "OK"}, status=status.HTTP_200_OK)
except StuffPost.DoesNotExist:
logger.error(f"Stuff post not found for user {user.email}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't forget to initialize the logger at the top

)
StuffPost.objects.create(author=user, title=request.data.get("title"), description=request.data.get("description"), thumbnail_url=request.data.get("thumbnail_url"), category=request.data.get("category"), link_url=request.data.get("link_url"), tags=request.data.get("tags"), has_sent=False, created_at=timezone.now())
return Response({"status": "OK", "message": "Post made successfully"}, status=status.HTTP_200_OK)
except ValidationError as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can make this similar to the except clause in your delete handler.


return Response({"status": "OK", "message": "Stuff posts retrieved successfully"}, status=status.HTTP_200_OK)

def post(self, request) -> Response:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add logging to this handler too?

Copy link
Contributor

@jfmath04 jfmath04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants