RealDevSquad / RealDevSquad/website-backend

Enhancement : Store CreatedAt and updatedAt field in firestore document when the document is created/updated

Open
#1,777 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
74
Forks
276
Avg merge
1d 26m
Merged PRs (30d)
14

Description

Issue Description

The updatedAt field in our Firebase collection documents is inconsistently updated by developers through the API, leading to data inconsistencies.

Expected Behavior

The updatedAt field should be consistently updated whenever changes are made to the document, ensuring accurate and up-to-date timestamps.

Current Behavior

Currently, developers are not consistently updating the updatedAt field when modifying data through the API, resulting in discrepancies in timestamp accuracy across documents.

Severity/Priority
  • Critical
  • High
  • Medium
  • Low
Possible Solutions
  • Implement Server-Side Solution:
    Create a Firebase Cloud Function to automatically update the updatedAt field whenever changes are made to the document. This ensures the timestamp remains accurate and consistent, even if developers forget to update it manually.

  • Add updatedAt and createdAt in Request Body:
    Post validation, include updatedAt and createdAt fields in the request body. During document creation or update, fetch these from the request body and update the document accordingly.

  • Validator Check:
    In the validator, verify whether the client is sending createdAt and updatedAt fields. If not, throw a 400 Bad Request error.

I found this stackoverlow ticket helful

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by locating the API paths that create and update Firestore documents, along with the request validator, and review how Firebase Cloud Functions could fit. Done means createdAt and updatedAt are consistently present and accurate for document creation and updates.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, javascript, nodejs
Domain
api, backend, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.