@vboxdev/common 0.0.1-security → 1.0.73
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.
Potentially problematic release.
This version of @vboxdev/common might be problematic. Click here for more details.
- package/build/errors/bad-request-error.d.ts +10 -0
- package/build/errors/bad-request-error.js +39 -0
- package/build/errors/custom-error.d.ts +8 -0
- package/build/errors/custom-error.js +28 -0
- package/build/errors/database-connection-error.d.ts +10 -0
- package/build/errors/database-connection-error.js +40 -0
- package/build/errors/not-authorized-error.d.ts +9 -0
- package/build/errors/not-authorized-error.js +38 -0
- package/build/errors/not-found-error.d.ts +9 -0
- package/build/errors/not-found-error.js +38 -0
- package/build/errors/request-validation.d.ts +12 -0
- package/build/errors/request-validation.js +37 -0
- package/build/events/base-listener.d.ts +18 -0
- package/build/events/base-listener.js +27 -0
- package/build/events/base-publisher.d.ts +13 -0
- package/build/events/base-publisher.js +22 -0
- package/build/events/buy-movie-created-event.d.ts +14 -0
- package/build/events/buy-movie-created-event.js +2 -0
- package/build/events/code-created-event.d.ts +15 -0
- package/build/events/code-created-event.js +3 -0
- package/build/events/code-updated-event.d.ts +15 -0
- package/build/events/code-updated-event.js +2 -0
- package/build/events/expiration-verification-events.d.ts +7 -0
- package/build/events/expiration-verification-events.js +2 -0
- package/build/events/movies-created-event.d.ts +27 -0
- package/build/events/movies-created-event.js +2 -0
- package/build/events/movies-updated-event.d.ts +27 -0
- package/build/events/movies-updated-event.js +2 -0
- package/build/events/subjects.d.ts +15 -0
- package/build/events/subjects.js +19 -0
- package/build/events/transaction-created-event.d.ts +20 -0
- package/build/events/transaction-created-event.js +2 -0
- package/build/events/transaction-updated-event.d.ts +20 -0
- package/build/events/transaction-updated-event.js +2 -0
- package/build/events/types/code-type.d.ts +5 -0
- package/build/events/types/code-type.js +9 -0
- package/build/events/types/movie-status.d.ts +7 -0
- package/build/events/types/movie-status.js +11 -0
- package/build/events/types/movies-language.d.ts +6 -0
- package/build/events/types/movies-language.js +10 -0
- package/build/events/types/subtitle-type.d.ts +0 -0
- package/build/events/types/subtitle-type.js +1 -0
- package/build/events/types/user-status.d.ts +4 -0
- package/build/events/types/user-status.js +8 -0
- package/build/events/types/user-type.d.ts +7 -0
- package/build/events/types/user-type.js +11 -0
- package/build/events/types/verification-status.d.ts +5 -0
- package/build/events/types/verification-status.js +9 -0
- package/build/events/users-created-event.d.ts +17 -0
- package/build/events/users-created-event.js +2 -0
- package/build/events/users-delete-event.d.ts +8 -0
- package/build/events/users-delete-event.js +2 -0
- package/build/events/users-updated-event.d.ts +17 -0
- package/build/events/users-updated-event.js +2 -0
- package/build/events/wallet-created-event.d.ts +12 -0
- package/build/events/wallet-created-event.js +2 -0
- package/build/events/wallet-updated-event.d.ts +12 -0
- package/build/events/wallet-updated-event.js +2 -0
- package/build/index.d.ts +37 -0
- package/build/index.js +49 -0
- package/build/middlewares/current-user.d.ts +18 -0
- package/build/middlewares/current-user.js +30 -0
- package/build/middlewares/error-handler.d.ts +2 -0
- package/build/middlewares/error-handler.js +20 -0
- package/build/middlewares/push-notification.d.ts +2 -0
- package/build/middlewares/push-notification.js +95 -0
- package/build/middlewares/require-auth-admin.d.ts +2 -0
- package/build/middlewares/require-auth-admin.js +11 -0
- package/build/middlewares/require-auth-producer.d.ts +2 -0
- package/build/middlewares/require-auth-producer.js +11 -0
- package/build/middlewares/require-auth-reviwer.d.ts +2 -0
- package/build/middlewares/require-auth-reviwer.js +11 -0
- package/build/middlewares/require-auth-supervisor.d.ts +2 -0
- package/build/middlewares/require-auth-supervisor.js +11 -0
- package/build/middlewares/require-auth.d.ts +2 -0
- package/build/middlewares/require-auth.js +11 -0
- package/build/middlewares/validate-request.d.ts +2 -0
- package/build/middlewares/validate-request.js +14 -0
- package/build/services/serviceAccountKey.json +12 -0
- package/package.json +31 -3
- package/README.md +0 -5
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.BadRequestError = void 0;
|
|
19
|
+
var custom_error_1 = require("./custom-error");
|
|
20
|
+
var BadRequestError = /** @class */ (function (_super) {
|
|
21
|
+
__extends(BadRequestError, _super);
|
|
22
|
+
function BadRequestError(message) {
|
|
23
|
+
var _this = _super.call(this, message) || this;
|
|
24
|
+
_this.message = message;
|
|
25
|
+
_this.statusCode = 400;
|
|
26
|
+
Object.setPrototypeOf(_this, BadRequestError.prototype);
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
BadRequestError.prototype.serializeErrors = function () {
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
code: 400,
|
|
33
|
+
message: this.message,
|
|
34
|
+
},
|
|
35
|
+
];
|
|
36
|
+
};
|
|
37
|
+
return BadRequestError;
|
|
38
|
+
}(custom_error_1.CustomError));
|
|
39
|
+
exports.BadRequestError = BadRequestError;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.CustomError = void 0;
|
|
19
|
+
var CustomError = /** @class */ (function (_super) {
|
|
20
|
+
__extends(CustomError, _super);
|
|
21
|
+
function CustomError(message) {
|
|
22
|
+
var _this = _super.call(this, message) || this;
|
|
23
|
+
Object.setPrototypeOf(_this, CustomError.prototype);
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
return CustomError;
|
|
27
|
+
}(Error));
|
|
28
|
+
exports.CustomError = CustomError;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DatabaseConnectionError = void 0;
|
|
19
|
+
var custom_error_1 = require("./custom-error");
|
|
20
|
+
var DatabaseConnectionError = /** @class */ (function (_super) {
|
|
21
|
+
__extends(DatabaseConnectionError, _super);
|
|
22
|
+
function DatabaseConnectionError() {
|
|
23
|
+
var _this = _super.call(this, 'Error connecting to database.') || this;
|
|
24
|
+
_this.statusCode = 500;
|
|
25
|
+
_this.reason = 'Error connecting to database.';
|
|
26
|
+
Object.setPrototypeOf(_this, DatabaseConnectionError.prototype);
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
// hello
|
|
30
|
+
DatabaseConnectionError.prototype.serializeErrors = function () {
|
|
31
|
+
return [
|
|
32
|
+
{
|
|
33
|
+
code: 500,
|
|
34
|
+
message: this.reason,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
};
|
|
38
|
+
return DatabaseConnectionError;
|
|
39
|
+
}(custom_error_1.CustomError));
|
|
40
|
+
exports.DatabaseConnectionError = DatabaseConnectionError;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.NotAuthorizedError = void 0;
|
|
19
|
+
var custom_error_1 = require("./custom-error");
|
|
20
|
+
var NotAuthorizedError = /** @class */ (function (_super) {
|
|
21
|
+
__extends(NotAuthorizedError, _super);
|
|
22
|
+
function NotAuthorizedError() {
|
|
23
|
+
var _this = _super.call(this, 'Not authorized') || this;
|
|
24
|
+
_this.statusCode = 401;
|
|
25
|
+
Object.setPrototypeOf(_this, NotAuthorizedError.prototype);
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
NotAuthorizedError.prototype.serializeErrors = function () {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
code: 401,
|
|
32
|
+
message: 'Not authorized',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
return NotAuthorizedError;
|
|
37
|
+
}(custom_error_1.CustomError));
|
|
38
|
+
exports.NotAuthorizedError = NotAuthorizedError;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.NotFoundError = void 0;
|
|
19
|
+
var custom_error_1 = require("./custom-error");
|
|
20
|
+
var NotFoundError = /** @class */ (function (_super) {
|
|
21
|
+
__extends(NotFoundError, _super);
|
|
22
|
+
function NotFoundError() {
|
|
23
|
+
var _this = _super.call(this, 'Route not found') || this;
|
|
24
|
+
_this.statusCode = 404;
|
|
25
|
+
Object.setPrototypeOf(_this, NotFoundError.prototype);
|
|
26
|
+
return _this;
|
|
27
|
+
}
|
|
28
|
+
NotFoundError.prototype.serializeErrors = function () {
|
|
29
|
+
return [
|
|
30
|
+
{
|
|
31
|
+
code: 404,
|
|
32
|
+
message: 'Not Found',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
};
|
|
36
|
+
return NotFoundError;
|
|
37
|
+
}(custom_error_1.CustomError));
|
|
38
|
+
exports.NotFoundError = NotFoundError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValidationError } from 'express-validator';
|
|
2
|
+
import { CustomError } from './custom-error';
|
|
3
|
+
export declare class RequestValidationError extends CustomError {
|
|
4
|
+
errors: ValidationError[];
|
|
5
|
+
statusCode: number;
|
|
6
|
+
constructor(errors: ValidationError[]);
|
|
7
|
+
serializeErrors(): {
|
|
8
|
+
code: number;
|
|
9
|
+
message: any;
|
|
10
|
+
field: string;
|
|
11
|
+
}[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.RequestValidationError = void 0;
|
|
19
|
+
var custom_error_1 = require("./custom-error");
|
|
20
|
+
var RequestValidationError = /** @class */ (function (_super) {
|
|
21
|
+
__extends(RequestValidationError, _super);
|
|
22
|
+
function RequestValidationError(errors) {
|
|
23
|
+
var _this = _super.call(this, 'Invalid request parameter') || this;
|
|
24
|
+
_this.errors = errors;
|
|
25
|
+
_this.statusCode = 400;
|
|
26
|
+
// Only because we are extending a build in class
|
|
27
|
+
Object.setPrototypeOf(_this, RequestValidationError.prototype);
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
RequestValidationError.prototype.serializeErrors = function () {
|
|
31
|
+
return this.errors.map(function (err) {
|
|
32
|
+
return { code: 400, message: err.msg, field: err.param };
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return RequestValidationError;
|
|
36
|
+
}(custom_error_1.CustomError));
|
|
37
|
+
exports.RequestValidationError = RequestValidationError;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import nats, { Message, Stan } from 'node-nats-streaming';
|
|
2
|
+
import { Subjects } from './subjects';
|
|
3
|
+
interface Event {
|
|
4
|
+
subject: Subjects;
|
|
5
|
+
data: any;
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class Listener<T extends Event> {
|
|
8
|
+
abstract subject: T['subject'];
|
|
9
|
+
abstract onMessage(data: T['data'], msg: Message): void;
|
|
10
|
+
abstract queueGroupName: string;
|
|
11
|
+
protected ackWait: number;
|
|
12
|
+
protected client: Stan;
|
|
13
|
+
constructor(client: Stan);
|
|
14
|
+
subscriptionOptions(): nats.SubscriptionOptions;
|
|
15
|
+
listen(): void;
|
|
16
|
+
parseMessage(msg: Message): any;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Listener = void 0;
|
|
4
|
+
var Listener = /** @class */ (function () {
|
|
5
|
+
function Listener(client) {
|
|
6
|
+
this.ackWait = 5 * 1000;
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
Listener.prototype.subscriptionOptions = function () {
|
|
10
|
+
return this.client.subscriptionOptions().setDeliverAllAvailable().setManualAckMode(true).setAckWait(this.ackWait).setDurableName(this.queueGroupName);
|
|
11
|
+
};
|
|
12
|
+
Listener.prototype.listen = function () {
|
|
13
|
+
var _this = this;
|
|
14
|
+
var subscription = this.client.subscribe(this.subject, this.queueGroupName, this.subscriptionOptions());
|
|
15
|
+
subscription.on('message', function (msg) {
|
|
16
|
+
console.log("Message received: " + _this.subject + " / " + _this.queueGroupName + " ");
|
|
17
|
+
var parsedData = _this.parseMessage(msg);
|
|
18
|
+
_this.onMessage(parsedData, msg);
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
Listener.prototype.parseMessage = function (msg) {
|
|
22
|
+
var data = msg.getData();
|
|
23
|
+
return typeof data === 'string' ? JSON.parse(data) : JSON.parse(data.toString('utf8'));
|
|
24
|
+
};
|
|
25
|
+
return Listener;
|
|
26
|
+
}());
|
|
27
|
+
exports.Listener = Listener;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Stan } from 'node-nats-streaming';
|
|
2
|
+
import { Subjects } from './subjects';
|
|
3
|
+
interface Event {
|
|
4
|
+
subject: Subjects;
|
|
5
|
+
data: any;
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class Publisher<T extends Event> {
|
|
8
|
+
abstract subject: T['subject'];
|
|
9
|
+
protected client: Stan;
|
|
10
|
+
constructor(client: Stan);
|
|
11
|
+
publish(data: T['data']): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Publisher = void 0;
|
|
4
|
+
var Publisher = /** @class */ (function () {
|
|
5
|
+
function Publisher(client) {
|
|
6
|
+
this.client = client;
|
|
7
|
+
}
|
|
8
|
+
Publisher.prototype.publish = function (data) {
|
|
9
|
+
var _this = this;
|
|
10
|
+
return new Promise(function (resolve, reject) {
|
|
11
|
+
_this.client.publish(_this.subject, JSON.stringify(data), function (err) {
|
|
12
|
+
if (err) {
|
|
13
|
+
return reject(err);
|
|
14
|
+
}
|
|
15
|
+
console.log('Event published to subject', _this.subject);
|
|
16
|
+
resolve();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
return Publisher;
|
|
21
|
+
}());
|
|
22
|
+
exports.Publisher = Publisher;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Subjects } from './subjects';
|
|
2
|
+
import { Types } from 'mongoose';
|
|
3
|
+
export interface BuyMovieCreatedEvent {
|
|
4
|
+
subject: Subjects.BuyMovieCreated;
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
version: number;
|
|
8
|
+
walletNumber: string;
|
|
9
|
+
user: Types.ObjectId;
|
|
10
|
+
itemId: Types.ObjectId;
|
|
11
|
+
amountInKobo: number;
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Subjects } from './subjects';
|
|
2
|
+
import { VerificationStatus } from './types/verification-status';
|
|
3
|
+
import { CodeType } from './types/code-type';
|
|
4
|
+
export interface CodeCreatedEvent {
|
|
5
|
+
subject: Subjects.CodeCreated;
|
|
6
|
+
data: {
|
|
7
|
+
user: string;
|
|
8
|
+
version: number;
|
|
9
|
+
verification: VerificationStatus;
|
|
10
|
+
verification_code: number;
|
|
11
|
+
codeType: CodeType;
|
|
12
|
+
expiresAt: Date;
|
|
13
|
+
masked_phone: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Subjects } from './subjects';
|
|
2
|
+
import { VerificationStatus } from './types/verification-status';
|
|
3
|
+
import { CodeType } from './types/code-type';
|
|
4
|
+
export interface CodeUpdatedEvent {
|
|
5
|
+
subject: Subjects.CodeUpdated;
|
|
6
|
+
data: {
|
|
7
|
+
user: string;
|
|
8
|
+
version: number;
|
|
9
|
+
verification: VerificationStatus;
|
|
10
|
+
verification_code: number;
|
|
11
|
+
codeType: CodeType;
|
|
12
|
+
expiresAt: Date;
|
|
13
|
+
masked_phone: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Subjects } from './subjects';
|
|
2
|
+
import { MovieStatus } from './types/movie-status';
|
|
3
|
+
export interface MovieCreatedEvent {
|
|
4
|
+
subject: Subjects.MovieCreated;
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
version: number;
|
|
8
|
+
title: string;
|
|
9
|
+
genre: string;
|
|
10
|
+
language: string;
|
|
11
|
+
subtitle: Boolean;
|
|
12
|
+
year: string;
|
|
13
|
+
length: string;
|
|
14
|
+
sexual: Boolean;
|
|
15
|
+
Mrating: string;
|
|
16
|
+
blockbuster: Boolean;
|
|
17
|
+
trailer: string;
|
|
18
|
+
cast: Object;
|
|
19
|
+
description: string;
|
|
20
|
+
user: any;
|
|
21
|
+
director: Object;
|
|
22
|
+
Urating: number;
|
|
23
|
+
url: string;
|
|
24
|
+
banner: string;
|
|
25
|
+
status: MovieStatus;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Subjects } from './subjects';
|
|
2
|
+
import { MovieStatus } from './types/movie-status';
|
|
3
|
+
export interface MoiveUpdatedEvent {
|
|
4
|
+
subject: Subjects.MovieUpdate;
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
version: number;
|
|
8
|
+
title: string;
|
|
9
|
+
genre: string;
|
|
10
|
+
language: string;
|
|
11
|
+
subtitle: Boolean;
|
|
12
|
+
year: string;
|
|
13
|
+
length: string;
|
|
14
|
+
sexual: Boolean;
|
|
15
|
+
Mrating: string;
|
|
16
|
+
blockbuster: Boolean;
|
|
17
|
+
trailer: string;
|
|
18
|
+
cast: Object;
|
|
19
|
+
description: string;
|
|
20
|
+
user: any;
|
|
21
|
+
director: Object;
|
|
22
|
+
Urating: number;
|
|
23
|
+
url: string;
|
|
24
|
+
banner: string;
|
|
25
|
+
status: MovieStatus;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum Subjects {
|
|
2
|
+
UserCreated = "user:created",
|
|
3
|
+
CodeCreated = "code:created",
|
|
4
|
+
UserUpdated = "user:updated",
|
|
5
|
+
UserDelete = "user:delete",
|
|
6
|
+
CodeUpdated = "code:updated",
|
|
7
|
+
MovieCreated = "movie:created",
|
|
8
|
+
MovieUpdate = "movie:update",
|
|
9
|
+
TransactionCreated = "transaction:created",
|
|
10
|
+
TransactionUpdate = "transaction:update",
|
|
11
|
+
WalletCreated = "wallet:created",
|
|
12
|
+
WalletUpdated = "wallet:update",
|
|
13
|
+
BuyMovieCreated = "buy:movie:created",
|
|
14
|
+
VerificationCOmplete = "verification:expired"
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Subjects = void 0;
|
|
4
|
+
var Subjects;
|
|
5
|
+
(function (Subjects) {
|
|
6
|
+
Subjects["UserCreated"] = "user:created";
|
|
7
|
+
Subjects["CodeCreated"] = "code:created";
|
|
8
|
+
Subjects["UserUpdated"] = "user:updated";
|
|
9
|
+
Subjects["UserDelete"] = "user:delete";
|
|
10
|
+
Subjects["CodeUpdated"] = "code:updated";
|
|
11
|
+
Subjects["MovieCreated"] = "movie:created";
|
|
12
|
+
Subjects["MovieUpdate"] = "movie:update";
|
|
13
|
+
Subjects["TransactionCreated"] = "transaction:created";
|
|
14
|
+
Subjects["TransactionUpdate"] = "transaction:update";
|
|
15
|
+
Subjects["WalletCreated"] = "wallet:created";
|
|
16
|
+
Subjects["WalletUpdated"] = "wallet:update";
|
|
17
|
+
Subjects["BuyMovieCreated"] = "buy:movie:created";
|
|
18
|
+
Subjects["VerificationCOmplete"] = "verification:expired";
|
|
19
|
+
})(Subjects = exports.Subjects || (exports.Subjects = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Subjects } from './subjects';
|
|
2
|
+
import { Types } from 'mongoose';
|
|
3
|
+
export interface TransactionCreatedEvent {
|
|
4
|
+
subject: Subjects.TransactionCreated;
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
version: number;
|
|
8
|
+
walletNumber: string;
|
|
9
|
+
user: Types.ObjectId;
|
|
10
|
+
description: string;
|
|
11
|
+
extraDescription: string;
|
|
12
|
+
itemId: Types.ObjectId;
|
|
13
|
+
quantity: number;
|
|
14
|
+
amountInKobo: number;
|
|
15
|
+
purchaserEmail: string;
|
|
16
|
+
status: string;
|
|
17
|
+
reference: any;
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Subjects } from './subjects';
|
|
2
|
+
import { Types } from 'mongoose';
|
|
3
|
+
export interface TransactionUpdatedEvent {
|
|
4
|
+
subject: Subjects.TransactionUpdate;
|
|
5
|
+
data: {
|
|
6
|
+
id: string;
|
|
7
|
+
version: number;
|
|
8
|
+
walletNumber: string;
|
|
9
|
+
user: Types.ObjectId;
|
|
10
|
+
description: string;
|
|
11
|
+
extraDescription: string;
|
|
12
|
+
itemId: Types.ObjectId;
|
|
13
|
+
quantity: number;
|
|
14
|
+
amountInKobo: number;
|
|
15
|
+
purchaserEmail: string;
|
|
16
|
+
status: string;
|
|
17
|
+
reference: any;
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CodeType = void 0;
|
|
4
|
+
var CodeType;
|
|
5
|
+
(function (CodeType) {
|
|
6
|
+
CodeType["Passowrd"] = "password";
|
|
7
|
+
CodeType["Verification"] = "Verification";
|
|
8
|
+
CodeType["Free"] = "Null";
|
|
9
|
+
})(CodeType = exports.CodeType || (exports.CodeType = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MovieStatus = void 0;
|
|
4
|
+
var MovieStatus;
|
|
5
|
+
(function (MovieStatus) {
|
|
6
|
+
MovieStatus["Pending"] = "pending";
|
|
7
|
+
MovieStatus["Approved"] = "approved";
|
|
8
|
+
MovieStatus["Rejected"] = "rejected";
|
|
9
|
+
MovieStatus["PreApproved"] = "preApproved";
|
|
10
|
+
MovieStatus["Delete"] = "delete";
|
|
11
|
+
})(MovieStatus = exports.MovieStatus || (exports.MovieStatus = {}));
|