feat: multiple zoom accounts
This commit is contained in:
11
lms/patches/v2_0/link_zoom_account_to_batch.py
Normal file
11
lms/patches/v2_0/link_zoom_account_to_batch.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
live_classes = frappe.get_all("LMS Live Class", ["name", "batch_name"])
|
||||
zoom_account = frappe.get_all("LMS Zoom Settings", pluck="name")
|
||||
zoom_account = zoom_account[0] if zoom_account else None
|
||||
|
||||
if zoom_account:
|
||||
for live_class in live_classes:
|
||||
frappe.db.set_value("LMS Batch", live_class.batch_name, "zoom_account", zoom_account)
|
||||
16
lms/patches/v2_0/link_zoom_account_to_live_class.py
Normal file
16
lms/patches/v2_0/link_zoom_account_to_live_class.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
live_classes = frappe.get_all("LMS Live Class", pluck="name")
|
||||
zoom_account = frappe.get_all("LMS Zoom Settings", pluck="name")
|
||||
zoom_account = zoom_account[0] if zoom_account else None
|
||||
|
||||
if zoom_account:
|
||||
for live_class in live_classes:
|
||||
frappe.db.set_value(
|
||||
"LMS Live Class",
|
||||
live_class,
|
||||
"zoom_account",
|
||||
zoom_account,
|
||||
)
|
||||
27
lms/patches/v2_0/move_zoom_settings.py
Normal file
27
lms/patches/v2_0/move_zoom_settings.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
create_settings()
|
||||
|
||||
|
||||
def create_settings():
|
||||
current_settings = frappe.get_single("Zoom Settings")
|
||||
member = current_settings.owner
|
||||
member_name = frappe.get_value("User", member, "full_name")
|
||||
|
||||
if not frappe.db.exists(
|
||||
"LMS Zoom Settings",
|
||||
{
|
||||
"account_name": member_name,
|
||||
},
|
||||
):
|
||||
new_settings = frappe.new_doc("LMS Zoom Settings")
|
||||
new_settings.enabled = current_settings.enable
|
||||
new_settings.account_name = member_name
|
||||
new_settings.member = member
|
||||
new_settings.member_name = member_name
|
||||
new_settings.account_id = current_settings.account_id
|
||||
new_settings.client_id = current_settings.client_id
|
||||
new_settings.client_secret = current_settings.client_secret
|
||||
new_settings.insert()
|
||||
Reference in New Issue
Block a user