@xuda.io/account_module 1.2.1301 → 1.2.1303
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 +7 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -2803,10 +2803,11 @@ export const get_account_profiles = async function (req) {
|
|
|
2803
2803
|
export const archive_account_profile = async function (req) {
|
|
2804
2804
|
const { uid, profile_id } = req;
|
|
2805
2805
|
try {
|
|
2806
|
+
const app_id = await get_account_default_project_id(uid);
|
|
2806
2807
|
const team_module = await import(`${module_path}/team_module/index.mjs`);
|
|
2807
2808
|
await team_module.validate_share_exist(uid, 'account_profile', profile_id);
|
|
2808
2809
|
|
|
2809
|
-
var account_profile_doc = await db_module.
|
|
2810
|
+
var account_profile_doc = await db_module.get_app_couch_doc_native(app_id, profile_id);
|
|
2810
2811
|
|
|
2811
2812
|
if (account_profile_doc.main) {
|
|
2812
2813
|
throw new Error('reserve');
|
|
@@ -2816,7 +2817,7 @@ export const archive_account_profile = async function (req) {
|
|
|
2816
2817
|
account_profile_doc.stat_ts = Date.now();
|
|
2817
2818
|
account_profile_doc.stat_reason = 'archived by the user';
|
|
2818
2819
|
|
|
2819
|
-
const account_profile_save_ret = await db_module.
|
|
2820
|
+
const account_profile_save_ret = await db_module.save_app_couch_doc(app_id, account_profile_doc);
|
|
2820
2821
|
|
|
2821
2822
|
return account_profile_save_ret;
|
|
2822
2823
|
// } else {
|
|
@@ -2833,7 +2834,8 @@ export const archive_account_profile = async function (req) {
|
|
|
2833
2834
|
export const delete_account_profile = async function (req, job_id, headers) {
|
|
2834
2835
|
const { profile_id } = req;
|
|
2835
2836
|
try {
|
|
2836
|
-
|
|
2837
|
+
const app_id = await get_account_default_project_id(uid);
|
|
2838
|
+
var account_profile_doc = await db_module.get_app_couch_doc_native(app_id, profile_id);
|
|
2837
2839
|
if (account_profile_doc.stat !== 5) {
|
|
2838
2840
|
throw new Error('A document can only be deleted after it has been archived');
|
|
2839
2841
|
}
|
|
@@ -2841,7 +2843,7 @@ export const delete_account_profile = async function (req, job_id, headers) {
|
|
|
2841
2843
|
account_profile_doc.stat_ts = Date.now();
|
|
2842
2844
|
account_profile_doc.stat_reason = 'deleted by the user';
|
|
2843
2845
|
|
|
2844
|
-
const account_profile_save_ret = await db_module.
|
|
2846
|
+
const account_profile_save_ret = await db_module.save_app_couch_doc(app_id, account_profile_doc);
|
|
2845
2847
|
const ai_module = await import(`${module_path}/ai_module/index.mjs`);
|
|
2846
2848
|
ai_module.delete_depended_chats(uid, profile_id);
|
|
2847
2849
|
return account_profile_save_ret;
|
|
@@ -2857,7 +2859,7 @@ export const unarchive_account_profile = async function (req) {
|
|
|
2857
2859
|
const { profile_id } = req;
|
|
2858
2860
|
try {
|
|
2859
2861
|
const app_id = await get_account_default_project_id(uid);
|
|
2860
|
-
const team_module = await import(`${module_path}/team_module/index.mjs`);
|
|
2862
|
+
// const team_module = await import(`${module_path}/team_module/index.mjs`);
|
|
2861
2863
|
var account_profile_doc = await db_module.get_app_couch_doc_native(app_id, profile_id);
|
|
2862
2864
|
|
|
2863
2865
|
if (account_profile_doc.stat !== 5) {
|