Skip to content

Persist chat messages for 24 hours via mongodb #1553

Open

Description

@evanugarte

game plan

  • follow dessert tutorial
  • Create a new model called ChatMessage in api/main_endpoints/models, the model should have 5 fields, createdAt, expiresAt, chatroomId, userId and text
  • have the model create an index on the createdAtField and chatroomId fields
  • adjust /send to include writing to mongodb with your new collection, specifically the writeMessage function
    router.post('/send', async (req, res) => {
  • change /getLatestMessage to return the messages from mongodb on a specific room id, test if this works with postman
    • you can comment out the token verification code to test without authentication
  • once the above works, open a pr for just the backend changes
  • once the pr is merged, lets move onto calling /getLatestMessage once the user joins a chatroom, so they can load the ongoing messages from users.

Activity

  1. self-assigned this
    on Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions