DEV Community

Cover image for How we implemented a straightforward post history system at Glynk
Jaleel Nazir
Jaleel Nazir

Posted on

How we implemented a straightforward post history system at Glynk

In #Glynk, a community platform enabling users to create social content posts and events, a comprehensive moderation system is implemented to manage user-generated content.

We have a system in place with both an automation script and a team to moderate content. The challenge was to track the edit history of posts, detailing when they were created and the modifications made.

Our main backend and web apps are created with Django. Despite the availability of Django libraries for this purpose, an alternative setup was chosen. The decision was made to create an independent module, separate from the existing ones, to facilitate easy tracking of modifications. At that time, the Post model comprised around 100 fields, but the product requirement was to monitor only a select few.

The chosen solution involved implementing a new MongoDB model:

{
    "post_unique_id": post_unique_id, // Indexed
    "original_post_obj": serialized_post,
    "change_logs": [
        {
            "modified_at": timestamp,
            "modified_by": user_id,
            "serialized_post_obj": serialized_post_obj,
        },
        {
            "modified_at": timestamp,
            "modified_by": user_id,
            "serialized_post_obj": serialized_post_obj,
        }
    ]
}
Enter fullscreen mode Exit fullscreen mode

The "post_unique_id" serves as a unique identifier and is indexed for efficient retrieval. The "change_logs" array stores instances of the post object representing modifications over time.

To view the post details and history, a separate AJAX call was integrated into the moderation console. This call retrieves both the initial and the last modified data, providing a comprehensive view of the post's evolution.

We wrapped up the whole setup — design, backend, and web frontend—in just four days. For the past two years, the system has been strong and reliable, effortlessly managing numerous post modifications. Teamwork played a key role in making it all work seamlessly.

P.S:
We specialise in procuring products and fostering application developments from overseas. Our robust team excels in mobile app development, encompassing Android, iOS, and Flutter platforms, as well as web app and dashboard development.

Our track record includes successfully conceptualising, developing, and delivering applications and infrastructure that have seamlessly scaled from initial stages to serving millions of users.

For further inquiries and detailed discussions, please feel free to connect with us:
https://pods.studio/
https://www.linkedin.com/in/jaleelnazir/

Top comments (0)