Explorar o código

Set primary endpoints.

nostoc hai 2 semanas
pai
achega
4ea1542ebc
Modificáronse 1 ficheiros con 49 adicións e 13 borrados
  1. 49 13
      index.js

+ 49 - 13
index.js

@@ -270,10 +270,19 @@ app.post("/nauth/startMailVerify", async (req, res) => {
 });
 
 //NChar
-app.post("/nchar/addPhoneNumber", async (req, res) => {
-    await coreClient.NChar.addPhoneNumber({
-        phoneAreaCode: req.body.phoneAreaCode,
-        phone: req.body.phone
+app.get("/nchar/me", async (req, res) => {
+    await coreClient.NChar.me()
+    .then((resp) => {
+        res.status(200).json(resp);
+    }).catch((err) => {
+        console.log("err:", err)
+        res.status(400).json("something-went-wrong");
+    });
+});
+
+/* app.post("/nchar/startChangeMail", async (req, res) => {
+    await coreClient.NChar.startChangeMail({
+        mail: req.body.mail
     }).then((resp) => {
         res.status(200).json(resp);
     }).catch((err) => {
@@ -292,10 +301,10 @@ app.post("/nchar/checkChangeMailCode", async (req, res) => {
         console.log("err:", err)
         res.status(400).json("something-went-wrong");
     });
-});
+}); */
 
-app.post("/nchar/deletePhoneNumber", async (req, res) => {
-    await coreClient.NChar.deletePhoneNumber({
+app.post("/nchar/addPhoneNumber", async (req, res) => {
+    await coreClient.NChar.addPhoneNumber({
         phoneAreaCode: req.body.phoneAreaCode,
         phone: req.body.phone
     }).then((resp) => {
@@ -306,9 +315,11 @@ app.post("/nchar/deletePhoneNumber", async (req, res) => {
     });
 });
 
-app.get("/nchar/me", async (req, res) => {
-    await coreClient.NChar.me()
-    .then((resp) => {
+app.post("/nchar/deletePhoneNumber", async (req, res) => {
+    await coreClient.NChar.deletePhoneNumber({
+        phoneAreaCode: req.body.phoneAreaCode,
+        phone: req.body.phone
+    }).then((resp) => {
         res.status(200).json(resp);
     }).catch((err) => {
         console.log("err:", err)
@@ -328,9 +339,11 @@ app.post("/nchar/setPrimaryPhoneNumber", async (req, res) => {
     });
 });
 
-app.post("/nchar/startChangeMail", async (req, res) => {
-    await coreClient.NChar.startChangeMail({
-        mail: req.body.mail
+app.post("/nchar/setPrimaryPhoneNumberCheckCode", async (req, res) => {
+    await coreClient.NChar.setPrimaryPhoneNumberCheckCode({
+        phoneAreaCode: req.body.phoneAreaCode,
+        phone: req.body.phone,
+        code: req.body.code
     }).then((resp) => {
         res.status(200).json(resp);
     }).catch((err) => {
@@ -394,6 +407,29 @@ app.post("/nchar/deleteMail", async (req, res) => {
     });
 });
 
+app.post("/nchar/setPrimaryMail", async (req, res) => {
+    await coreClient.NChar.setPrimaryMail({
+        mail: req.body.mail
+    }).then((resp) => {
+        res.status(200).json(resp);
+    }).catch((err) => {
+        console.log("err:", err)
+        res.status(400).json("something-went-wrong");
+    });
+});
+
+app.post("/nchar/setPrimaryMailCheckCode", async (req, res) => {
+    await coreClient.NChar.setPrimaryMailCheckCode({
+        mail: req.body.mail,
+        code: req.body.code
+    }).then((resp) => {
+        res.status(200).json(resp);
+    }).catch((err) => {
+        console.log("err:", err)
+        res.status(400).json("something-went-wrong");
+    });
+});
+
 const PORT = process.env.PORT || 5000;
 
 app.listen(PORT, () => {