CRUD

CRUD stand for Create Read Update Delete.

Allergies

All DB functions for the Allergie table

Functions:

create_allergie(db, allergie)

Add a single allergie to the DB to select later

get_all_allergies(db)

Get all Allergies in the DB

db.crud.allergies.create_allergie(db: sqlalchemy.orm.session.Session, allergie: schemes.Allergies) db.models.allergie.Allergie[source]

Add a single allergie to the DB to select later

Parameters
  • db (Session) – Session to the db

  • allergie (scheme_allergie.Allergie) – Allergie to be added

Raises

DuplicateEntry – Duplicate Primary Key

Returns

return the db Allergie if success

Return type

Allergie

db.crud.allergies.get_all_allergies(db: sqlalchemy.orm.session.Session) List[db.models.allergie.Allergie][source]

Get all Allergies in the DB

Parameters

db (Session) – Session to the DB

Returns

List of Allergies

Return type

List[Allergie]

Bewertung

All DB functions for the Bewertung table

Functions:

create_bewertung(db, assessment)

Create / Add a Bewertung to the DB.

delete_bewertung(db, user, rest)

Delete one Bewertung

get_all_user_bewertungen(db, user)

Return all bewertugen from one User

get_bewertung_from_user_to_rest(db, user, rest)

Return a specific bewertung from a user to only one restaurant

update_bewertung(db, old_bewertung, ...)

Update the comment and rating of a bewertung

db.crud.restBewertung.create_bewertung(db: sqlalchemy.orm.session.Session, assessment: schemes.scheme_rest.RestBewertungCreate) db.models.bewertung.BewertungRestaurant[source]

Create / Add a Bewertung to the DB. Timestamp and ID will set automatic.

Parameters
  • db (Session) – Session to the DB

  • assessment (scheme_rest.RestBewertungCreate) – Bewertung to add. This include the Person and Restaurant for the mapping of the Bewertung

Raises
Returns

Return if success

Return type

BewertungRestaurant

db.crud.restBewertung.delete_bewertung(db: sqlalchemy.orm.session.Session, user: schemes.scheme_user.UserBase, rest: schemes.scheme_rest.RestaurantBase) int[source]

Delete one Bewertung

Parameters
Returns

Number of effected rows

Return type

int

db.crud.restBewertung.get_all_user_bewertungen(db: sqlalchemy.orm.session.Session, user: schemes.scheme_user.UserBase) Optional[List[db.models.bewertung.BewertungRestaurant]][source]

Return all bewertugen from one User

Parameters
Returns

List[BewertungRestaurant] OR None

db.crud.restBewertung.get_bewertung_from_user_to_rest(db: sqlalchemy.orm.session.Session, user: schemes.scheme_user.UserBase, rest: schemes.scheme_rest.RestaurantBase) db.models.bewertung.BewertungRestaurant[source]

Return a specific bewertung from a user to only one restaurant

Parameters
Returns

Return one bewertung that match the restaurant - user

Return type

BewertungRestaurant

db.crud.restBewertung.update_bewertung(db: sqlalchemy.orm.session.Session, old_bewertung: schemes.scheme_rest.RestBewertungCreate, new_bewertung: schemes.scheme_rest.RestBewertungCreate) db.models.bewertung.BewertungRestaurant[source]

Update the comment and rating of a bewertung

Parameters
Returns

New Bewertung from get_bewertung_from_user_to_rest

Return type

BewertungRestaurant

Cuisine

All DB functions for the Cuisine table