Team Production System is an app for mentees to schedule one-on-one sessions with mentors.
- Features
- Run Locally
- Running Celery and Redis Locally
- Run Locally via Docker Containers
- Environment Variables
- Adding Packages
- Testing
- Linting
- Submitting Code
- API Reference
Contributions are always welcome!
See contributing.md for ways to get started.
Please adhere to this project's code of conduct.
- Users can setup profiles as a mentor or mentee.
- Mentors can set their skill set and availabilty.
- Mentees can schedule sessions with the mentors, filtered by skills and availabilty
- Mentors can confirm sessions
- Both mentor and mentee can cancel a session prior to session start time.
Clone the project:
git clone https://github.com/TeamProductionSystem/Team_Production_System_BE.git
Navigate to the project directory:
cd Team_Production_System_BE
Set up a virtual environment for the project using pipenv. If you don't have pipenv installed, you can install it using pip:
pip install pipenv
Then, activate the virtual environment by running:
pipenv shell
Install the project dependencies:
pipenv install
Set up the database by running the migrations:
python manage.py migrate
đź’ˇNote: If this command throws an error, you might not have setup your database, or configured your DATABASE_URL env variable properly.
Start the development server:
python manage.py runserver
The app should now be running at http://localhost:8000/
These servers are only needed if you want 15/60 minute reminders of scheduled sessions. Run each of the following commands in its own terminal window at the project root.
Start the Redis server:
redis-server
Start the Celery server:
celery -A config.celery_settings worker --loglevel=info
Start the Celery Beat server:
celery -A config.celery_settings beat -l debug
Install Docker Desktop. This will also install the Docker engine and the Docker CLI. You can find installation instructions on the Docker website for Mac and Windows.
Setup your Environment Variables. You can find instructions here.
Create or update requirements.txt
with any new plugins from Pipfile:
pipenv requirements > requirements.txt
đź’ˇNote: If this step deletes everything in the requirements.txt file, your pipenv is out of date. You can update it with the following command:
pip install --user --upgrade pipenv
Run the following command:
docker compose build
If you haven't built the container before, this can take over a minute. After that, Docker will use the cached image layers as reference for future builds. You can expect the build to only take seconds.
If you want to build the image from scratch, add the flag --no-cache
to the above command.
Run the following command:
docker compose up
The app should now be running at http://localhost:8000/
You can also view the Django admin UI at the /admin/ endpoint. Use the DJANGO_SUPERUSER credentials you set in the .env file.
If you want to connect to the container database via an app like Postico 2, the settings needed are:
- Host: localhost
- Port: 5433
- Database: mentors
- User: mentors
- Password: mentors
While running, the Django server will automatically detect changes made and reload, just as if it was running in your local environment. Certain file changes, such as to a model, won't trigger this behavior. In these cases, stop then restart the containers.
To stop running the containers, hit Ctrl+C
. The container instances will not be deleted.
If you spin them up again, those same instances will be running.
If you want to delete the container instances, run the following command:
docker compose down
The database is persistant. If you make changes to a model, run makemigrations before resetting the the database. Follow these 2 steps once the containers are no longer running:
- Remove the persistant volume:
docker volume rm team_production_system_be_postgres_data
- Rebuild the docker images without the cached data:
docker compose build --no-cache
The next time you spin up the docker containers, the database will be empty again.
-
Create a file named .env in the root directory of your project. This file will contain your environment variables.
-
Open the .env file in a text editor and set your environment variables in the following format: 'VARIABLE_NAME=value'
For example:
ENVIRONMENT=dev
DATABASE_URL=postgres://mentors:mentors@localhost:5432/mentors
SECRET_KEY=my_secret_key
DEBUG=True
DJANGO_SUPERUSER_USERNAME=admin
DJANGO_SUPERUSER_PASSWORD=admin_password
[email protected]
CELERY_BROKER_URL=local_redis_url
CELERY_RESULT_BACKEND=local_redis_url
AWS_ACCESS_KEY_ID=from-your-aws-account
AWS_SECRET_ACCESS_KEY=also_from-your-aws-account
AWS_STORAGE_BUCKET_NAME=your-aws-s3-bucket
EMAIL_HOST=usually-gmail
[email protected]
EMAIL_HOST_PASSWORD=do-not-share
SENTRY_DSN=not-necessary-for-running-locally
-
ENVIRONMENT: This should be either
dev
orprod
, depending on what environment the app is running in. As long as your are running locally, use the valuedev
. -
DATABASE_URL: This should be set to the URL of your database. Depending on your database type, this may include a username, password, host, and port. When using a local PostgreSQL database, it should take the form
postgres://<username>:<password>@localhost:5432/<db-name>
-
SECRET_KEY: This should be set to a secret key that is used for cryptographic signing in Django. It is important that this value is kept secret and is not shared publicly.
-
DEBUG: This should be set to a boolean value (True or False) and is used to enable or disable debugging in Django. It is recommended to set this to False in production environments.
-
DJANGO_SUPERUSER_USERNAME: This should be set to the username you want to use for the Django superuser account.
-
DJANGO_SUPERUSER_PASSWORD: This should be set to the password you want to use for the Django superuser account.
-
DJANGO_SUPERUSER_EMAIL: This should be set to the email address you want to use for the Django superuser account.
-
CELERY_BROKER_URL: This should be set to your local redis url.
-
CELERY_RESULT_BACKEND: This should be set to your local redis url.
-
AWS_ACCESS_KEY: This should be set to your AWS account.
-
AWS_SECRET_ACCESS_KEY: This should be set to your AWS account.
-
AWS_STORAGE_BUCKET_NAME: This should be set to your AWS S3 instance.
-
EMAIL_HOST: This should be set to the email account you want to use.
-
EMAIL_HOST_USER: This should be set to the email account you want to use.
-
EMAIL_HOST_PASSWORD: This should be set to the email account you want to use.
-
SENTRY_DSN: This should be set to your Sentry account.
- Save the .env file.
Pipenv is a packaging tool for Python that solves some common problems associated with the typical development workflow using pip, virtualenv, and the requirements.txt. In addition to addressing some common issues, it consolidates and simplifies the development process to a single command line tool.
When installing new packages, you first need to assess if they are needed for production and development or only development.
For packages needed for both prod and dev, please run installation as follows:
pipenv install <package-name>
If the package is only needed for development, please run installation as follows:
pipenv install <package-name> --dev
Providing the --dev argument will put the dependency in a special [dev-packages] location in the Pipfile. These development packages only get installed if you specify the --dev argument with pipenv install.
If you update the Pipfile and are using Docker locally for development, please make sure to spin down your docker containers, copy over the Pipfile information to requirements.txt and then rebuild your containers. See Run Locally via Docker Containers for instructions.
For testing this app, we are using Django Test Case and Django REST Framework API Test Case along with coverage.py for test coverage reporting.
To run tests:
python manage.py test
đź’ˇNote: To skip a test that isn't finished, add the following before the test class:
@unittest.skip("Test file is not ready yet")
To run coverage for test:
coverage run manage.py test
After you run tests you can get the report in command-line by running:
coverage report
For an interactive html report, run:
coverage html
Then in the htmlcov
folder of the project, open the file index.html
in a browser. Here you can see an indepth analysis of coverage and what lines need testing. Click available links to view specific file coverage data.
Here is some helpful information on testing in Django and Django REST Framework: https://www.rootstrap.com/blog/testing-in-django-django-rest-basics-useful-tools-good-practices
To keep our code easy to read and use please make sure it passes flake8 linting before submitting your code. To run in terminal:
flake8
Each error will show the file name and line to find the error. The command can be run over and over again until errors are cleared.
We use several git hooks to ensure code quality and consistency. These are run using the pre-commit Python package.
Here are the processes we run for each hook:
- Pre-Commit:
- linting code with Flake8
- autoformatting code with isort and black
- Commit-Msg:
- linting commit message
- Pre-Push:
- linting branch name
- running all tests
Below, we go over how to set up and use these hooks, the linting plugins used, and the schemas for Branch Names and Commit Messages.
These steps assume you have already entered a pipenv shell and installed all dependencies. Below are the commands and expected outputs:
pre-commit install
pre-commit installed at .git/hooks/pre-commit
pre-commit install --hook-type commit-msg
pre-commit installed at .git/hooks/commit-msg
pre-commit install --hook-type pre-push
pre-commit installed at .git/hooks/pre-push
To run the pre-commit checks before making a commit, run the following command.
pre-commit run --all-files
If no files need changes, the output should look like this:
isort....................................................................Passed
black....................................................................Passed
flake8...................................................................Passed
If isort or black catch any errors, they will automatically alter the files to fix them. This will prevent making a commit, and you will need to stage the new changes. flake8 errors need to be fixed manually.
We ensure code consistancy by linting with flake8. Errors found by flake 8 will be listed in the following format:
<File Path>:<Line>:<Column>: <Error Code> <Error Message>
Error codes from flake8 will have a prefix of F. The flake8 plugins used are listed below, along with their error code prefix:
- flake8-bugbear (B): additional rules to catch bugs and design problems
- pep8-naming (N): check the PEP-8 naming conventions
- flake8-spellcheck (SC): spellcheck variables, classnames, comments, docstrings etc.
- flake8-eradicate (E): finds commented out or dead code
- flake8-clean-block (CLB): enforces a blank line after if/for/while/with/try blocks
- flake8-multiline (JS): ensures a consistent format for multiline containers
- flake8-secure-coding-standard (SCS): enforces some secure coding standards for Python
- flake8-comprehensions (C): helps you write better list/set/dict comprehensions
- flake8-quotes (Q): extension for checking quotes in Python
đź’ˇNote: If the spellcheck plugin gets caught on a name that you did not set,
add it to whitelist.txt
.
DO NOT ADD NAMES THAT YOU CREATE!!!
Branch names should be in the following format:
<type>/issue-<number>/<description>
Type: The type of branch. This should be one of the following:
- feat - Adding a new feature
- bugfix - Fixing bugs in the code
- hotfix - For emergency fixes
- test - Experimental changes for testing purposes
- chore - Changes to the build process or auxiliary tools and libraries such as documentation generation
Issue Number: The issue number associated with the branch. This should be the number of the issue in the GitHub repository or the trello board.
Description: A short description of the branch. This should be in lowercase and use dashes instead of spaces.
Example: feat/issue-66/remove-jedi
Commit messages should be in the following format:
<type>(<scope>): <description>
Type: Represents the type of change that was made. This should be one of the following:
- feat - Adding a new feature
- fix - Fixing bugs in the code
- docs - Changes to documentation
- style - Changes to code style
- refactor - Changes to code that neither fixes a bug nor adds a feature
- perf - Changes to code that improves performance
- test - Adding or updating tests
- build - Changes to the build process or dependencies
- ci - Changes to CI configuration files and scripts
- chore - Miscellaneous changes, such as updating packages or bumping a version number
- revert - Reverting a previous commit
Scope: This is optional but can provide additional contextual information. It describes the section or aspect of the codebase affected by the change. For example, auth for authentication-related changes or header for changes to a website's header component.
Description: A concise description of the changes. Start with a lowercase verb indicating what was done (e.g., add, update, remove, fix).
đź’ˇNote: This guide assumes you are using a macOS. If you are using a different operating system, only the installation step should be different. Here are guides for Windows and Linux.
Install PostgreSQL on your machine, then run it as a background service:
brew install postgresql@15
brew services start postgresql@15
Next, create a user:
createuser -d <username>
Then, create a database:
createdb -U <username> <dbname>
API URL - https://team-production-system.onrender.com
- User Endpoints
- Mentor Endpoints
- Mentee Endpoints
- Availability Endpoints
- Session Endpoints
- Notification Endpoints
- Create a new user
- đź’ˇNote: the username will automatically be converted to all lowercase letters
POST https://team-production-system.onrender.com/auth/users/
Body | Type | Description |
---|---|---|
username |
string |
New Username |
password |
string |
User generated password |
re_password |
string |
User generated password |
email |
string |
User generated email |
POST /auth/users/
Content-Type: json
Authorization: N/A
Host: https://team-production-system.onrender.com
{
"username": "TestUserLogin",
"email": "[email protected]",
"password": "TestUserPassword",
"re_password": "TestUserPassword"
}
{
"email": "[email protected]",
"username": "testuserlogin",
"id": 5
}
- Create a user token.
- Username must be lowercase
POST - https://team-production-system.onrender.com/auth/token/login/
Body | Type | Description |
---|---|---|
username |
string |
Username (lowercase) |
password |
string |
User generated password |
POST /auth/token/login/
Content-Type: json
Authorization: N/A
Host: https://team-production-system.onrender.com
{
"username": "testuserlogin" ,
"password": "TestUserPassword"
}
{
"auth_token": "****************************************"
}
- Log the current user out.
POST - https://team-production-system.onrender.com/auth/token/logout/
Body | Type | Description |
---|---|---|
username |
string |
Username |
password |
string |
User generated password |
POST /auth/token/logout/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
"username": "testuserlogin" ,
"password": "TestUserPassword"
}
No body returned for response
- View the current logged in users information
GET - https://team-production-system.onrender.com/myprofile/
Body | Type | Description |
---|---|---|
username |
string |
Username |
first_name |
string |
User generated first name |
last_name |
string |
User generated last name |
email |
string |
User generated email |
phone_number |
string |
User generated phone number |
profile_photo |
form-data |
User submitted profile photo |
is_mentor |
boolean |
Is mentor flag |
is_mentee |
boolean |
Is mentee flag |
is_active |
boolean |
Is active flag |
GET /myprofile/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
{
"pk": 6,
"username": "testusername",
"first_name": "",
"last_name": "",
"email": "[email protected]",
"phone_number": null,
"profile_photo": null,
"is_mentor": false,
"is_mentee": false,
"is_active": true
}
- Update the users profile information.
- đź’ˇNote: This endpoint has multipart/form-data content type.
PATCH - https://team-production-system.onrender.com/myprofile/
Body | Type | Description |
---|---|---|
username |
string |
Username |
first_name |
string |
User generated first name |
last_name |
string |
User generated last name |
email |
string |
User generated email |
phone_number |
string |
User generated phone number |
profile_photo |
form-data |
User submitted profile photo |
is_mentor |
boolean |
Is mentor flag |
is_mentee |
boolean |
Is mentee flag |
is_active |
boolean |
Is active flag |
PATCH /myprofile/
Content-Type: Multipart/form-data
Authorization: Required
Host: https://team-production-system.onrender.com
body: MultiPartFormData,
Example:
{
"username": "testusername",
"first_name": "testuserfirstname",
"last_name": "testuserlastname",
"email": "[email protected]",
"phone_number": "+12345678987",
"profile_photo": ".../testuser.jpg",
"is_mentor": true
}
{
"pk": 6,
"username": "testusername",
"first_name": "testuserfirstname",
"last_name": "testuserlastname",
"email": "[email protected]",
"phone_number": "+12345678987",
"profile_photo": ".../testuser.jpg",
"is_mentor": true,
"is_mentee": false,
"is_active": true
}
- View a list of all user with the mentors flag (Expired availabilties are filtered out)
GET - https://team-production-system.onrender.com/mentor/
Body | Type | Description |
---|---|---|
pk |
int |
The user pk |
username |
string |
Username |
first_name |
string |
User generated first name |
last_name |
string |
User generated last name |
is_mentor |
boolean |
Is mentor flag |
profile_photo |
form-data |
User submitted profile photo |
Nested Information:
Body | Type | Description |
---|---|---|
about_me |
string |
Information about the user |
skills |
string |
Skills the user has |
availabilities |
array |
Availabilities the mentor has |
GET /mentor/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
[
{
"pk": 6,
"username": "testusername",
"first_name": "Test",
"last_name": "User",
"is_mentor": true,
"mentor_profile": {
"about_me": "I am test user",
"skills": [
"CSS",
"JavaScript",
"Django"
]
"availabilities": [
{
"pk": 2,
"mentor": 6,
"start_time": "2023-04-12T05:30:00Z",
"end_time": "2023-04-12T15:30:00Z"
},
]
}
}
]
- Create information about the current logged-in mentor.
POST - https://team-production-system.onrender.com/mentorinfo/
Body | Type | Description |
---|---|---|
pk |
int |
The mentor pk |
about_me |
string |
Information about the user |
skills |
array |
Skills the user has |
team_number |
int |
Mentor's team number |
Nested Information:
Body | Type | Description |
---|---|---|
availabilities |
array |
Availabilities the mentor has |
POST /mentorinfo/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
"about_me": "Hi, I am so and so and do such and such",
"skills": ["CSS"],
"team_number": 10,
}
{
"pk": 1,
"about_me": "Hi, I am so and so and do such and such",
"skills": [
"CSS"
],
"availabilities": [],
"team_number": 10
}
- Retrieve information about the current logged-in mentor.
GET - https://team-production-system.onrender.com/mentorinfo/
Body | Type | Description |
---|---|---|
pk |
int |
The mentor pk |
about_me |
string |
Information about the user |
skills |
string |
Skills the user has |
team_number |
int |
Mentor's team number |
Nested Information:
Body | Type | Description |
---|---|---|
availabilities |
array |
Availabilities the mentor has |
GET /mentorinfo/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
{
"pk": 1,
"about_me": "Hi, I am so and so and do such and such",
"skills": [
"CSS"
],
"availabilities": [
{
"pk": 1,
"mentor": 2,
"start_time": "2023-04-12T14:30:00Z",
"end_time": "2023-04-12T15:30:00Z"
}
],
"team_number": 10
}
- Update information about the current logged-in mentor.
PATCH - https://team-production-system.onrender.com/mentorinfoupdate/
Body | Type | Description |
---|---|---|
pk |
int |
The mentor pk |
about_me |
string |
Information about the user |
skills |
array |
Skills the user has |
team_number |
int |
Mentor's team number |
Nested Information:
Body | Type | Description |
---|---|---|
availabilities |
array |
Availabilities the mentor has |
PATCH /mentorinfoupdate/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
"skills": "Python"
}
{
"pk": 1,
"about_me": "Hi, I am so and so and do such and such",
"skills": [
"Python"
],
"availabilities": [
{
"pk": 1,
"mentor": 2,
"start_time": "2023-04-12T14:30:00Z",
"end_time": "2023-04-12T15:30:00Z"
}
],
"team_number": 10
}
- Delete information about the current logged-in mentor.
DELETE - https://team-production-system.onrender.com/mentorinfoupdate/
Body | Type | Description |
---|---|---|
about_me |
string |
Information about the user |
skills |
string |
Skills the user has |
DELETE /mentorinfoupdate/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
No body returned to response
- View a list of mentors filtered by their skill.
GET - https://team-production-system.onrender.com/mentor/<str:skills>/
Body | Type | Description |
---|---|---|
about_me |
string |
Information about the user |
skills |
string |
Skills the user has |
GET mentor/<str:skills>/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
[
{
"pk": 2,
"about_me": "Hi i'm testuser, I like to code.",
"skills": [
"HTML",
]
},
{
"pk": 5,
"about_me": "Coding is so fun",
"skills": [
"HTML",
"CSS",
"Django"
]
},
{
"pk": 6,
"about_me": "Hi, I'm testuser",
"skills": "HTML"
}
]
- View a list of all user with the mentee flag set to true
GET - https://team-production-system.onrender.com/mentee/
Body | Type | Description |
---|---|---|
pk |
int |
The user pk |
username |
string |
Username |
first_name |
string |
User generated first name |
last_name |
string |
User generated last name |
is_mentee |
boolean |
Is mentee flag |
profile_photo |
form-data |
User submitted profile photo |
Nested Information:
Body | Type | Description |
---|---|---|
team_number |
int |
Team number associated with the user |
GET /mentee/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
[
{
"pk": 4,
"username": "testusername",
"first_name": "Test",
"last_name": "User",
"is_mentee": true,
"mentee_profile": {
"team_number": 4
}
}
]
- Create information about the current logged-in mentee.
POST - https://team-production-system.onrender.com/menteeinfo/
Body | Type | Description |
---|---|---|
team_number |
int |
Team number associated with the user |
POST /menteeinfo/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
"team_number": "4"
}
[
{
"team_number": 4
}
]
- Retrieve information about the current logged-in mentee.
GET - https://team-production-system.onrender.com/menteeinfo/
Body | Type | Description |
---|---|---|
team_number |
int |
Team number associated with the user |
GET /menteeinfo/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
[
{
"team_number": 4
}
]
- Update information about the current logged-in mentee.
PATCH - https://team-production-system.onrender.com/menteeinfoupdate/
Body | Type | Description |
---|---|---|
team_number |
int |
Team number associated with the user |
PATCH /menteeinfoupdate/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
[
{
"team_number": "5"
}
]
{
"team_number": 5
}
- Delete information about the current logged-in mentee.
DELETE - https://team-production-system.onrender.com/menteeinfoupdate/
Body | Type | Description |
---|---|---|
team_number |
int |
Team number associated with the user |
DELETE /menteeinfoupdate/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
No body returned to response
- Get mentor availabilty
- This endpoint filters out any expired availabilty. Only shows availabilty that is in the future.
GET - https://team-production-system.onrender.com/availabilty/
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the availabilty |
mentor |
int |
The pk of the mentor attached to the availabilty |
start_time |
date-time |
Start time of the availabilty |
end_time |
date-time |
Start time of the availabilty |
GET /availabilty/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
[
{
"pk": 19,
"mentor": 4,
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T15:30:00Z"
},
{
"pk": 20,
"mentor": 5,
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T15:30:00Z"
},
{
"pk": 21,
"mentor": 4,
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T15:30:00Z"
},
{
"pk": 22,
"mentor": 7,
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T15:30:00Z"
}
]
- Get mentor availabilty
- This endpoint filters out any expired availabilty
- Only shows availabilty with end_time in future.
- Availability reponse ordered from present to future
- Must pass version number in headers.
GET - https://team-production-system.onrender.com/availabilty/
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the availabilty |
mentor |
int |
The pk of the mentor attached to the availabilty |
start_time |
date-time |
Start time of the availabilty |
end_time |
date-time |
Start time of the availabilty |
status |
string |
Status of the availability |
GET /availabilty/
Content-Type: json
Accept: version=v2
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
[
{
"pk": 19,
"mentor": 4,
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T15:30:00Z"
},
{
"pk": 20,
"mentor": 5,
"start_time": "1999-12-31T15:30:00Z",
"end_time": "1999-12-31T16:30:00Z"
},
{
"pk": 21,
"mentor": 4,
"start_time": "1999-12-31T16:30:00Z",
"end_time": "1999-12-31T18:30:00Z"
},
{
"pk": 22,
"mentor": 7,
"start_time": "1999-12-31T18:30:00Z",
"end_time": "1999-12-31T19:30:00Z"
}
]
- Add mentor availabilty
- Start time must be in the future
- End time must be after start time
POST - https://team-production-system.onrender.com/availabilty/
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the availabilty |
mentor |
int |
The pk of the mentor attached to the availabilty |
start_time |
date-time |
Start time of the availabilty |
end_time |
date-time |
Start time of the availabilty |
POST /availabilty/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T15:30:00Z"
}
{
"pk": 23,
"mentor": 4,
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T14:30:00Z"
}
- Add mentor availabilty
- Availability saves to database in 30 min chunks
- Status defaults to 'Open'
- Must pass version number in headers.
POST - https://team-production-system.onrender.com/v2/availabilty/
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the availabilty |
mentor |
int |
The pk of the mentor attached to the availabilty |
start_time |
date-time |
Start time of the availabilty |
end_time |
date-time |
Start time of the availabilty |
status |
string |
Status of the availability |
POST /v2/availabilty/
Content-Type: json
Accept: version=v2
Authorization: Required
Host: https://team-production-system.onrender.com
{
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T15:30:00Z"
}
[
{
"pk": 23,
"mentor": 1,
"start_time": "1999-12-31T14:30:00Z",
"end_time": "1999-12-31T15:00:00Z",
"status": "Open"
},
{
"pk": 24,
"mentor": 1,
"start_time": "1999-12-31T15:00:00Z",
"end_time": "1999-12-31T15:30:00Z",
"status": "Open"
},
]
- Delete a mentor availabilty
DELETE - https://team-production-system.onrender.com/availabilty/<int:pk>/
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the availabilty |
DELETE /availabilty/<int:pk>/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
No body returned to response
- Get a list of all sessions
GET - https://team-production-system.onrender.com/session/
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the session |
mentor_firstname |
string |
The first name of the mentor attached to session |
mentor_lastname |
string |
The last name of the mentor attached to session |
mentor_avaliabilty |
int |
The avalibility pk attached to mentor |
mentor |
int |
The pk of the mentor attached to the availabilty |
mentee |
int |
The pk of the mentee attached to the session |
start_time |
date-time |
Start time of the availabilty |
end_time |
date-time |
Start time of the availabilty |
status |
string |
Status of the session |
session_length |
int |
Length of the session |
GET /session/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
[
{
"pk": 5,
"mentor_first_name": "Test User",
"mentor_last_name": "Test User",
"mentor_availability": 2,
"mentee": 3,
"start_time": "2023-04-12T15:30:00Z",
"end_time": "2023-04-12T16:00:00Z",
"status": "Pending",
"session_length": 60
},
{
"pk": 2,
"mentor_first_name": "Test User",
"mentor_last_name": "Test User",
"mentor_availability": 2,
"mentee": 3,
"start_time": "2023-04-12T15:30:00Z",
"end_time": "2023-04-12T16:00:00Z",
"status": "Confirmed",
"session_length": 30
},
{
"pk": 6,
"mentor_first_name": "Test User",
"mentor_last_name": "Test User",
"mentor_availability": 2,
"mentee": 3,
"start_time": "2023-04-12T15:30:00Z",
"end_time": "2023-04-12T16:00:00Z",
"status": "Confirmed",
"session_length": 30
},
{
"pk": 7,
"mentor_first_name": "Test User",
"mentor_last_name": "Test User",
"mentor_availability": 2,
"mentee": 3,
"start_time": "2023-04-12T15:30:00Z",
"end_time": "2023-04-12T16:00:00Z",
"status": "Canceled",
"session_length": 30
}
]
- Get a list of all archived sessions (start time earlier than 24 hrs before time of request)
GET - https://team-production-system.onrender.com/archivesession/
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the session |
mentor_firstname |
string |
The first name of the mentor attached to session |
mentor_lastname |
string |
The last name of the mentor attached to session |
mentor_avaliabilty |
int |
The avalibility pk attached to mentor |
mentor |
int |
The pk of the mentor attached to the availabilty |
mentee |
int |
The pk of the mentee attached to the session |
start_time |
date-time |
Start time of the availabilty |
end_time |
date-time |
Start time of the availabilty |
status |
string |
Status of the session |
session_length |
int |
Length of the session |
GET /archivesession/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
""
}
[
{
"pk": 1,
"mentor_first_name": "Test-mentor",
"mentor_last_name": "Test-mentor",
"mentor_availability": 1,
"mentee": 3,
"mentee_first_name": "Test-mentee",
"mentee_last_name": "Test-mentee",
"start_time": "2023-05-22T12:00:00Z",
"end_time": "2023-05-22T12:30:00Z",
"status": "Confirmed",
"session_length": 30
}
]
- Create a session with a mentor
POST - https://team-production-system.onrender.com/sessionrequest/
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the session |
mentor_firstname |
string |
The first name of the mentor attached to session |
mentor_lastname |
string |
The last name of the mentor attached to session |
mentor_avaliabilty |
int |
The avalibility pk attached to mentor |
mentor |
int |
The pk of the mentor attached to the availabilty |
mentee |
int |
The pk of the mentee attached to the session |
start_time |
date-time |
Start time of the availabilty |
end_time |
date-time |
Start time of the availabilty |
status |
string |
Status of the session |
session_length |
int |
Length of the session |
POST /sessionrequest/
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
"mentor_availability": 8,
"start_time": "2020-06-23T21:30:00.000Z",
"session_length": 60
}
{
"pk": 8,
"mentor_first_name": "testuser",
"mentor_last_name": "testuser",
"mentor_availability": 8,
"mentee": 3,
"mentee_first_name": "Test",
"mentee_last_name": "Mentee",
"start_time": "2020-04-26T21:00:00Z",
"end_time": "2020-04-26T22:00:00Z",
"status": "Pending",
"session_length": 60
}
- Update a session status
PATCH - https://team-production-system.onrender.com/sessionrequest/<int:pk>
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the session |
mentor_firstname |
string |
The first name of the mentor attached to session |
mentor_lastname |
string |
The last name of the mentor attached to session |
mentor_avaliabilty |
int |
The avalibility pk attached to mentor |
mentor |
int |
The pk of the mentor attached to the availabilty |
mentee |
int |
The pk of the mentee attached to the session |
start_time |
date-time |
Start time of the availabilty |
end_time |
date-time |
Start time of the availabilty |
status |
string |
Status of the session |
session_length |
int |
Length of the session |
PATCH /sessionrequest/<int:pk>
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
"status": "Confirmed"
}
{
"pk": 8,
"mentor_first_name": "testuser",
"mentor_last_name": "testuser",
"mentor_availability": 8,
"mentee": 3,
"start_time": "2020-04-26T21:00:00Z",
"end_time": "2020-04-26T22:00:00Z",
"status": "Confirmed",
"session_length": 60
}
- Update user's notification settings
PATCH - https://team-production-system.onrender.com/notificationsettings/<int:pk>
Body | Type | Description |
---|---|---|
pk |
int |
The pk of the notification |
session_requested |
boolean |
Session requested notification flag |
session_confirmed |
boolean |
Session confirmation notification flag |
session_canceled |
boolean |
Session cancellation notification flag |
fifteen_minute_alert |
boolean |
15-minute alert notification flag |
sixty_minute_alert |
int |
60-minute alert notification flag |
PATCH /notificationsettings/<int:pk>
Content-Type: json
Authorization: Required
Host: https://team-production-system.onrender.com
{
"sixty_minute_alert": "True"
}
{
"pk": 4,
"user": 3,
"session_requested": false,
"session_confirmed": false,
"session_canceled": true,
"fifteen_minute_alert": false,
"sixty_minute_alert": true
}