sef-global / scholarx-backend

This is the backend of the ScholarX
MIT License
11 stars 38 forks source link

Implement update platform details endpoint #77

Closed Madhawa97 closed 11 months ago

Madhawa97 commented 11 months ago

Purpose

The purpose of this PR is to fix #36

Goals

The endpoint should allow Admin to update the platform details.

Approach

Utilized the existing /api/admin/platform endpoint to handle a PUT request with a body of the updated platform. Implemented the rrror handing with status codes and also the unit tests are written.

Response for update request:

{
  "platform": {
    "description": "This is a updated description.",
    "mentor_questions": [
      {
        "question": "What are your career goals?",
        "question_type": "text",
        "options": []
      },
      {
        "question": "How do you handle challenges?",
        "question_type": "text",
        "options": []
      },
      {
        "question": "Tell me about a time when you demonstrated leadership skills.",
        "question_type": "text",
        "options": []
      }
    ],
    "image_url": "https://example.com/images/sample.jpg",
    "landing_page_url": "https://example.com/landing-page",
    "email_templates": {
      "template1": {
        "subject": "Welcome to our mentoring program!",
        "body": "Dear {{mentor_name}},\n\nWe are excited to have you join our mentoring program..."
      },
      "template2": {
        "subject": "Follow-up on your mentoring session",
        "body": "Dear {{mentee_name}},\n\nI wanted to follow up on our recent mentoring session..."
      }
    },
    "title": "Sample Mentoring Program",
    "uuid": "89a1c2a6-8c39-420e-8274-a1719b1667c1",
    "created_at": "2023-10-27T10:26:10.652Z",
    "updated_at": "2023-10-27T10:26:10.652Z"
  },
  "message": "Platform updated successfully"
}

Screenshots

Checklist

Related PRs

## Test environment ## Learning
Madhawa97 commented 11 months ago

Surely will check in 3 hours. This is probably due to the entity level changes.

Madhawa97 commented 11 months ago

@anjula-sack The issue seems to have been sorted. All tests passed in the local env.