VioletWizard commited on
Commit
9595df7
·
unverified ·
1 Parent(s): 02e7332

Update db.py

Browse files
Files changed (1) hide show
  1. db.py +3 -2
db.py CHANGED
@@ -14,6 +14,8 @@ def init_db() -> Client:
14
  supabase_key = st.secrets.get("SUPABASE_SERVICE_ROLE_KEY") or st.secrets["SUPABASE_KEY"]
15
  return create_client(st.secrets["SUPABASE_URL"], supabase_key)
16
 
 
 
17
 
18
  def ensure_db_login(supabase: Client) -> bool:
19
  curr_session = None
@@ -268,8 +270,6 @@ def fetch_teacher_account(supabase: Client, teacher_id: str):
268
  .limit(1),
269
  fail_message="교사 계정 조회 실패",
270
  )
271
- if res is None:
272
- return {"_query_failed": True}
273
  if res is None:
274
  return {"_query_failed": True}
275
  if res.data:
@@ -290,6 +290,7 @@ def fetch_teacher_account(supabase: Client, teacher_id: str):
290
  return ci_res.data[0]
291
 
292
 
 
293
  def request_teacher_account(supabase: Client, teacher_id: str, teacher_pw: str):
294
  payload = {
295
  "teacher_id": str(teacher_id or "").strip(),
 
14
  supabase_key = st.secrets.get("SUPABASE_SERVICE_ROLE_KEY") or st.secrets["SUPABASE_KEY"]
15
  return create_client(st.secrets["SUPABASE_URL"], supabase_key)
16
 
17
+ def using_service_role_key() -> bool:
18
+ return bool(str(st.secrets.get("SUPABASE_SERVICE_ROLE_KEY", "")).strip())
19
 
20
  def ensure_db_login(supabase: Client) -> bool:
21
  curr_session = None
 
270
  .limit(1),
271
  fail_message="교사 계정 조회 실패",
272
  )
 
 
273
  if res is None:
274
  return {"_query_failed": True}
275
  if res.data:
 
290
  return ci_res.data[0]
291
 
292
 
293
+
294
  def request_teacher_account(supabase: Client, teacher_id: str, teacher_pw: str):
295
  payload = {
296
  "teacher_id": str(teacher_id or "").strip(),