@dracul/audit-backend 1.23.1 → 1.23.10

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.
@@ -3,6 +3,7 @@
3
3
  const {
4
4
  findAudit,
5
5
  fetchAudit,
6
+ createAudit,
6
7
  paginateAudit
7
8
  } = require("../../services/AuditService.js");
8
9
 
@@ -50,6 +51,23 @@ const resolvers = {
50
51
  if (!rbac.isAllowed(user.id, AUDIT_SHOW)) throw new ForbiddenError("Not Authorized");
51
52
  return paginateAudit(pageNumber, itemsPerPage, search, filters, orderBy, orderDesc);
52
53
  }
54
+ },
55
+ Mutation: {
56
+ createAudit: (_, {
57
+ action,
58
+ resource,
59
+ description
60
+ }, {
61
+ user
62
+ }) => {
63
+ if (!user) throw new AuthenticationError("Unauthenticated");
64
+ return createAudit(user, {
65
+ user: user.id,
66
+ action,
67
+ resource,
68
+ description
69
+ });
70
+ }
53
71
  }
54
72
  };
55
73
  module.exports = resolvers;
@@ -17,4 +17,8 @@ type Query {
17
17
  findAudit(id:ID!): Audit
18
18
  fetchAudit: [Audit]
19
19
  paginateAudit( pageNumber: Int, itemsPerPage: Int, search: String, filters: [FilterInput],orderBy: String, orderDesc: Boolean): AuditPaginated
20
- }
20
+ }
21
+
22
+ type Mutation {
23
+ createAudit(action: String!, resource: String!, description: String): Audit
24
+ }
package/lib/index.js CHANGED
@@ -15,16 +15,16 @@ Object.defineProperty(exports, "createAudit", {
15
15
  return _AuditService.createAudit;
16
16
  }
17
17
  });
18
- Object.defineProperty(exports, "deleteAudit", {
18
+ Object.defineProperty(exports, "fetchAudit", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _AuditService.deleteAudit;
21
+ return _AuditService.fetchAudit;
22
22
  }
23
23
  });
24
- Object.defineProperty(exports, "fetchAudit", {
24
+ Object.defineProperty(exports, "paginateAudit", {
25
25
  enumerable: true,
26
26
  get: function () {
27
- return _AuditService.fetchAudit;
27
+ return _AuditService.paginateAudit;
28
28
  }
29
29
  });
30
30
  exports.permissions = void 0;
@@ -40,12 +40,6 @@ Object.defineProperty(exports, "types", {
40
40
  return _index.types;
41
41
  }
42
42
  });
43
- Object.defineProperty(exports, "updateAudit", {
44
- enumerable: true,
45
- get: function () {
46
- return _AuditService.updateAudit;
47
- }
48
- });
49
43
 
50
44
  var _index = require("./graphql/index.js");
51
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dracul/audit-backend",
3
- "version": "1.23.1",
3
+ "version": "1.23.10",
4
4
  "description": "Audit Backend",
5
5
  "author": "Cristian Incarnato <cristian.cdi@gmail.com>",
6
6
  "homepage": "https://github.com/draculjs/modular-framework#readme",
@@ -64,5 +64,5 @@
64
64
  "mongoose-softdelete": "1.1.0",
65
65
  "mongoose-unique-validator": "^2.0.3"
66
66
  },
67
- "gitHead": "c333cf88b68123c7ec22319ed849069ba658e47f"
67
+ "gitHead": "c89409740944808db415bf91d7417ef16a88b921"
68
68
  }