-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadds.py
More file actions
76 lines (68 loc) · 2.29 KB
/
Copy pathadds.py
File metadata and controls
76 lines (68 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from typing import Literal
from src.data_base.create_db import BaseDBPart
class AddDB(BaseDBPart):
async def add_voting(
self,
title: str,
options: str,
status: Literal["Waiting", "In progress", "Finished"],
):
await self.cur.execute(
"INSET INTO `voting` (title, options, status) VALUES (?,?,?)",
(title, options, status),
)
return await self.base.commit()
async def add_admin(self, user_id, username):
await self.cur.execute(
"INSERT INTO `admin` (`user_id`, `username`) VALUES (?,?)",
(user_id, username),
)
return await self.base.commit()
async def add_photo(self, name_photo, photo, date_photo):
await self.cur.execute(
"INSERT INTO photo (name_photo, photo, date_photo) VALUES (?,?,?)",
(name_photo, photo, date_photo),
)
return await self.base.commit()
async def add_student_group(self, student_group, photo, date):
await self.cur.execute(
"INSERT INTO `student_group` (`name_group`, `photo`, `date`) VALUES (?,?,?)",
(student_group, photo, date),
)
return await self.base.commit()
async def add_student(self, user_id, group_student, theme="black"):
await self.cur.execute(
"INSERT INTO `student` (`user_id`, `group_student`, `theme_name`) VALUES (?,?,?)",
(user_id, group_student, theme),
)
return await self.base.commit()
async def add_user(
self, tg_id, first_name, last_name, username, date_join, last_msg, admin, group
):
await self.cur.execute(
"""INSERT INTO user(
user_id,
first_name,
last_name,
username,
date_join,
count_interaction,
last_interaction,
admin,
student_group)
VALUES
(?,?,?,?,?,?,?,?,?)
""",
(
tg_id,
first_name,
last_name,
username,
date_join,
1,
last_msg,
admin,
group,
),
)
return await self.base.commit()