Skip to content
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

BE- Ability to edit a contact #67

Open
2 of 10 tasks
epintozzi opened this issue Dec 20, 2024 · 2 comments
Open
2 of 10 tasks

BE- Ability to edit a contact #67

epintozzi opened this issue Dec 20, 2024 · 2 comments
Assignees

Comments

@epintozzi
Copy link
Contributor

epintozzi commented Dec 20, 2024

Description: Create a back-end endpoint to edit an existing contact.

  • Walk through FE Web Application and Miro Board to see where this endpoint will be used
  • Add Endpoint PATCH http://localhost:3001/api/v1/users/:user_id/contacts/contact_id to routes.rb
  • Write basic RSpec request tests for this endpoint
  • Write basic Model tests for this endpoint, if needed
  • Add update method to contacts_controller.rb
  • Add logic to the contact.rb model, if needed
  • Add error handling
  • Update BE Readme with the endpoint, request body, and expected response
  • Add sad path tests
  • Add edge case tests

*Each check box item should include at least one commit message.

@epintozzi epintozzi moved this to Backlog in Tracker CRM Dec 20, 2024
@epintozzi epintozzi moved this from Backlog to Todo in Tracker CRM Jan 23, 2025
@TDManning
Copy link
Collaborator

TDManning commented Feb 4, 2025

Edit a contact content for ReadMe and Postman tests:

PATCH http://localhost:3001/api/v1/users/:user_id/contacts/contact_id

Request Body:

{
  "contact": {
    "first_name": "Jonny",
    "last_name": "Smith",
    "company_id": 1,
    "email": "[email protected]",
    "phone_number": "555-785-5555",
    "notes": "Good contact for XYZ",
    "user_id": 7
  }
}

*Must change a field

Expected JSON response:

{
    "data": {
        "id": "6",
        "type": "contacts",
        "attributes": {
            "first_name": "Jonny",
            "last_name": "Smith",
            "company_id": 1,
            "email": "[email protected]",
            "phone_number": "555-785-5555",
            "notes": "Good contact for XYZ",
            "user_id": 4,
            "company": {
                "id": 1,
                "name": "Tech Innovators",
                "website": "https://techinnovators.com",
                "street_address": "123 Innovation Way",
                "city": "San Francisco",
                "state": "CA",
                "zip_code": "94107",
                "notes": "Reached out on LinkedIn, awaiting response."
            }
        }
    }
}

@TDManning TDManning moved this from Todo to In Progress in Tracker CRM Feb 4, 2025
@TDManning TDManning changed the title Ability to edit a contact Ability to edit a contact BE Feb 4, 2025
@TDManning TDManning changed the title Ability to edit a contact BE BE- Ability to edit a contact Feb 5, 2025
@TDManning
Copy link
Collaborator

Update: Waiting for contacts controller and model refactors before I can add this endpoint. Will transition to README and other planning for end point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

2 participants