exodus-framework 2.0.862 → 2.0.864
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/lib/controllers/api/report.d.ts +9 -0
- package/lib/controllers/api/report.d.ts.map +1 -0
- package/lib/controllers/api/report.js +55 -0
- package/lib/models/index.d.ts +1 -0
- package/lib/models/index.d.ts.map +1 -1
- package/lib/models/index.js +11 -0
- package/lib/routes/api/v1/index.d.ts +1 -0
- package/lib/routes/api/v1/index.d.ts.map +1 -1
- package/lib/routes/api/v1/index.js +11 -0
- package/lib/routes/api/v1/logs.js +2 -2
- package/lib/routes/api/v1/report.d.ts +2 -0
- package/lib/routes/api/v1/report.d.ts.map +1 -0
- package/lib/routes/api/v1/report.js +19 -0
- package/package.json +1 -1
@@ -0,0 +1,9 @@
|
|
1
|
+
import { Attributes } from 'sequelize';
|
2
|
+
import { HttpController } from '../../app';
|
3
|
+
import { IRequestListData, THttpRequest } from '../../contracts';
|
4
|
+
import { Report } from '../../models/Report';
|
5
|
+
declare class ReportController extends HttpController {
|
6
|
+
list: THttpRequest<IRequestListData<Attributes<Report>>>;
|
7
|
+
}
|
8
|
+
export default ReportController;
|
9
|
+
//# sourceMappingURL=report.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../src/controllers/api/report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAa,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAqB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIpF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,cAAM,gBAAiB,SAAQ,cAAc;IAC3C,IAAI,EAAE,YAAY,CAAC,gBAAgB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAuCtD;CACH;AACD,eAAe,gBAAgB,CAAC"}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
var _app = require("../../app");
|
8
|
+
var _Log = require("../../models/Log");
|
9
|
+
var _services = require("../../services");
|
10
|
+
var _utils = require("../../utils");
|
11
|
+
class ReportController extends _app.HttpController {
|
12
|
+
list = async (req, res) => {
|
13
|
+
const {
|
14
|
+
page = 1,
|
15
|
+
filters = {},
|
16
|
+
limit = 10,
|
17
|
+
order = 'ASC',
|
18
|
+
orderBy = 'happenedAt'
|
19
|
+
} = req.body;
|
20
|
+
const offset = (Number(page) - 1) * Number(limit);
|
21
|
+
try {
|
22
|
+
const Entity = await _services.SequelizeService.singleton().getModel(_Log.Log, req.tenant.id);
|
23
|
+
/* filters */
|
24
|
+
const where = (0, _utils.processFilters)(filters);
|
25
|
+
const {
|
26
|
+
rows,
|
27
|
+
count
|
28
|
+
} = await Entity.findAndCountAll({
|
29
|
+
where,
|
30
|
+
order: [[orderBy, order]],
|
31
|
+
limit: Number(limit),
|
32
|
+
offset: offset < 0 ? 0 : offset
|
33
|
+
});
|
34
|
+
const pages = Math.ceil(count / Number(limit));
|
35
|
+
const hasMore = offset + Number(limit) < count;
|
36
|
+
this.send({
|
37
|
+
message: 'carregado com sucesso',
|
38
|
+
status: true,
|
39
|
+
type: 'success',
|
40
|
+
data: {
|
41
|
+
data: rows,
|
42
|
+
total: count,
|
43
|
+
pages,
|
44
|
+
hasMore
|
45
|
+
}
|
46
|
+
}, res);
|
47
|
+
} catch (error) {
|
48
|
+
throw new _app.HttpError({
|
49
|
+
message: 'Não foi possível obter a lista de mensagens',
|
50
|
+
error
|
51
|
+
});
|
52
|
+
}
|
53
|
+
};
|
54
|
+
}
|
55
|
+
var _default = exports.default = ReportController;
|
package/lib/models/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,YAAY,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAA0B,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKlD,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AAEzB,eAAO,MAAM,YAAY,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAA0B,CAAC"}
|
package/lib/models/index.js
CHANGED
@@ -32,6 +32,17 @@ Object.keys(_System).forEach(function (key) {
|
|
32
32
|
});
|
33
33
|
});
|
34
34
|
var _Report = require("./Report");
|
35
|
+
Object.keys(_Report).forEach(function (key) {
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
37
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
38
|
+
if (key in exports && exports[key] === _Report[key]) return;
|
39
|
+
Object.defineProperty(exports, key, {
|
40
|
+
enumerable: true,
|
41
|
+
get: function () {
|
42
|
+
return _Report[key];
|
43
|
+
}
|
44
|
+
});
|
45
|
+
});
|
35
46
|
var _Application = require("./Application");
|
36
47
|
Object.keys(_Application).forEach(function (key) {
|
37
48
|
if (key === "default" || key === "__esModule") return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/routes/api/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/routes/api/v1/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC"}
|
@@ -14,6 +14,17 @@ Object.keys(_logs).forEach(function (key) {
|
|
14
14
|
}
|
15
15
|
});
|
16
16
|
});
|
17
|
+
var _report = require("./report");
|
18
|
+
Object.keys(_report).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (key in exports && exports[key] === _report[key]) return;
|
21
|
+
Object.defineProperty(exports, key, {
|
22
|
+
enumerable: true,
|
23
|
+
get: function () {
|
24
|
+
return _report[key];
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
17
28
|
var _sse = require("./sse");
|
18
29
|
Object.keys(_sse).forEach(function (key) {
|
19
30
|
if (key === "default" || key === "__esModule") return;
|
@@ -13,7 +13,7 @@ const logRouter = exports.logRouter = (0, _express.Router)();
|
|
13
13
|
//* Middlewares
|
14
14
|
|
15
15
|
//* Controllers
|
16
|
-
const
|
16
|
+
const logController = new _log.default();
|
17
17
|
|
18
18
|
//* Definitions
|
19
|
-
logRouter.route('/list').post(
|
19
|
+
logRouter.route('/list').post(logController.list);
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../../../src/routes/api/v1/report.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,4CAAW,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.reportRouter = void 0;
|
7
|
+
var _express = require("express");
|
8
|
+
var _log = _interopRequireDefault(require("../../../controllers/api/log"));
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
10
|
+
//* Router
|
11
|
+
const reportRouter = exports.reportRouter = (0, _express.Router)();
|
12
|
+
|
13
|
+
//* Middlewares
|
14
|
+
|
15
|
+
//* Controllers
|
16
|
+
const reportController = new _log.default();
|
17
|
+
|
18
|
+
//* Definitions
|
19
|
+
reportRouter.route('/list').post(reportController.list);
|