Skip to content
This repository has been archived by the owner on Mar 23, 2021. It is now read-only.
/ mvp-backend Public archive

Minimum Viable Product Backend for Opus (Depreciated)

License

Notifications You must be signed in to change notification settings

opustm/mvp-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Home to the opus-tm Django REST API

This API serves our React Web App

Test Users: (password and username are the same, email is <username>@example.com)

For the time-being, please do not register any more users unless testing email invitation/registration - Management

  • test
  • dvader
  • lukeskywalker
  • leiaskywalker

Test Cliques:

  • Test
  • The Dark Side

Endpoints:

User

  • /currentUser/
  • /addUsers/
  • /users/
  • /users/<userId>/
  • /userDetails/<username>/
  • /userEmailDetails/<userEmail>/

Clique

  • /cliques/
  • /cliques/<cliqueId>/
  • /cliqueDetails/<cliqueName>/
  • /cliqueMembers/<cliqueName>/

Invitation

  • /invitations/
  • /invitation/<invitationId>/
  • /invitationDetails/<inviteeEmail>/
  • /userInvitations/<username>/

Request

  • /requests/
  • /requests/<requestId>/
  • /cliqueRequests/<cliqueName>/

Event

  • /events/
  • /events/<cliqueEventId>/
  • /cliqueEvents/<cliqueName>/

Schedule

  • /schedules/
  • /schedules/<scheduleId>/
  • /userSchedules/<username>/
  • /timeframes/
  • /timeframes/<timeFrameId>/
  • /scheduleTimeFrames/<scheduleId>/

Announcement

  • /announcements/
  • /announcements/<announcementId>/
  • /cliqueAnnouncements/<cliqueName>/

Message

  • /directMessages/
  • /directMessages/<directMessageId>/
  • /userDirectMessagesSent/<username>/
  • /userDirectMessagesRecieved/<username>/
  • /cliqueMessages/
  • /cliqueMessages/<cliqueMessageId>/
  • /cliqueCliqueMessages/<cliqueName>/
  • /reactions/
  • /reactions/<reactionId>/

To Do

  • /toDos/
  • /toDos/<toDoId>/
  • /userToDos/<username>/

Token

  • /tokenAuth/

Django Admin

  • /admin/

DEPLOYMENT:

For now we have stuck to Heroku for the sake of familiarity. Future plans possibly include deplyment on AWS. To ensure that we always have a working build, we also deploy a staging build to use in development: Staging Build

DATABASE:

PostgreSQL. We mainly decided on this because of the ease of access with Heroku. However, we are also able to configure Django to run SQLite when testing locally. The pros and cons of each are described well in this article

DJANGO MODEL & DIAGRAM:

Django enables the creation of database model objects in python. Once each model is created, Django automatically creates migrations in which it can create, update, and generate SQL to add to the database based on the python models. The structure of the database is depicted in model.py:

A diagram of this django model as generated by GraphViz: Diagram to come

DJANGO-ADMIN:

Found at the /admin route of the API. After logging into an admin account, a site administrator can easily manage the database tables without the need to write any SQL. Read more here

JWT:

Alongside Django REST we also use JSON-Web Token authentication for secure data transfer. We decided to implement this because it has been an IETF standard in the defined by the RFC7519 since 2015.

CORS/CSRF:

We set up a white-list to only allow certain clients make requests to the API. This helps to make sure that only our React app will have access to the database.