CRUD
CRUD stand for Create Read Update Delete.
Allergies
All DB functions for the Allergie table
Functions:
|
Add a single allergie to the DB to select later |
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
- 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 / Add a Bewertung to the DB. |
|
Delete one Bewertung |
|
Return all bewertugen from one User |
|
Return a specific bewertung from a user to only one restaurant |
|
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
UserNotFound – If the user does not exist
RestaurantNotFound – If the restaurant does not exist
DuplicateEntry – Duplicate Primary Key
- Returns
Return if success
- Return type
- 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
db (Session) – Session to the db
user (scheme_user.User) – The owner of the Bewertung
rest (scheme_rest.RestaurantBase) – The corrosponding Restaurant
- 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
db (Session) – Session to the DB
user (scheme_user.UserBase) – The user to select
- 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
db (Session) – Session to the DB
user (scheme_user.UserBase) – Specifie the User
rest (scheme_rest.RestaurantBase) – Specifie the restauranat
- Returns
Return one bewertung that match the restaurant - user
- Return type
- 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
db (Session) – Session to the DB
old_bewertung (scheme_rest.RestBewertungCreate) – The old Bewertung
new_bewertung (scheme_rest.RestBewertungCreate) – The updated Bewertung
- Returns
New Bewertung from get_bewertung_from_user_to_rest
- Return type
Cuisine
All DB functions for the Cuisine table