Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

33 Commits

Repository files navigation


Ogma app logo
Ogma App Backend

Summary

This project delivers and API that includes a CRUD type service for users for our app.

How To Use

To clone and run this application, you'll need Git and Python 3 installed on your computer. From your command line:

# Clone this repository
$ git clone https://github.com/OgmaCapStone/Backend.git

# Go into the repository
$ cd backend

# Create virtual enviroment
$ python -m venv .env

# Enter the virtual enviroment
$ source .env/bin/activate

# Install dependencies
$ pip install -r requirements.txt

# Don't forget to set up your own .env file

# Run the app
$ uvicorn app.main:app

Credits

This software uses :

With the supervision of Erik Ochoa, Academic Coach at Platzi Master

Collaborators

This app was created with 馃挌 by:

Elsa Portilla 聽路聽 Frontend Developer 聽路聽 LinkedIn @elsaportilla 聽路聽 GitHub @elsargentpepper 聽路聽

Jorge Delgadillo 聽路聽 Backend Developer (backend repo) 聽路聽 LinkedIn @jorge-alberto-delgadillo-alonso-7b58501aa 聽路聽 GitHub @49122 聽路聽

Juan Camilo Garc茅s 聽路聽 Frontend Developer 聽路聽 LinkedIn @juancamilogarcesviveros 聽路聽 GitHub @camilogarcesv 聽路聽 Twitter @Camilo_GarcesV 聽路聽

Juan Daniel Mart铆nez 聽路聽 Frontend Developer 聽路聽 juanda.dev 聽路聽 GitHub @juandadev 聽路聽 Twitter @juanda_dev_

Sebasti谩n Ballen 聽路聽 Frontend Developer 聽路聽 sebastianbc09.github.io 聽路聽 LinkedIn @sebastian-ballen-87851518a 聽路聽 GitHub @SebastianBC09 聽路聽

API

Users

/users/create

-- Post -- Expected request body:

	{
	  "name": str,
	  "email": str,
	  "password": str,
	  "login_type": str,
	  "username": str,
	}

-- Expected response:

	{
	  "response": "User created"
	}

-- Possible errors:

  • 422: If the information given in the request body does not align with what is asked of it.
  • 400: If the information given was invalid

/user

-- GET -- Expected request param (One or the other):

  • username: str
  • email: str

-- Expected response:

	{
	  "response": {
	    "name": str,
	    "email": str,
	    "username": str,
	    "badges": [
	      str
	    ],
	    "prefered_technologies": [
	      str
	    ],
	    "profile_pic": str
	  }
	}

-- Possible errors:

  • 422: If the information given in the param does not align with what is asked of it.
  • 400: If the information given was invalid
  • 400: If you tried to send both email and username
  • 400: If the user does not exist

/user/edit

-- POST -- Expected request body:

 {
	    
	    "name": Optional[str],
	    "email": Optional[str],
	    "username": Optional[str],
	    "password": Optional[str],
	    "login_type": Optional[str],
	    "badges": Optional[[
	      str
	    ]],
	    "prefered_technologies": Optional[[
	      str
	    ]],
	    "profile_pic": Optional[str]
	  
	}

-- Expected response:

	{
	  "response": "User updated"
	}

-- Possible errors:

  • 422: If the information given in the param does not align with what is asked of it.
  • 400: If the information given was invalid
  • 400: If the user does not exist

/user/delete

-- DELETE -- Expected request body:

 {
	    
	    "name": MANDATOY[str],
	    "email": Optional[str],
	    "username": Optional[str],
	    "password": Optional[str],
	    "login_type": Optional[str],
	    "badges": Optional[[
	      str
	    ]],
	    "prefered_technologies": Optional[[
	      str
	    ]],
	    "profile_pic": Optional[str]
	  
	}

-- Expected response:

	{
	  "response": "User delete"
	}

-- Possible errors:

  • 422: If the information given in the param does not align with what is asked of it.
  • 400: If the information given was invalid
  • 400: If the user does not exist

Questions

/questions

-- GET -- Expected request params:

  • technology: str
  • level: str
  • number_of_questions: int

-- Expected response:

	{

	"response": {

		"questions": [

			{

			"question": str,

			"answers": [str],

			"correct_answer_index": int,

			"image": str

			}
		]
	}

-- Possible errors:

  • 422: If the information given in the param does not align with what is asked of it.
  • 400: If the data base does not have enough questions to give a proper response

/questions/add

-- POST -- Expected request body:

{

	"question": str,

	"answers": [str],

	"right_answer": str,
	
	"level": int,

	"technology": int,

	"image": str,

	"password": str

}

-- Expected response:

	{
	  "response": "Question added"
	}

-- Possible errors:

  • 422: If the information given in the param does not align with what is asked of it.
  • 401: If the credentials are not valid
  • 400: If the question already exist

Technologies

/user/technology/add

-- POST -- Expected request body:

{
 "user":{	    
	    "name": MANDATOY[str],
	    "email": Optional[str],
	    "username": Optional[str],
	    "password": Optional[str],
	    "login_type": Optional[str],
	    "badges": Optional[[
	      str
	    ]],
	    "prefered_technologies": Optional[[
	      str
	    ]],
	    "profile_pic": Optional[str]
	  
	},
"technology":{
		"name": str
	}
}

-- Expected response:

	{
	  "response": "Technology added"
	}

-- Possible errors:

  • 422: If the information given in the param does not align with what is asked of it.
  • 400: If the credentials user does not exist
  • 400: If the user already has the technology added

/user/technology/remove

-- DELETE -- Expected request body:

{
 "user":{	    
	    "name": MANDATOY[str],
	    "email": Optional[str],
	    "username": Optional[str],
	    "password": Optional[str],
	    "login_type": Optional[str],
	    "badges": Optional[[
	      str
	    ]],
	    "prefered_technologies": Optional[[
	      str
	    ]],
	    "profile_pic": Optional[str]
	  
	},
"technology":{
		"name": str
	}
}

-- Expected response:

	{
	  "response": "Technology removed"
	}

-- Possible errors:

  • 422: If the information given in the param does not align with what is asked of it.
  • 400: If the credentials user does not exist
  • 400: If the user already does not have selected technology

/technologies

-- GET -- Expected request params: None -- Expected response:

	{
	  "response": [
		  {
			  "name": str,
			  "image" str,
			  "summary": str
		  }
	  ]
	}

-- Possible errors:

Progress

-- /user/progress/update -- POST -- Expected request body:

{
 "user":{	    
	    "name": MANDATOY[str],
	    "email": Optional[str],
	    "username": Optional[str],
	    "password": Optional[str],
	    "login_type": Optional[str],
	    "badges": Optional[[
	      str
	    ]],
	    "prefered_technologies": Optional[[
	      str
	    ]],
	    "profile_pic": Optional[str]
	  
	},
"technology":{
		"name": str
	},
"percentage": int
}

-- Expected response:

	{
	  "response": "Progress updated"
	}

-- Possible errors:

  • 422: If the information given in the param does not align with what is asked of it.
  • 400: If the credentials user does not exist

Levels

-- /levels -- GET -- Expected request params: None

-- Expected response:

	{
	  "response": [
		 str
	  ]
	}

-- Possible errors:

About

Backend

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages