Compare commits
No commits in common. "1bbc0631b6aaa59ef8c4b8cc35b139f72a4bdecd" and "f7d2e8563b50412d94f820bce6e0b5a5448dddc6" have entirely different histories.
1bbc0631b6
...
f7d2e8563b
Binary file not shown.
26
article.py
26
article.py
@ -1,26 +0,0 @@
|
||||
class Article():
|
||||
def __init__(self, name: str, id: str, price: float = 0, quantity: int = 1) -> Article:
|
||||
"""
|
||||
the article data
|
||||
:param name: the name
|
||||
:type name: str
|
||||
:param id: uuid
|
||||
:type id: str
|
||||
:param price: price
|
||||
:type price: float
|
||||
:param quantity: quantity
|
||||
:type quantity: int
|
||||
:return: the article
|
||||
:rtype: Article
|
||||
"""
|
||||
self.name = name;
|
||||
self.id = id;
|
||||
self.price = price;
|
||||
self.quantity = quantity;
|
||||
return (self);
|
||||
|
||||
def __repr__(self):
|
||||
return (f"Article(name={self.name},id={self.id},price={self.price},quantity={self.quantity})")
|
||||
|
||||
def __str__(self):
|
||||
return (self.__repr__())
|
14
database.json
Normal file
14
database.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"users": {
|
||||
"1": {
|
||||
"email": "camille@chauvet.pro",
|
||||
"password": "b'$2b$12$FVOKVF9p/SlSv9ANVNDW.eOmv1f3qtB0WU86g4ED4B8J2fMBPZu7.'"
|
||||
},
|
||||
"2": {
|
||||
"email": "spam@camille.chauvet.pro",
|
||||
"password": "b'$2b$12$D2DexgunhMTbYWkXmEQKw.Aa13W9QZE4CjsNUyaU5bSaZ8ZpdJ2hO'"
|
||||
}
|
||||
},
|
||||
"resets": {},
|
||||
"_default": {}
|
||||
}
|
@ -24,7 +24,7 @@ def user_exist(email: str):
|
||||
|
||||
def add_user(email: str, password: str):
|
||||
password_hashed = hasher.hash_text(password)
|
||||
users.insert({"email": email, "password": str(password_hashed), "id": uuid.uuid4()});
|
||||
users.insert({"email": email, "password": str(password_hashed)});
|
||||
|
||||
def check_password(email: str, password: str):
|
||||
password_hashed = get_user_by_email(email).get("password")
|
||||
|
@ -1,12 +0,0 @@
|
||||
class GroceryList():
|
||||
def __init__(self, id: str, articles: list):
|
||||
"""
|
||||
Groceries List
|
||||
:param id: uuid
|
||||
:type id: str
|
||||
:param articles: list of articles
|
||||
:type articles: list[Article]
|
||||
:return: the grocery list
|
||||
:rtype: GroceryList
|
||||
"""
|
||||
self.id = str
|
23
group.py
23
group.py
@ -1,23 +0,0 @@
|
||||
class Group():
|
||||
def __init__(self, id: str, members: list, lists: list) -> Group:
|
||||
"""
|
||||
this class aims to store group with an id, a list of members, a lists of greceries lists
|
||||
:param id: the uuid of the groups
|
||||
:type id: int
|
||||
:param members: the lists of members (User)
|
||||
:type members: list[User]
|
||||
:param lists: the lists of groceries lists
|
||||
:type lists: list[GroceriesList]
|
||||
:return: the group
|
||||
:rtype: Group
|
||||
"""
|
||||
self.id = id;
|
||||
self.members = members
|
||||
self.lists: lists
|
||||
return (self)
|
||||
|
||||
def __str__(self):
|
||||
return (f"Group(id={self.id},members={self.members},lists={self.lists})")
|
||||
|
||||
def __repr__(self):
|
||||
return (self.__str__())
|
@ -6,6 +6,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<h1>connected</h1>
|
||||
<h2>Welcome to FlaskApp!</h2>
|
||||
<a href="/logout">
|
||||
<input type="button" value="logout">
|
||||
</a>
|
||||
|
@ -1,71 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<header>
|
||||
<title>{{name}}</title>
|
||||
</header>
|
||||
<body>
|
||||
<div id="container">
|
||||
<table>
|
||||
<tr>
|
||||
<td><b>Acheté</b></td>
|
||||
<td><b>Nom</b></td>
|
||||
<td><b>Quantité</b></td>
|
||||
<td><b>Prix</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
{% for article in articles %}
|
||||
<td class="buyed">
|
||||
<input type="checkbox" id={{article.id}}>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" value={{article.name}}>
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" value="{{article.quantity}}" size="7" step="1">
|
||||
</td>
|
||||
<td>
|
||||
<input type="number" value="{{article.price}}" size="9" step="0.01"'>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="add_element" colspan="4">
|
||||
<a href={{add_button_url}}>
|
||||
<input type="button" value="+">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<style>
|
||||
td.buyed {
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
}
|
||||
body {
|
||||
background: #67BE4B;
|
||||
}
|
||||
#container {
|
||||
width: 400px;
|
||||
margin: 0 auto;
|
||||
margin-top: 5%;
|
||||
border: 1px solid #f1f1f1;
|
||||
background: #fff;
|
||||
}
|
||||
td.add_element {
|
||||
background: #fff;
|
||||
margin: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
td.add_element input[type=button] {
|
||||
width: 100%;
|
||||
border: 0px;
|
||||
background: #67BE4B;
|
||||
}
|
||||
td.add_element input[type=button]:hover {
|
||||
background: #fff;
|
||||
border: 1px solid #67BE4B;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
</html>
|
@ -4,6 +4,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="index.css" />
|
||||
<title>Beyond School</title>
|
||||
</head>
|
||||
<body>
|
||||
|
25
user.py
25
user.py
@ -1,25 +0,0 @@
|
||||
class User():
|
||||
def __init__(self, mail: str, password: str, id: str, groups: list = []) -> User:
|
||||
"""
|
||||
User: store user data
|
||||
:param mail: the mail address
|
||||
:type mail: str
|
||||
:param password: the password
|
||||
:type password: str
|
||||
:param id: the uuid
|
||||
:type id: str
|
||||
:param groups: the lists of groups the user is in
|
||||
:type groups: list[Group]
|
||||
:return: the user
|
||||
:rtype: User
|
||||
"""
|
||||
self.mail = mail
|
||||
self.password = password
|
||||
self.id = id;
|
||||
self.groups = groups
|
||||
|
||||
def __repr__(self):
|
||||
return (f"User(mail={self.mail},password={self.password},id={self.id},groups={self.groups})")
|
||||
|
||||
def __str__(self):
|
||||
return (self.__repr__())
|
Loading…
Reference in New Issue
Block a user