@xuda.io/account_module 1.2.805 → 1.2.807
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 +24 -4
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1637,10 +1637,6 @@ export const get_contacts = async function (req) {
|
|
|
1637
1637
|
export const archive_contact = async function (req) {
|
|
1638
1638
|
const { contact_id } = req;
|
|
1639
1639
|
try {
|
|
1640
|
-
const contact_ret = await db_module.get_couch_doc('xuda_contacts', contact_id);
|
|
1641
|
-
if (contact_ret.code < 0) {
|
|
1642
|
-
return contact_ret;
|
|
1643
|
-
}
|
|
1644
1640
|
var contact_doc = await db_module.get_couch_doc_native('xuda_contacts', contact_id);
|
|
1645
1641
|
contact_doc.stat = 5;
|
|
1646
1642
|
contact_doc.stat_ts = Date.now();
|
|
@@ -1657,6 +1653,30 @@ export const archive_contact = async function (req) {
|
|
|
1657
1653
|
}
|
|
1658
1654
|
};
|
|
1659
1655
|
|
|
1656
|
+
export const unarchive_contact = async function (req) {
|
|
1657
|
+
const { contact_id } = req;
|
|
1658
|
+
try {
|
|
1659
|
+
var contact_doc = await db_module.get_couch_doc_native('xuda_contacts', contact_id);
|
|
1660
|
+
|
|
1661
|
+
if (conversation_doc.stat !== 5) {
|
|
1662
|
+
throw new Error('contact is not archived');
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
contact_doc.stat = 3;
|
|
1666
|
+
contact_doc.stat_ts = Date.now();
|
|
1667
|
+
contact_doc.stat_reason = 'archived by the user';
|
|
1668
|
+
|
|
1669
|
+
const contact_save_ret = await db_module.save_couch_doc('xuda_contacts', contact_doc);
|
|
1670
|
+
|
|
1671
|
+
return contact_save_ret;
|
|
1672
|
+
} catch (err) {
|
|
1673
|
+
return {
|
|
1674
|
+
code: -22,
|
|
1675
|
+
data: err.message,
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1679
|
+
|
|
1660
1680
|
export const unfriend_contact = async function (req) {
|
|
1661
1681
|
const { contact_id } = req;
|
|
1662
1682
|
try {
|