Skip to content

better-team-xd/xd-eats-back-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XD Eats backend

flask badge pymongo badge

Project Description

Backend of XD Eats application (Python version). We gathered data from przepisy.pl just to fill database. We used webscraping script for this purpose
Link to webscraping script
Link to original Java version
Link to frontend

API

Add recipe into system

POST http://localhost:5000/api/v1/recipes

Headers:

Key Value Description
password string Required. Password to system defined in password.py
Content-Type application/json Required.

Example body:

{
    "category": "Śniadanie",
    "imageUrl": "https://s3.przepisy.pl/przepisy3ii/img/variants/800x0/owsianka.jpg",
    "ingredients": [
        "Płatki owsiane",
        "Mleko 2%",
        "Jabłka",
        "Suszone morele",
        "Rodzynki",
        "Orzechy włoskie",
        "Cynamon do smaku"
	],
    "name": "Owsianka",
    "url": "https://www.przepisy.pl/przepis/owsianka"
}

Return message:

{
    "content": null,
    "message": "5f848f6f94e64fb9148236e7",  //id of added recipe
    "status": "SUCCESS"
}

Get all recipes from system

GET http://localhost:5000/api/v1/recipes

Return message

{
    "content": [
        {
            "_id": "5f50db95c4783da430c1eb80",
            "category": "Śniadanie",
            "imageUrl": "https://s3.przepisy.pl/przepisy3ii/img/variants/800x0/owsianka.jpg",
            "ingredients": [
                "Płatki owsiane",
                "Mleko 2%",
                "Jabłka",
                "Suszone morele",
                "Rodzynki",
                "Orzechy włoskie",
                "Cynamon do smaku"
            ],
            "name": "Owsianka",
            "url": "https://www.przepisy.pl/przepis/owsianka"
        },
        {
            "_id": "5f50dbe0c4783da430c1eb8b",
            "category": "Śniadanie",
            "imageUrl": "https://s3.przepisy.pl/przepisy3ii/img/variants/800x0/placki-owsiane.jpg",
            "ingredients": [
                "Olej",
                "Oliwa z oliwek",
                "Pieprz",
                "Jajko",
                "Sól",
                "Mąka",
                "Posiekana natka pietruszki",
                "Płatki owsiane",
                "Posiekany szczypiorek",
                "Kefir",
                "Mąka kukurydziana"
            ],
            "name": "Placki owsiane",
            "url": "https://www.przepisy.pl/przepis/placki-owsiane"
        },
        .
        .
        .
    ],
    "message": "data loaded",
    "status": "SUCCESS"
}

Get all ingredients from system

GET http://localhost:5000/api/v1/ingredients

Return message

{
    "content": [
        {
            "_id": "5f50db95c4783da430c1eb79",
            "name": "Płatki owsiane"
        },
        {
            "_id": "5f50db95c4783da430c1eb7a",
            "name": "Mleko"
        },
        {
            "_id": "5f50db95c4783da430c1eb7b",
            "name": "Jabłka"
        },
        {
            "_id": "5f50db95c4783da430c1eb7c",
            "name": "Suszone morele"
        },
        .
        .
        .
        
    ],
    "message": "data loaded",
    "status": "SUCCESS"
}

Get recipes based on provided ingredients

This endpoint returns 6 recipes which contain at leat one recipe from provided ingredients, sorted by "missing" field descending.

POST http://localhost:5000/api/v1/matches

Headers:

Key Value Description
Content-Type application/json Required.

Example body:

{
	"category": "Śniadanie",    //Available categories: "Śniadanie", "Obiad", "Kolacja"
	"ingredients": [
		"Ser żółty",
		"Mleko"
	]
}

Return message (simmilar to get recipes return message):

{
    "content": [
        {
            "category": "Śniadanie",
            "imageUrl": "https://s3.przepisy.pl/przepisy3ii/img/variants/800x0/omlet-z-szynka-i-warzywami.jpg",
            "ingredients": [
                "Plastry szynki",
                "Przyprawa w mini kostkach pietruszka knorr",
                "Jajka",
                "Papryka",
                "Świeżo mielony czarny pieprz",
                "Mleko",
                "Masło"
            ],
            "missing": 6,           // number of missing ingredients
            "name": "Omlet z szynką i warzywami",
            "url": "https://www.przepisy.pl/przepis/omlet-z-szynka-i-warzywami"
        },
        {
            "category": "Śniadanie",
            "imageUrl": "https://s3.przepisy.pl/przepisy3ii/img/variants/800x0/omlet-po-meksykansku.jpg",
            "ingredients": [
                "Jajka",
                "Mleko",
                "Przyprawa w mini kostkach smażona cebula knorr",
                "Czerwona papryka",
                "Cebula dymka",
                "Świeża kolendra",
                "Ser żółty",
                "Papryczka chili"
            ],
            "missing": 6,         // number of missing ingredients
            "name": "Omlet po meksykańsku",
            "url": "https://www.przepisy.pl/przepis/omlet-po-meksykansku"
        },
        .
        .
        .
    ]
    "message": "data loaded",
    "status": "SUCCESS"
}
        

Contributors 🍔


Krzysztof Nalepa

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages