ScholarX Model Update to Improve the Mentor Application

The existing scholarx model is designed to keep only two hardcoded mentor application questions. But the requirement is to get all the necessary details from a mentor right then and there in the mentor application process to make a good comprehensive profile so everything from selecting mentors for the program to mentees selecting mentors for themselves would be easier.

The Current Model

Mentor Application Wireframes

The New Model
Even though we could have just added more columns to the existing mentor model or make a secondary table to keep the mentor responses I thought of going with a different approach. This new approach will provide admins with the ability to add questions to the mentor application as they go, so the question system would be dynamic, not hardcoded. With this, the front end will be provided with an endpoint to get those application questions and render them out in the mentor application view.

2 Likes

Love the separation of concerns!

1 Like

New and Updated Endpoints

Question Category, ENUM - [ MENTOR, MENTEE ]

Add Questions

  • Request
POST /api/admin/programs/{programId}/questions/{Question_Category} HTTP/1.1
Host: localhost:8080
Content-Type: application/json

[
    {
        "question": "What is your highest level of education?"
    },
    {
        "question": "What is your current position/job role?"
    },
    {
        "question": "What is your organisation/institute?"
    }
]
  • Sample Response
Status: 200 OK
[
    {
        "id": 1,
        "category": "MENTOR",
        "program": {
            "id": 2,
            "title": "test program 1",
            "headline": "scholarx test ",
            "imageUrl": "sdf",
            "landingPageUrl": "slk",
            "state": "MENTOR_APPLICATION"
        },
        "question": "What is your highest level of education?"
    },
    {
        "id": 2,
        "category": "MENTOR",
        "program": {
            "id": 2,
            "title": "test program 1",
            "headline": "scholarx test ",
            "imageUrl": "sdf",
            "landingPageUrl": "slk",
            "state": "MENTOR_APPLICATION"
        },
        "question": "What is your current position/job role?"
    },
    {
        "id": 3,
        "category": "MENTOR",
        "program": {
            "id": 2,
            "title": "test program 1",
            "headline": "scholarx test ",
            "imageUrl": "sdf",
            "landingPageUrl": "slk",
            "state": "MENTOR_APPLICATION"
        },
        "question": "What is your organisation/institute?"
    }
]

Get Questions

  • Request
GET /api/programs/{programId}/questions/{Question_Category} HTTP/1.1
Host: localhost:8080
  • Sample Response
Status: 200 OK
[
    {
        "id": 1,
        "category": "MENTOR",
        "program": {
            "id": 2,
            "title": "test program 1",
            "headline": "scholarx test ",
            "imageUrl": "sdf",
            "landingPageUrl": "slk",
            "state": "MENTOR_APPLICATION"
        },
        "question": "What is your highest level of education?"
    },
    {
        "id": 2,
        "category": "MENTOR",
        "program": {
            "id": 2,
            "title": "test program 1",
            "headline": "scholarx test ",
            "imageUrl": "sdf",
            "landingPageUrl": "slk",
            "state": "MENTOR_APPLICATION"
        },
        "question": "What is your current position/job role?"
    },
    {
        "id": 3,
        "category": "MENTOR",
        "program": {
            "id": 2,
            "title": "test program 1",
            "headline": "scholarx test ",
            "imageUrl": "sdf",
            "landingPageUrl": "slk",
            "state": "MENTOR_APPLICATION"
        },
        "question": "What is your organisation/institute?"
    }
]

Apply as a mentor

  • Request
POST /api/programs/{programId}/mentor HTTP/1.1
Host: localhost:8080
Content-Type: application/json

[
    {
        "question": {
            "id": 1
        },
        "response": "PhD"
    },
    {
        "question": {
            "id": 2
        },
        "response": "PhD Candidate"
    },
    {
        "question": {
            "id": 3
        },
        "response": "Monash University"
    }
]
  • Sample Response
Status: 200 OK
{
    "id": 3,
    "profile": {
        "id": 1,
        "uid": "3rt9kAbxZR",
        "email": "jondoe@gmail.com",
        "firstName": "Jon",
        "lastName": "Doe",
        "imageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQEDtOL8DCcMnQ/profile-displayphoto-shrink_100_100/0/1574510520118?e=1625702400&v=beta&t=kXh5dC_5vmr_cZvfKWCrKchgTgA3rQXNvrWjHCkGeGs",
        "headline": null,
        "type": "DEFAULT",
        "name": "JonDoe",
        "attributes": null,
        "authorities": [
            {
                "authority": "DEFAULT"
            }
        ]
    },
    "state": "PENDING",
    "program": {
        "id": 2,
        "title": "test program 1",
        "headline": "scholarx test ",
        "imageUrl": "sdf",
        "landingPageUrl": "slk",
        "state": "MENTOR_APPLICATION"
    }
}

Get mentor responses

  • Request
  1. With profileId and programId
GET /api/programs/{programId}/responses/mentor HTTP/1.1
Host: localhost:8080
  1. With mentorId
GET /api/programs/{programId}/responses/mentor?mentorId={mentorId} HTTP/1.1
Host: localhost:8080
  • Sample Response
[
    {
        "id": {
            "questionId": 1,
            "mentorId": 3
        },
        "question": {
            "id": 1,
            "category": "MENTOR",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            },
            "question": "What is your highest level of education?"
        },
        "mentor": {
            "id": 3,
            "profile": {
                "id": 1,
                "uid": "3rt9kAbxZR",
                "email": "jondoe@gmail.com",
                "firstName": "Jon",
                "lastName": "Doe",
                "imageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQEDtOL8DCcMnQ/profile-displayphoto-shrink_100_100/0/1574510520118?e=1625702400&v=beta&t=kXh5dC_5vmr_cZvfKWCrKchgTgA3rQXNvrWjHCkGeGs",
                "headline": null,
                "type": "DEFAULT",
                "name": "JonDoe",
                "attributes": null,
                "authorities": [
                    {
                        "authority": "DEFAULT"
                    }
                ]
            },
            "state": "PENDING",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            }
        },
        "response": "PhD"
    },
    {
        "id": {
            "questionId": 2,
            "mentorId": 3
        },
        "question": {
            "id": 2,
            "category": "MENTOR",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            },
            "question": "What is your current position/job role?"
        },
        "mentor": {
            "id": 3,
            "profile": {
                "id": 1,
                "uid": "3rt9kAbxZR",
                "email": "jondoe@gmail.com",
                "firstName": "Jon",
                "lastName": "Doe",
                "imageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQEDtOL8DCcMnQ/profile-displayphoto-shrink_100_100/0/1574510520118?e=1625702400&v=beta&t=kXh5dC_5vmr_cZvfKWCrKchgTgA3rQXNvrWjHCkGeGs",
                "headline": null,
                "type": "DEFAULT",
                "name": "JonDoe",
                "attributes": null,
                "authorities": [
                    {
                        "authority": "DEFAULT"
                    }
                ]
            },
            "state": "PENDING",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            }
        },
        "response": "PhD Candidate"
    },
    {
        "id": {
            "questionId": 3,
            "mentorId": 3
        },
        "question": {
            "id": 3,
            "category": "MENTOR",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            },
            "question": "What is your organisation/institute?"
        },
        "mentor": {
            "id": 3,
            "profile": {
                "id": 1,
                "uid": "3rt9kAbxZR",
                "email": "jondoe@gmail.com",
                "firstName": "Jon",
                "lastName": "Doe",
                "imageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQEDtOL8DCcMnQ/profile-displayphoto-shrink_100_100/0/1574510520118?e=1625702400&v=beta&t=kXh5dC_5vmr_cZvfKWCrKchgTgA3rQXNvrWjHCkGeGs",
                "headline": null,
                "type": "DEFAULT",
                "name": "JonDoe",
                "attributes": null,
                "authorities": [
                    {
                        "authority": "DEFAULT"
                    }
                ]
            },
            "state": "PENDING",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            }
        },
        "response": "Monash University"
    }
]

Edit Mentor Responses

  • Request
PUT /api/programs/{programId}/responses/mentor HTTP/1.1
Host: localhost:8080
Content-Type: application/json

[
    {
        "id": {
            "questionId": 1,
            "mentorId": 3
        },
        "response": "PhD, something else"
    },
    {
        "id": {
            "questionId": 2,
            "mentorId": 3
        },
        "response": "PhD Candidate, ML Engineer"
    },
    {
        "id": {
            "questionId": 3,
            "mentorId": 3
        },
        "response": "Monash University"
    }
]
  • Sample Response
[
    {
        "id": {
            "questionId": 1,
            "mentorId": 3
        },
        "question": {
            "id": 1,
            "category": "MENTOR",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            },
            "question": "What is your highest level of education?"
        },
        "mentor": {
            "id": 3,
            "profile": {
                "id": 1,
                "uid": "3rt9kAbxZR",
                "email": "jondoe@gmail.com",
                "firstName": "Jon",
                "lastName": "Doe",
                "imageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQEDtOL8DCcMnQ/profile-displayphoto-shrink_100_100/0/1574510520118?e=1625702400&v=beta&t=kXh5dC_5vmr_cZvfKWCrKchgTgA3rQXNvrWjHCkGeGs",
                "headline": null,
                "type": "DEFAULT",
                "name": "JonDoe",
                "attributes": null,
                "authorities": [
                    {
                        "authority": "DEFAULT"
                    }
                ]
            },
            "state": "PENDING",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            }
        },
        "response": "PhD, something else"
    },
    {
        "id": {
            "questionId": 2,
            "mentorId": 3
        },
        "question": {
            "id": 2,
            "category": "MENTOR",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            },
            "question": "What is your current position/job role?"
        },
        "mentor": {
            "id": 3,
            "profile": {
                "id": 1,
                "uid": "3rt9kAbxZR",
                "email": "jondoe@gmail.com",
                "firstName": "Jon",
                "lastName": "Doe",
                "imageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQEDtOL8DCcMnQ/profile-displayphoto-shrink_100_100/0/1574510520118?e=1625702400&v=beta&t=kXh5dC_5vmr_cZvfKWCrKchgTgA3rQXNvrWjHCkGeGs",
                "headline": null,
                "type": "DEFAULT",
                "name": "JonDoe",
                "attributes": null,
                "authorities": [
                    {
                        "authority": "DEFAULT"
                    }
                ]
            },
            "state": "PENDING",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            }
        },
        "response": "PhD Candidate, ML Engineer"
    },
    {
        "id": {
            "questionId": 3,
            "mentorId": 3
        },
        "question": {
            "id": 3,
            "category": "MENTOR",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            },
            "question": "What is your organisation/institute?"
        },
        "mentor": {
            "id": 3,
            "profile": {
                "id": 1,
                "uid": "3rt9kAbxZR",
                "email": "jondoe@gmail.com",
                "firstName": "Jon",
                "lastName": "Doe",
                "imageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQEDtOL8DCcMnQ/profile-displayphoto-shrink_100_100/0/1574510520118?e=1625702400&v=beta&t=kXh5dC_5vmr_cZvfKWCrKchgTgA3rQXNvrWjHCkGeGs",
                "headline": null,
                "type": "DEFAULT",
                "name": "JonDoe",
                "attributes": null,
                "authorities": [
                    {
                        "authority": "DEFAULT"
                    }
                ]
            },
            "state": "PENDING",
            "program": {
                "id": 2,
                "title": "test program 1",
                "headline": "scholarx test ",
                "imageUrl": "sdf",
                "landingPageUrl": "slk",
                "state": "MENTOR_APPLICATION"
            }
        },
        "response": "Monash University"
    }
]

@Neith you can take a pull from my development branch and start on your task for we have to get this reviewed properly before merging

This is amazing @Gravewalker ! The thread is also well documented!
Btw, How did you overcome that JPA issue?

Seems profileID is missing here:

profileID can be taken from the authentication so no need to provide it explicitly

1 Like

Oh! Cool! Didn’t noticed it :hugs: