Add /new, /hebe/ from new api
This commit is contained in:
parent
65b5a119c6
commit
0a1b3e897a
3 changed files with 266 additions and 7 deletions
2
app.js
2
app.js
|
@ -10,7 +10,7 @@ const protocol = require("./src/utils/connection");
|
|||
|
||||
const subdomain = require('express-subdomain');
|
||||
const index = require('./src/routes/index');
|
||||
const api = require('./src/routes/mobile-api/index');
|
||||
const api = require('./src/routes/api');
|
||||
const cufs = require('./src/routes/cufs');
|
||||
const uonetplus = require('./src/routes/uonetplus');
|
||||
const uonetplusOpiekun = require('./src/routes/uonetplus-opiekun');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const router = require('express').Router();
|
||||
const protocol = require('../../utils/connection');
|
||||
const protocol = require('../utils/connection');
|
||||
|
||||
router.all("/", (req, res) => {
|
||||
let base = protocol(req) + "://" + req.get('host');
|
||||
|
@ -9,7 +9,10 @@ router.all("/", (req, res) => {
|
|||
"repo": "https://github.com/wulkanowy/fake-log",
|
||||
"sdk": "https://github.com/wulkanowy/sdk",
|
||||
"docs": "https://gitlab.com/erupcja/uonet-api-docs",
|
||||
"endpoints": [
|
||||
"api": [
|
||||
base + "/powiatwulkanowy/api/mobile/register/new"
|
||||
],
|
||||
"mobile-api": [
|
||||
base + "/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart/Certyfikat",
|
||||
base + "/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart/ListaUczniow",
|
||||
base + "/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen/LogAppStart",
|
||||
|
@ -30,10 +33,14 @@ router.all("/", (req, res) => {
|
|||
});
|
||||
});
|
||||
|
||||
router.use("/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart", require("./register"));
|
||||
router.use("/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen", require("./student"));
|
||||
router.use("/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen", require("./messages"));
|
||||
router.use("/powiatwulkanowy/123456/mobile-api/Push.v1.Push", require("./push"));
|
||||
// v3
|
||||
router.use("/powiatwulkanowy/mobile-api/Uczen.v3.UczenStart", require("./mobile-api/register"));
|
||||
router.use("/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen", require("./mobile-api/student"));
|
||||
router.use("/powiatwulkanowy/123456/mobile-api/Uczen.v3.Uczen", require("./mobile-api/messages"));
|
||||
router.use("/powiatwulkanowy/123456/mobile-api/Push.v1.Push", require("./mobile-api/push"));
|
||||
|
||||
// hebe
|
||||
router.use("/powiatwulkanowy/api/mobile/register", require("./api/register"));
|
||||
|
||||
router.all("/*", (req, res) => {
|
||||
res.json({
|
252
src/routes/api/register.js
Normal file
252
src/routes/api/register.js
Normal file
|
@ -0,0 +1,252 @@
|
|||
const router = require('express').Router({});
|
||||
const protocol = require('../../utils/connection');
|
||||
const uuid = require("uuid");
|
||||
const {getTime, format} = require("date-fns");
|
||||
|
||||
router.all("/new", (req, res) => {
|
||||
const base = protocol(req) + "://" + req.get('host');
|
||||
|
||||
res.json({
|
||||
"Envelope": {
|
||||
"LoginId": 207,
|
||||
"RestURL": base + "/powiatwulkanowy",
|
||||
"UserLogin": "jan@fakelog.cf",
|
||||
"UserName": "jan@fakelog.cf"
|
||||
},
|
||||
"EnvelopeType": "AccountPayload",
|
||||
"InResponseTo": null,
|
||||
"RequestId": uuid(),
|
||||
"Status": {
|
||||
"Code": 0,
|
||||
"Message": "OK"
|
||||
},
|
||||
"Timestamp": getTime(new Date()),
|
||||
"TimestampFormatted": format(new Date(), "yyyy-MM-dd HH:mm:ss")
|
||||
});
|
||||
});
|
||||
|
||||
router.get("/hebe", (req, res) => {
|
||||
res.json({
|
||||
"Envelope": {
|
||||
"Capabilities": [
|
||||
"REGULAR",
|
||||
"AVG_ENABLED",
|
||||
"TOPICS_ENABLED",
|
||||
"LUCKY_NUMBERS",
|
||||
"ADDRESS_BOOK_PUPIL"
|
||||
],
|
||||
"ClassDisplay": "8b",
|
||||
"ConstituentUnit": {
|
||||
"Address": "ul. Wulkanowego 30, 30-300 Fakelog.cf, Polska",
|
||||
"Id": 2,
|
||||
"Name": "Publiczna szkoła Wulkanowego nr 1 w fakelog.cf",
|
||||
"Patron": "Święty Wulkan",
|
||||
"SchoolTopic": "12f446f1-1751-1711-10e1-101dd8b71c11",
|
||||
"Short": "SPL"
|
||||
},
|
||||
"Educators": [
|
||||
{
|
||||
"Id": "e-222",
|
||||
"Initials": "MK",
|
||||
"LoginId": 222,
|
||||
"Name": "Maria",
|
||||
"Surname": "Kowalska",
|
||||
"Roles": [
|
||||
{
|
||||
"Address": "Kowalska Maria [KM] - wychowawca 8b (SPL)",
|
||||
"AddressHash": "ndghrsawrtb045a0a4cfa7bf6ea0e9d380a6b5sd",
|
||||
"ClassSymbol": "8b (SPL)",
|
||||
"ConstituentUnitSymbol": "SPL",
|
||||
"Initials": "KM",
|
||||
"Name": "Maria",
|
||||
"RoleName": "Wychowawca",
|
||||
"RoleOrder": 0,
|
||||
"Surname": "Kowalsk",
|
||||
"UnitSymbol": null
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"FullSync": false,
|
||||
"InfoDisplay": "123456 - b8",
|
||||
"Journal": {
|
||||
"Id": 33,
|
||||
"YearEnd": {
|
||||
"Date": "2020-08-31",
|
||||
"DateDisplay": "31.08.2020",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1598824800000
|
||||
},
|
||||
"YearStart": {
|
||||
"Date": "2019-09-01",
|
||||
"DateDisplay": "01.09.2019",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1567288800000
|
||||
}
|
||||
},
|
||||
"Login": {
|
||||
"DisplayName": "Jan Kowalski",
|
||||
"FirstName": "Jan",
|
||||
"Id": 11,
|
||||
"LoginRole": "Uczen",
|
||||
"SecondName": "",
|
||||
"Surname": "Kowalski",
|
||||
"Value": "jan@fakelog.cf"
|
||||
},
|
||||
"Partition": "powiatwulkanowy-123456",
|
||||
"Periods": [
|
||||
{
|
||||
"Current": false,
|
||||
"End": {
|
||||
"Date": "2018-01-21",
|
||||
"DateDisplay": "21.01.2018",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1516489200000
|
||||
},
|
||||
"Id": 97,
|
||||
"Last": false,
|
||||
"Level": 6,
|
||||
"Number": 1,
|
||||
"Start": {
|
||||
"Date": "2017-09-01",
|
||||
"DateDisplay": "01.09.2017",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1504216800000
|
||||
}
|
||||
},
|
||||
{
|
||||
"Current": false,
|
||||
"End": {
|
||||
"Date": "2018-08-31",
|
||||
"DateDisplay": "31.08.2018",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1535666400000
|
||||
},
|
||||
"Id": 98,
|
||||
"Last": true,
|
||||
"Level": 6,
|
||||
"Number": 2,
|
||||
"Start": {
|
||||
"Date": "2018-01-22",
|
||||
"DateDisplay": "22.01.2018",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1516575600000
|
||||
}
|
||||
},
|
||||
{
|
||||
"Current": false,
|
||||
"End": {
|
||||
"Date": "2019-01-27",
|
||||
"DateDisplay": "27.01.2019",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1548543600000
|
||||
},
|
||||
"Id": 99,
|
||||
"Last": false,
|
||||
"Level": 7,
|
||||
"Number": 1,
|
||||
"Start": {
|
||||
"Date": "2018-09-01",
|
||||
"DateDisplay": "01.09.2018",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1535752800000
|
||||
}
|
||||
},
|
||||
{
|
||||
"Current": false,
|
||||
"End": {
|
||||
"Date": "2019-08-31",
|
||||
"DateDisplay": "31.08.2019",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1567202400000
|
||||
},
|
||||
"Id": 100,
|
||||
"Last": true,
|
||||
"Level": 7,
|
||||
"Number": 2,
|
||||
"Start": {
|
||||
"Date": "2019-01-28",
|
||||
"DateDisplay": "28.01.2019",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1548630000000
|
||||
}
|
||||
},
|
||||
{
|
||||
"Current": false,
|
||||
"End": {
|
||||
"Date": "2020-02-09",
|
||||
"DateDisplay": "09.02.2020",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1581202800000
|
||||
},
|
||||
"Id": 101,
|
||||
"Last": false,
|
||||
"Level": 8,
|
||||
"Number": 1,
|
||||
"Start": {
|
||||
"Date": "2019-09-01",
|
||||
"DateDisplay": "01.09.2019",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1567288800000
|
||||
}
|
||||
},
|
||||
{
|
||||
"Current": true,
|
||||
"End": {
|
||||
"Date": "2020-08-31",
|
||||
"DateDisplay": "31.08.2020",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1598824800000
|
||||
},
|
||||
"Id": 102,
|
||||
"Last": true,
|
||||
"Level": 8,
|
||||
"Number": 2,
|
||||
"Start": {
|
||||
"Date": "2020-02-10",
|
||||
"DateDisplay": "10.02.2020",
|
||||
"Time": "00:00:00",
|
||||
"Timestamp": 1581289200000
|
||||
}
|
||||
}
|
||||
],
|
||||
"Pupil": {
|
||||
"FirstName": "Jan",
|
||||
"Id": 111,
|
||||
"LoginId": 11,
|
||||
"LoginValue": "jan@fakelog.cf",
|
||||
"SecondName": "",
|
||||
"Sex": true,
|
||||
"Surname": "Kowalski"
|
||||
},
|
||||
"SenderEntry": {
|
||||
"Address": "Jan Kowalski - uczeń 8b (SPL)",
|
||||
"AddressHash": "1234567890e676ea0c01114dc2fb610987654321",
|
||||
"Initials": "JK",
|
||||
"LoginId": 111
|
||||
},
|
||||
"TopLevelPartition": "powiatwulkanowy",
|
||||
"Unit": {
|
||||
"Address": "ul. Wulkanowego 30, 30-300 Fakelog.cf, Polska",
|
||||
"DisplayName": "Publiczna szkoła Wulkanowego nr 1 w fakelog.",
|
||||
"Id": 2,
|
||||
"Name": "Publiczna szkoła Wulkanowego",
|
||||
"Patron": "Święty Wulkan",
|
||||
"RestURL": "https://lekcjaplus.vulcan.net.pl/powiatwulkanowy/123456/api",
|
||||
"Short": "123456",
|
||||
"Symbol": "123456"
|
||||
}
|
||||
},
|
||||
"EnvelopeType": "IEnumerable`1",
|
||||
"InResponseTo": null,
|
||||
"RequestId": uuid(),
|
||||
"Status": {
|
||||
"Code": 0,
|
||||
"Message": "OK"
|
||||
},
|
||||
"Timestamp": getTime(new Date()),
|
||||
"TimestampFormatted": format(new Date(), "yyyy-MM-dd HH:mm:ss")
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = router;
|
Loading…
Reference in a new issue