move live source ownership to accounts
This commit is contained in:
@@ -611,14 +611,9 @@ impl AuthService {
|
||||
.expect("OverlaySettings is always JSON serializable");
|
||||
transaction
|
||||
.execute(
|
||||
"INSERT INTO component_instances(id,owner_user_id,source_id,kind,name,settings) \
|
||||
VALUES($1,$2,$3,'danmaku_overlay','弹幕姬',$4)",
|
||||
&[
|
||||
&default_component_id,
|
||||
&user_id,
|
||||
&default_source_id,
|
||||
&default_settings,
|
||||
],
|
||||
"INSERT INTO component_instances(id,owner_user_id,kind,name,settings) \
|
||||
VALUES($1,$2,'danmaku_overlay','弹幕姬',$3)",
|
||||
&[&default_component_id, &user_id, &default_settings],
|
||||
)
|
||||
.await?;
|
||||
let song_component_id = Uuid::new_v4();
|
||||
@@ -627,12 +622,11 @@ impl AuthService {
|
||||
transaction
|
||||
.execute(
|
||||
"INSERT INTO component_instances \
|
||||
(id,owner_user_id,source_id,kind,name,settings,settings_version,enabled) \
|
||||
VALUES($1,$2,$3,$4,$5,$6,1,true)",
|
||||
(id,owner_user_id,kind,name,settings,settings_version,enabled) \
|
||||
VALUES($1,$2,$3,$4,$5,1,true)",
|
||||
&[
|
||||
&song_component_id,
|
||||
&user_id,
|
||||
&default_source_id,
|
||||
&SONG_REQUEST_KIND,
|
||||
&SONG_REQUEST_NAME,
|
||||
&song_settings,
|
||||
@@ -1240,13 +1234,6 @@ impl AuthService {
|
||||
.ok_or(AuthError::InvalidCredentials)?
|
||||
.get(0);
|
||||
Db::set_tenant(&transaction, owner_user_id).await?;
|
||||
let source_id: Uuid = transaction
|
||||
.query_one(
|
||||
"SELECT id FROM live_sources WHERE owner_user_id=$1",
|
||||
&[&owner_user_id],
|
||||
)
|
||||
.await?
|
||||
.get(0);
|
||||
let component_id = if let Some(row) = transaction
|
||||
.query_opt(
|
||||
"SELECT id FROM component_instances \
|
||||
@@ -1268,9 +1255,9 @@ impl AuthService {
|
||||
let id = Uuid::new_v4();
|
||||
transaction
|
||||
.execute(
|
||||
"INSERT INTO component_instances(id,owner_user_id,source_id,kind,name,settings) \
|
||||
VALUES($1,$2,$3,'danmaku_overlay','弹幕姬',$4)",
|
||||
&[&id, &owner_user_id, &source_id, &settings],
|
||||
"INSERT INTO component_instances(id,owner_user_id,kind,name,settings) \
|
||||
VALUES($1,$2,'danmaku_overlay','弹幕姬',$3)",
|
||||
&[&id, &owner_user_id, &settings],
|
||||
)
|
||||
.await?;
|
||||
id
|
||||
|
||||
Reference in New Issue
Block a user