@golemio/audit-logs 1.0.0-dev.1590464100 → 1.0.0-dev.1590498382

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.
@@ -0,0 +1 @@
1
+ { "schema": "audit_logs" }
@@ -0,0 +1 @@
1
+ truncate "audit_logs";
@@ -0,0 +1,4 @@
1
+ insert into audit_logs(id, action, entity, user_id, data, created_at) values
2
+ ('40507cee-6468-488e-ba78-e36d9c20e67c', 'create-user', 'User', 'test-user-1', '{"test": "test-data"}', '2024-12-02T12:00:00.000Z'),
3
+ ('6bdc3fdb-dd18-438b-878a-7972bddb0d92', 'create-user', 'User', 'test-user-2', null, '2024-12-02T12:01:00.000Z'),
4
+ ('eba39046-86d2-4f8c-aa39-932dfcfd6d0f', 'delete-user', 'User', 'test-user-1', null, '2024-12-02T12:02:00.000Z');
@@ -0,0 +1 @@
1
+ { "schema": "$DEFAULT_MODULE_PG_SCHEMA" }
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var dbm;
4
+ var type;
5
+ var seed;
6
+ var fs = require('fs');
7
+ var path = require('path');
8
+ var Promise;
9
+
10
+ /**
11
+ * We receive the dbmigrate dependency from dbmigrate initially.
12
+ * This enables us to not have to rely on NODE_PATH.
13
+ */
14
+ exports.setup = function(options, seedLink) {
15
+ dbm = options.dbmigrate;
16
+ type = dbm.dataType;
17
+ seed = seedLink;
18
+ Promise = options.Promise;
19
+ };
20
+
21
+ exports.up = function(db) {
22
+ var filePath = path.join(__dirname, 'sqls', '20241128105829-init-audit-logs-up.sql');
23
+ return new Promise( function( resolve, reject ) {
24
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
25
+ if (err) return reject(err);
26
+ console.log('received data: ' + data);
27
+
28
+ resolve(data);
29
+ });
30
+ })
31
+ .then(function(data) {
32
+ return db.runSql(data);
33
+ });
34
+ };
35
+
36
+ exports.down = function(db) {
37
+ var filePath = path.join(__dirname, 'sqls', '20241128105829-init-audit-logs-down.sql');
38
+ return new Promise( function( resolve, reject ) {
39
+ fs.readFile(filePath, {encoding: 'utf-8'}, function(err,data){
40
+ if (err) return reject(err);
41
+ console.log('received data: ' + data);
42
+
43
+ resolve(data);
44
+ });
45
+ })
46
+ .then(function(data) {
47
+ return db.runSql(data);
48
+ });
49
+ };
50
+
51
+ exports._meta = {
52
+ "version": 1
53
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,8 @@
1
+ create table audit_logs (
2
+ id uuid not null,
3
+ action text not null,
4
+ entity text not null,
5
+ user_id text not null,
6
+ data jsonb,
7
+ created_at timestamptz not null
8
+ );
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@golemio/audit-logs",
3
- "version": "1.0.0-dev.1590464100",
3
+ "version": "1.0.0-dev.1590498382",
4
4
  "description": "Golemio Audit Logs Module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",