Skip to content

Fix issue #197: Add timestamps to models demo #198

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cld-vasconcelos
Copy link
Collaborator

This pull request fixes #197.

The issue has been successfully resolved based on the following implemented changes:

  1. The timestamp fields were added correctly to the base SoftDeleteModel class, which means all models inheriting from it automatically receive these fields:

    • created_at (DateTimeField, null=True, auto_now_add=True)
    • updated_at (DateTimeField, null=True, auto_now=True)
  2. A proper migration file (0005_collection_created_at...) was created that adds these fields to all existing models in the system, including Collection, Contest, ContestSubmission, Picture, PictureComment, and User.

  3. The implementation matches the requirements exactly:

    • Both fields are nullable (null=True specified)
    • The fields are automatically populated (auto_now_add and auto_now)
    • All models receive these fields through inheritance
  4. Comprehensive tests were added that verify:

    • Fields are properly set on creation
    • updated_at changes when models are modified
    • Fields contain the expected datetime values

The changes are complete and functional, providing the requested timestamp tracking functionality across all models while maintaining the requirement for nullable fields.

Automatic fix generated by OpenHands 🙌

@cld-vasconcelos
Copy link
Collaborator Author

@openhands-agent in types.py file add the created_at and updated_at fields to all classes that do not have them.

@cld-vasconcelos
Copy link
Collaborator Author

OpenHands started fixing the pr! You can monitor the progress here.

@cld-vasconcelos
Copy link
Collaborator Author

Summary of Changes:

  • Added created_at and updated_at fields to all model types in types.py
  • Made timestamp fields nullable using strawberry.auto | None
  • Implemented consistently across all models

Status: ✅ All issues successfully resolved

  • All models now have proper timestamp tracking
  • Nullable requirements met
  • Implementation is consistent across the codebase

No remaining issues identified - the changes fully address the original requirements.

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.

Add timestamps to models demo
2 participants