bozo-backend/User.py

27 lines
1.1 KiB
Python
Raw Permalink Normal View History

2023-06-03 10:38:02 -04:00
class User:
2023-06-03 10:47:02 -04:00
def __init__(self, first_name: str, last_name: str, username: str, password: str, email: str, permissions):
2023-06-03 10:38:02 -04:00
"""
: param first_name: The first name of the user
: type first_name: str
: param last_name: The last name of the user
: type last_name: str
: param password: The password of the user
: type password: str
2023-06-03 10:47:02 -04:00
: param email: The email of the user
: type email: str
2023-06-03 10:38:02 -04:00
: param permissions: The permissions of the user
: type permissions: dict
"""
self.first_name: str = first_name;
self.last_name: str = last_name;
2023-06-08 10:32:44 -04:00
self.email: str = email
2023-06-03 10:38:02 -04:00
self.username: str = username;
self.password: str = password;
self.permission = permissions;
def to_insert_sql(self):
"""
return text to add the user in the database
"""
2023-06-08 10:32:44 -04:00
return (f"INSERT INTO users (email, username, first_name, last_name, password) VALUES ('{self.email}', '{self.username}', '{self.first_name}', '{self.last_name}', '{self.password}')")