You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cur.execute('SELECT COUNT(DISTINCT s.category_id) AS counter FROM collections_series cs JOIN series s ON s.id = cs.series_id WHERE cs.collection_id = :collectionId')
37
+
returncur.fetchone()[0]
38
+
finally:
39
+
conn.close()
13
40
14
41
@router.get('/v1/categories')
15
42
defget_list_v1_categories():
@@ -21,7 +48,19 @@ def post_v1_categories():
21
48
22
49
@router.get('/v1/categories/:categoryId')
23
50
defget_v1_categories_category_id():
24
-
pass
51
+
conn=psycopg2.connect(
52
+
database=os.getenv('DB_NAME'),
53
+
user=os.getenv('DB_USER'),
54
+
password=os.getenv('DB_PASSWORD'),
55
+
host=os.getenv('DB_HOST', 'localhost'),
56
+
port=5432)
57
+
try:
58
+
withconn:
59
+
withconn.cursor() ascur:
60
+
cur.execute('SELECT id , name , name_ru , slug FROM categories WHERE id = :categoryId')
0 commit comments