Add message recipients endpoint

This commit is contained in:
Mikołaj Pich 2019-03-03 01:52:35 +01:00
parent 7526ed3c60
commit cab4d25d21
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA
2 changed files with 52 additions and 14 deletions

47
package-lock.json generated
View file

@ -1505,7 +1505,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
@ -1526,12 +1527,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -1546,17 +1549,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
@ -1673,7 +1679,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
@ -1685,6 +1692,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
@ -1699,6 +1707,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -1706,12 +1715,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
@ -1730,6 +1741,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
@ -1810,7 +1822,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
@ -1822,6 +1835,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
@ -1907,7 +1921,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
@ -1943,6 +1958,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
@ -1962,6 +1978,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
@ -2005,12 +2022,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
@ -2717,9 +2736,9 @@
}
},
"lodash": {
"version": "4.17.5",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.5.tgz",
"integrity": "sha512-svL3uiZf1RwhH+cWrfZn3A4+U58wbP0tGVTLQPbjplZxZ8ROD9VLuNgsRniTlLe7OlSqR79RUehXgpBW/s0IQw=="
"version": "4.17.11",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz",
"integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg=="
},
"lodash.assign": {
"version": "4.2.0",

View file

@ -14,6 +14,7 @@ router.get("/", (req, res) => {
"/Wiadomosc.mvc/GetWiadomosciUsuniete",
"/NowaWiadomosc.mvc/GetJednostkiUzytkownika",
"/Adresaci.mvc/GetAdresaci",
"/Wiadomosc.mvc/GetAdresaciWiadomosci",
"/Wiadomosc.mvc/GetTrescWiadomosci",
"/NowaWiadomosc.mvc/InsertWiadomosc"
].map(item => {
@ -113,6 +114,24 @@ router.get("/Adresaci.mvc/GetAdresaci", (req, res) => {
});
});
router.get("/Wiadomosc.mvc/GetAdresaciWiadomosci", (req, res) => {
const user = require("../../data/api/ListaUczniow")[1];
res.json({
"success": true,
"data": require("../../data/api/dictionaries/Pracownicy").slice(0, 2).map(item => {
return {
"Id": `${item.Id}rPracownik`,
"Nazwa": `${item.Imie} ${item.Nazwisko} [${item.Kod}] - pracownik (${user.JednostkaSprawozdawczaSkrot})`,
"IdLogin": item.Id,
"IdJednostkaSprawozdawcza": null,
"Rola": 2,
"PushWiadomosc": null,
"Hash": Buffer.from(md5(item.Id)).toString('base64')
};
})
});
});
router.all("/Wiadomosc.mvc/GetTrescWiadomosci", (req, res) => {
const message = require("../../data/api/messages/WiadomosciOdebrane")[0];
res.json({