@xuda.io/account_module 1.2.321 → 1.2.323
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +9 -51
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -120,9 +120,9 @@ export const update_account_info = async function (req, job_id, headers) {
|
|
|
120
120
|
account_obj.account_project_id = ret.data;
|
|
121
121
|
const drive_module = await import(`${module_path}/drive_module/index.mjs`);
|
|
122
122
|
let drive_req = { app_id: account_obj.account_project_id, uid, path: '/' };
|
|
123
|
-
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Profile Images',
|
|
124
|
-
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Thumbnails',
|
|
125
|
-
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Attachments',
|
|
123
|
+
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Profile Images', is_system: true } }, job_id, headers);
|
|
124
|
+
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Thumbnails', is_system: true } }, job_id, headers);
|
|
125
|
+
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Attachments', is_system: true } }, job_id, headers);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
const ai_module = await import(`${module_path}/ai_module/index.mjs`);
|
|
@@ -137,12 +137,12 @@ export const update_account_info = async function (req, job_id, headers) {
|
|
|
137
137
|
// temp remove later on
|
|
138
138
|
const drive_module = await import(`${module_path}/drive_module/index.mjs`);
|
|
139
139
|
let drive_req = { app_id: account_obj.account_project_id, uid, path: '/' };
|
|
140
|
-
await drive_module.create_drive_folder_workspace({ ...drive_req, ...{ folder_name: 'Chat Images',
|
|
141
|
-
await drive_module.create_drive_folder_studio({ ...drive_req, ...{ folder_name: 'Progs Thumbnails',
|
|
142
|
-
await drive_module.create_drive_folder_studio({ ...drive_req, ...{ folder_name: 'Screenshots',
|
|
143
|
-
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Profile Images',
|
|
144
|
-
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Thumbnails',
|
|
145
|
-
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Attachments',
|
|
140
|
+
await drive_module.create_drive_folder_workspace({ ...drive_req, ...{ folder_name: 'Chat Images', is_system: false } }, job_id, headers);
|
|
141
|
+
await drive_module.create_drive_folder_studio({ ...drive_req, ...{ folder_name: 'Progs Thumbnails', is_system: true } }, job_id, headers);
|
|
142
|
+
await drive_module.create_drive_folder_studio({ ...drive_req, ...{ folder_name: 'Screenshots', is_system: true } }, job_id, headers);
|
|
143
|
+
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Profile Images', is_system: true } }, job_id, headers);
|
|
144
|
+
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Thumbnails', is_system: true } }, job_id, headers);
|
|
145
|
+
await drive_module.create_drive_folder_user({ ...drive_req, ...{ folder_name: 'Chat Attachments', is_system: true } }, job_id, headers);
|
|
146
146
|
|
|
147
147
|
const ret2 = await db_module.save_couch_doc('xuda_accounts', account_obj);
|
|
148
148
|
if (ret2.code > 0) {
|
|
@@ -1326,48 +1326,6 @@ export const get_account_rt_info = async function (uid) {
|
|
|
1326
1326
|
return account_info;
|
|
1327
1327
|
};
|
|
1328
1328
|
|
|
1329
|
-
// export const validate_account_topup = async function (uid, items = []) {
|
|
1330
|
-
// const stripe_module = await import(`${module_path}/stripe_module/index.mjs`);
|
|
1331
|
-
|
|
1332
|
-
// const { code, data } = await stripe_module.get_billing_metrics({ uid });
|
|
1333
|
-
// if (code < 0) {
|
|
1334
|
-
// throw new Error(data);
|
|
1335
|
-
// }
|
|
1336
|
-
// let topup = 0;
|
|
1337
|
-
// for (const item of items) {
|
|
1338
|
-
// topup += get_prices(uid, item);
|
|
1339
|
-
// }
|
|
1340
|
-
|
|
1341
|
-
// // if ((!data?.customer_obj?.default_source, { billing_problem: true, topup })) {
|
|
1342
|
-
// // throw new Error("no card on file");
|
|
1343
|
-
// // }
|
|
1344
|
-
// debugger;
|
|
1345
|
-
// if (data?.balance?.past_due) {
|
|
1346
|
-
// throw new Error(`past_due ${data?.balance?.past_due}`, {
|
|
1347
|
-
// billing_problem: true,
|
|
1348
|
-
// topup,
|
|
1349
|
-
// });
|
|
1350
|
-
// }
|
|
1351
|
-
|
|
1352
|
-
// const balance = data?.balance?.account || 0; // minus balance represents positive balance
|
|
1353
|
-
|
|
1354
|
-
// if (balance > 0) {
|
|
1355
|
-
// throw new Error(`negative balance ${-balance}`, {
|
|
1356
|
-
// billing_problem: true,
|
|
1357
|
-
// topup: topup - balance, // ask for whole balance
|
|
1358
|
-
// });
|
|
1359
|
-
// }
|
|
1360
|
-
|
|
1361
|
-
// if (topup + balance > 0) {
|
|
1362
|
-
// throw new Error(`not enough balance ${topup + balance}`, {
|
|
1363
|
-
// billing_problem: true,
|
|
1364
|
-
// topup, //-(topup + balance)
|
|
1365
|
-
// });
|
|
1366
|
-
// }
|
|
1367
|
-
|
|
1368
|
-
// return true;
|
|
1369
|
-
// };
|
|
1370
|
-
|
|
1371
1329
|
export const validate_account_topup = async function (uid, items = []) {
|
|
1372
1330
|
const stripe_module = await import(`${module_path}/stripe_module/index.mjs`);
|
|
1373
1331
|
|