@takentrade/takentrade-libs 3.3.3 → 4.0.0
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/dist/auth/decorators/get-user.decorator.d.ts +1 -1
- package/dist/auth/guards/index.d.ts +1 -0
- package/dist/auth/guards/index.js +17 -0
- package/dist/auth/guards/roles.guard.d.ts +20 -0
- package/dist/auth/guards/roles.guard.js +47 -0
- package/dist/auth/index.d.ts +3 -1
- package/dist/auth/index.js +3 -1
- package/dist/auth/interfaces/auth.interface.d.ts +21 -0
- package/dist/auth/interfaces/index.d.ts +1 -0
- package/dist/auth/interfaces/index.js +17 -0
- package/dist/auth/strategies/index.d.ts +1 -0
- package/dist/auth/strategies/index.js +17 -0
- package/dist/auth/strategies/tnt-jwt.strategy.d.ts +23 -0
- package/dist/auth/strategies/tnt-jwt.strategy.js +37 -0
- package/dist/common/dto/account.dto.d.ts +18 -0
- package/dist/common/dto/account.dto.js +68 -0
- package/dist/common/dto/index.d.ts +2 -0
- package/dist/common/dto/index.js +18 -0
- package/dist/common/dto/user.dto.d.ts +34 -0
- package/dist/common/dto/user.dto.js +132 -0
- package/dist/common/enums/index.d.ts +2 -1
- package/dist/common/enums/index.js +2 -1
- package/dist/common/enums/transaction.enum.d.ts +85 -0
- package/dist/common/enums/transaction.enum.js +97 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/logging/index.d.ts +3 -0
- package/dist/logging/index.js +18 -0
- package/dist/logging/logger.module.d.ts +6 -0
- package/dist/logging/logger.module.js +25 -0
- package/dist/logging/logger.service.d.ts +48 -0
- package/dist/logging/logger.service.js +107 -0
- package/dist/nats/constants/nats.constants.d.ts +11 -24
- package/dist/nats/constants/nats.constants.js +16 -28
- package/dist/nats/events/index.d.ts +174 -0
- package/dist/nats/events/index.js +2 -0
- package/dist/nats/index.d.ts +1 -0
- package/dist/nats/index.js +1 -0
- package/dist/rpc/filters/index.d.ts +1 -0
- package/dist/rpc/filters/index.js +17 -0
- package/dist/rpc/filters/rpc-exception.filter.d.ts +10 -0
- package/dist/rpc/filters/rpc-exception.filter.js +38 -0
- package/dist/rpc/index.d.ts +4 -54
- package/dist/rpc/index.js +18 -133
- package/dist/rpc/rpc-error.d.ts +10 -0
- package/dist/rpc/rpc-error.js +2 -0
- package/dist/rpc/rpc-response.d.ts +6 -0
- package/dist/rpc/rpc-response.js +2 -0
- package/dist/rpc/rpc.client.d.ts +46 -0
- package/dist/rpc/rpc.client.js +135 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -3
- package/dist/auth/auth.interface.d.ts +0 -8
- /package/dist/auth/{auth.interface.js → interfaces/auth.interface.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { TokenPayload } from '../
|
|
1
|
+
import { TokenPayload } from '../interfaces';
|
|
2
2
|
export declare const GetUser: (...dataOrPipes: (import("@nestjs/common").PipeTransform<any, any> | keyof TokenPayload | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>> | undefined)[]) => ParameterDecorator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './roles.guard';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./roles.guard"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CanActivate, ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { Reflector } from '@nestjs/core';
|
|
3
|
+
/**
|
|
4
|
+
* Role-based authorization guard
|
|
5
|
+
* Checks if the authenticated user has the required roles
|
|
6
|
+
*/
|
|
7
|
+
export declare class RolesGuard implements CanActivate {
|
|
8
|
+
private reflector;
|
|
9
|
+
/**
|
|
10
|
+
* Creates an instance of RolesGuard
|
|
11
|
+
* @param reflector - Reflector service for metadata access
|
|
12
|
+
*/
|
|
13
|
+
constructor(reflector: Reflector);
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the user has the required roles
|
|
16
|
+
* @param context - Execution context
|
|
17
|
+
* @returns True if user has required roles, false otherwise
|
|
18
|
+
*/
|
|
19
|
+
canActivate(context: ExecutionContext): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RolesGuard = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const roles_decorator_1 = require("../decorators/roles.decorator");
|
|
12
|
+
/**
|
|
13
|
+
* Role-based authorization guard
|
|
14
|
+
* Checks if the authenticated user has the required roles
|
|
15
|
+
*/
|
|
16
|
+
let RolesGuard = class RolesGuard {
|
|
17
|
+
reflector;
|
|
18
|
+
/**
|
|
19
|
+
* Creates an instance of RolesGuard
|
|
20
|
+
* @param reflector - Reflector service for metadata access
|
|
21
|
+
*/
|
|
22
|
+
constructor(reflector) {
|
|
23
|
+
this.reflector = reflector;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the user has the required roles
|
|
27
|
+
* @param context - Execution context
|
|
28
|
+
* @returns True if user has required roles, false otherwise
|
|
29
|
+
*/
|
|
30
|
+
canActivate(context) {
|
|
31
|
+
const requiredRoles = this.reflector.getAllAndOverride(roles_decorator_1.ROLES_KEY, [context.getHandler(), context.getClass()]);
|
|
32
|
+
if (!requiredRoles) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
const request = context.switchToHttp().getRequest();
|
|
36
|
+
const user = request.user;
|
|
37
|
+
if (!user) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const userRoles = user.roles || [];
|
|
41
|
+
return requiredRoles.some((role) => userRoles.includes(role));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
exports.RolesGuard = RolesGuard;
|
|
45
|
+
exports.RolesGuard = RolesGuard = __decorate([
|
|
46
|
+
(0, common_1.Injectable)()
|
|
47
|
+
], RolesGuard);
|
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.js
CHANGED
|
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./decorators"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./guards"), exports);
|
|
19
|
+
__exportStar(require("./strategies"), exports);
|
|
20
|
+
__exportStar(require("./interfaces/auth.interface"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface TokenPayload {
|
|
2
|
+
sub: string;
|
|
3
|
+
email: string;
|
|
4
|
+
userType?: 'USER' | 'STAFF';
|
|
5
|
+
iat?: number;
|
|
6
|
+
exp?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface UserPayload {
|
|
9
|
+
id: string;
|
|
10
|
+
email: string;
|
|
11
|
+
phone?: string | null;
|
|
12
|
+
userType: 'USER' | 'STAFF';
|
|
13
|
+
roles: string[];
|
|
14
|
+
permissions?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface JwtConfig {
|
|
17
|
+
secret: string;
|
|
18
|
+
issuer?: string;
|
|
19
|
+
audience?: string;
|
|
20
|
+
expiresIn?: string;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './auth.interface';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth.interface"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tnt-jwt.strategy';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./tnt-jwt.strategy"), exports);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Strategy } from 'passport-jwt';
|
|
2
|
+
import { TokenPayload, UserPayload, JwtConfig } from '../interfaces';
|
|
3
|
+
declare const TntJwtStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithRequest] | [opt: import("passport-jwt").StrategyOptionsWithoutRequest]) => Strategy & {
|
|
4
|
+
validate(...args: any[]): unknown;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* TNT JWT Strategy - Abstract base JWT strategy that services can extend.
|
|
8
|
+
* This provides common JWT validation logic while allowing
|
|
9
|
+
* each service to implement its own user lookup.
|
|
10
|
+
*/
|
|
11
|
+
export declare abstract class TntJwtStrategy extends TntJwtStrategy_base {
|
|
12
|
+
constructor(jwtConfig: JwtConfig);
|
|
13
|
+
/**
|
|
14
|
+
* Validates the JWT payload and returns the authenticated user.
|
|
15
|
+
* Each service must implement this method to perform its own user lookup.
|
|
16
|
+
*
|
|
17
|
+
* @param payload - The decoded JWT payload
|
|
18
|
+
* @returns The authenticated user payload
|
|
19
|
+
* @throws UnauthorizedException if validation fails
|
|
20
|
+
*/
|
|
21
|
+
abstract validate(payload: TokenPayload): Promise<UserPayload>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TntJwtStrategy = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const passport_1 = require("@nestjs/passport");
|
|
12
|
+
const passport_jwt_1 = require("passport-jwt");
|
|
13
|
+
/**
|
|
14
|
+
* TNT JWT Strategy - Abstract base JWT strategy that services can extend.
|
|
15
|
+
* This provides common JWT validation logic while allowing
|
|
16
|
+
* each service to implement its own user lookup.
|
|
17
|
+
*/
|
|
18
|
+
let TntJwtStrategy = class TntJwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy) {
|
|
19
|
+
constructor(jwtConfig) {
|
|
20
|
+
const options = {
|
|
21
|
+
jwtFromRequest: passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
22
|
+
ignoreExpiration: false,
|
|
23
|
+
secretOrKey: jwtConfig.secret,
|
|
24
|
+
};
|
|
25
|
+
if (jwtConfig.issuer) {
|
|
26
|
+
options.issuer = jwtConfig.issuer;
|
|
27
|
+
}
|
|
28
|
+
if (jwtConfig.audience) {
|
|
29
|
+
options.audience = jwtConfig.audience;
|
|
30
|
+
}
|
|
31
|
+
super(options);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.TntJwtStrategy = TntJwtStrategy;
|
|
35
|
+
exports.TntJwtStrategy = TntJwtStrategy = __decorate([
|
|
36
|
+
(0, common_1.Injectable)()
|
|
37
|
+
], TntJwtStrategy);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account Data Transfer Object
|
|
3
|
+
* Matches Prisma Account model schema
|
|
4
|
+
*/
|
|
5
|
+
export declare class AccountDTO {
|
|
6
|
+
id: string;
|
|
7
|
+
availableBalance: number;
|
|
8
|
+
bookBalance: number;
|
|
9
|
+
referralBalance: number;
|
|
10
|
+
pendingReferralBalance: number;
|
|
11
|
+
cashbackBalance: number;
|
|
12
|
+
isPinSet: boolean;
|
|
13
|
+
userId: string;
|
|
14
|
+
hasRestrictions: boolean;
|
|
15
|
+
holdAmount: number;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AccountDTO = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
const class_transformer_1 = require("class-transformer");
|
|
12
|
+
/**
|
|
13
|
+
* Account Data Transfer Object
|
|
14
|
+
* Matches Prisma Account model schema
|
|
15
|
+
*/
|
|
16
|
+
class AccountDTO {
|
|
17
|
+
id;
|
|
18
|
+
availableBalance;
|
|
19
|
+
bookBalance;
|
|
20
|
+
referralBalance;
|
|
21
|
+
pendingReferralBalance;
|
|
22
|
+
cashbackBalance;
|
|
23
|
+
isPinSet;
|
|
24
|
+
userId;
|
|
25
|
+
hasRestrictions;
|
|
26
|
+
holdAmount;
|
|
27
|
+
createdAt;
|
|
28
|
+
updatedAt;
|
|
29
|
+
}
|
|
30
|
+
exports.AccountDTO = AccountDTO;
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, class_validator_1.IsString)()
|
|
33
|
+
], AccountDTO.prototype, "id", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, class_validator_1.IsNumber)()
|
|
36
|
+
], AccountDTO.prototype, "availableBalance", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, class_validator_1.IsNumber)()
|
|
39
|
+
], AccountDTO.prototype, "bookBalance", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, class_validator_1.IsNumber)()
|
|
42
|
+
], AccountDTO.prototype, "referralBalance", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, class_validator_1.IsNumber)()
|
|
45
|
+
], AccountDTO.prototype, "pendingReferralBalance", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, class_validator_1.IsNumber)()
|
|
48
|
+
], AccountDTO.prototype, "cashbackBalance", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, class_validator_1.IsBoolean)()
|
|
51
|
+
], AccountDTO.prototype, "isPinSet", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, class_validator_1.IsString)()
|
|
54
|
+
], AccountDTO.prototype, "userId", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, class_validator_1.IsBoolean)()
|
|
57
|
+
], AccountDTO.prototype, "hasRestrictions", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, class_validator_1.IsNumber)()
|
|
60
|
+
], AccountDTO.prototype, "holdAmount", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
63
|
+
(0, class_validator_1.IsDate)()
|
|
64
|
+
], AccountDTO.prototype, "createdAt", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
67
|
+
(0, class_validator_1.IsDate)()
|
|
68
|
+
], AccountDTO.prototype, "updatedAt", void 0);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./user.dto"), exports);
|
|
18
|
+
__exportStar(require("./account.dto"), exports);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare enum Gender {
|
|
2
|
+
MALE = "MALE",
|
|
3
|
+
FEMALE = "FEMALE",
|
|
4
|
+
OTHER = "OTHER"
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* User Data Transfer Object
|
|
8
|
+
* Matches Prisma User model schema
|
|
9
|
+
*/
|
|
10
|
+
export declare class UserDTO {
|
|
11
|
+
id: string;
|
|
12
|
+
email: string;
|
|
13
|
+
phone: string;
|
|
14
|
+
username: string;
|
|
15
|
+
firstname?: string;
|
|
16
|
+
lastname?: string;
|
|
17
|
+
middlename?: string;
|
|
18
|
+
gender?: Gender;
|
|
19
|
+
image?: string;
|
|
20
|
+
imageId?: string;
|
|
21
|
+
dateOfBirth?: Date;
|
|
22
|
+
referralCode?: string;
|
|
23
|
+
isActive: boolean;
|
|
24
|
+
isVerified: boolean;
|
|
25
|
+
isEmailVerified: boolean;
|
|
26
|
+
isPhoneVerified: boolean;
|
|
27
|
+
isSignupCompleted: boolean;
|
|
28
|
+
isDeleted: boolean;
|
|
29
|
+
lastLogin?: Date;
|
|
30
|
+
createdAt: Date;
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
deletedAt?: Date;
|
|
33
|
+
deletedBy?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.UserDTO = exports.Gender = void 0;
|
|
10
|
+
const class_validator_1 = require("class-validator");
|
|
11
|
+
const class_transformer_1 = require("class-transformer");
|
|
12
|
+
var Gender;
|
|
13
|
+
(function (Gender) {
|
|
14
|
+
Gender["MALE"] = "MALE";
|
|
15
|
+
Gender["FEMALE"] = "FEMALE";
|
|
16
|
+
Gender["OTHER"] = "OTHER";
|
|
17
|
+
})(Gender || (exports.Gender = Gender = {}));
|
|
18
|
+
/**
|
|
19
|
+
* User Data Transfer Object
|
|
20
|
+
* Matches Prisma User model schema
|
|
21
|
+
*/
|
|
22
|
+
class UserDTO {
|
|
23
|
+
id;
|
|
24
|
+
email;
|
|
25
|
+
phone;
|
|
26
|
+
username;
|
|
27
|
+
firstname;
|
|
28
|
+
lastname;
|
|
29
|
+
middlename;
|
|
30
|
+
gender;
|
|
31
|
+
image;
|
|
32
|
+
imageId;
|
|
33
|
+
dateOfBirth;
|
|
34
|
+
referralCode;
|
|
35
|
+
isActive;
|
|
36
|
+
isVerified;
|
|
37
|
+
isEmailVerified;
|
|
38
|
+
isPhoneVerified;
|
|
39
|
+
isSignupCompleted;
|
|
40
|
+
isDeleted;
|
|
41
|
+
lastLogin;
|
|
42
|
+
createdAt;
|
|
43
|
+
updatedAt;
|
|
44
|
+
deletedAt;
|
|
45
|
+
deletedBy;
|
|
46
|
+
}
|
|
47
|
+
exports.UserDTO = UserDTO;
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, class_validator_1.IsString)()
|
|
50
|
+
], UserDTO.prototype, "id", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, class_validator_1.IsEmail)()
|
|
53
|
+
], UserDTO.prototype, "email", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, class_validator_1.IsString)()
|
|
56
|
+
], UserDTO.prototype, "phone", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, class_validator_1.IsString)()
|
|
59
|
+
], UserDTO.prototype, "username", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, class_validator_1.IsOptional)(),
|
|
62
|
+
(0, class_validator_1.IsString)()
|
|
63
|
+
], UserDTO.prototype, "firstname", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, class_validator_1.IsOptional)(),
|
|
66
|
+
(0, class_validator_1.IsString)()
|
|
67
|
+
], UserDTO.prototype, "lastname", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_validator_1.IsOptional)(),
|
|
70
|
+
(0, class_validator_1.IsString)()
|
|
71
|
+
], UserDTO.prototype, "middlename", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, class_validator_1.IsOptional)(),
|
|
74
|
+
(0, class_validator_1.IsEnum)(Gender)
|
|
75
|
+
], UserDTO.prototype, "gender", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, class_validator_1.IsOptional)(),
|
|
78
|
+
(0, class_validator_1.IsString)()
|
|
79
|
+
], UserDTO.prototype, "image", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, class_validator_1.IsOptional)(),
|
|
82
|
+
(0, class_validator_1.IsString)()
|
|
83
|
+
], UserDTO.prototype, "imageId", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, class_validator_1.IsOptional)(),
|
|
86
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
87
|
+
(0, class_validator_1.IsDate)()
|
|
88
|
+
], UserDTO.prototype, "dateOfBirth", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
(0, class_validator_1.IsOptional)(),
|
|
91
|
+
(0, class_validator_1.IsString)()
|
|
92
|
+
], UserDTO.prototype, "referralCode", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, class_validator_1.IsBoolean)()
|
|
95
|
+
], UserDTO.prototype, "isActive", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, class_validator_1.IsBoolean)()
|
|
98
|
+
], UserDTO.prototype, "isVerified", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
(0, class_validator_1.IsBoolean)()
|
|
101
|
+
], UserDTO.prototype, "isEmailVerified", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, class_validator_1.IsBoolean)()
|
|
104
|
+
], UserDTO.prototype, "isPhoneVerified", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, class_validator_1.IsBoolean)()
|
|
107
|
+
], UserDTO.prototype, "isSignupCompleted", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, class_validator_1.IsBoolean)()
|
|
110
|
+
], UserDTO.prototype, "isDeleted", void 0);
|
|
111
|
+
__decorate([
|
|
112
|
+
(0, class_validator_1.IsOptional)(),
|
|
113
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
114
|
+
(0, class_validator_1.IsDate)()
|
|
115
|
+
], UserDTO.prototype, "lastLogin", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
118
|
+
(0, class_validator_1.IsDate)()
|
|
119
|
+
], UserDTO.prototype, "createdAt", void 0);
|
|
120
|
+
__decorate([
|
|
121
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
122
|
+
(0, class_validator_1.IsDate)()
|
|
123
|
+
], UserDTO.prototype, "updatedAt", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
(0, class_validator_1.IsOptional)(),
|
|
126
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
127
|
+
(0, class_validator_1.IsDate)()
|
|
128
|
+
], UserDTO.prototype, "deletedAt", void 0);
|
|
129
|
+
__decorate([
|
|
130
|
+
(0, class_validator_1.IsOptional)(),
|
|
131
|
+
(0, class_validator_1.IsString)()
|
|
132
|
+
], UserDTO.prototype, "deletedBy", void 0);
|
|
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./ticket.enum"), exports);
|
|
18
17
|
__exportStar(require("./support-action.enum"), exports);
|
|
18
|
+
__exportStar(require("./ticket.enum"), exports);
|
|
19
|
+
__exportStar(require("./transaction.enum"), exports);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export declare enum TransactionType {
|
|
2
|
+
CREDIT = "CREDIT",
|
|
3
|
+
DEBIT = "DEBIT",
|
|
4
|
+
DEPOSIT = "DEPOSIT",
|
|
5
|
+
TOP_UP = "TOP_UP",
|
|
6
|
+
WITHDRAWAL = "WITHDRAWAL",
|
|
7
|
+
INTEREST_ACCRUAL = "INTEREST_ACCRUAL",
|
|
8
|
+
TAX_DEDUCTION = "TAX_DEDUCTION",
|
|
9
|
+
PAUSE = "PAUSE",
|
|
10
|
+
CONTRIBUTION = "CONTRIBUTION",
|
|
11
|
+
PAYOUT = "PAYOUT",
|
|
12
|
+
FEE_DEDUCTION = "FEE_DEDUCTION"
|
|
13
|
+
}
|
|
14
|
+
export declare enum TransactionCategory {
|
|
15
|
+
DEPOSIT = "DEPOSIT",
|
|
16
|
+
WITHDRAWAL = "WITHDRAWAL",
|
|
17
|
+
LOAN_DISBURSEMENT = "LOAN_DISBURSEMENT",
|
|
18
|
+
LOAN_REPAYMENT = "LOAN_REPAYMENT",
|
|
19
|
+
AJO_CONTRIBUTION = "AJO_CONTRIBUTION",
|
|
20
|
+
AJO_TOPUP = "AJO_TOPUP",
|
|
21
|
+
AJO_COMPLETION = "AJO_COMPLETION",
|
|
22
|
+
AIRTIME = "AIRTIME",
|
|
23
|
+
DATA = "DATA",
|
|
24
|
+
ELECTRICITY = "ELECTRICITY",
|
|
25
|
+
CABLETV = "CABLETV",
|
|
26
|
+
BETTING = "BETTING",
|
|
27
|
+
INTERNET = "INTERNET",
|
|
28
|
+
EDUCATION = "EDUCATION",
|
|
29
|
+
TRANSPORT = "TRANSPORT",
|
|
30
|
+
DONATION = "DONATION",
|
|
31
|
+
INSURANCE = "INSURANCE",
|
|
32
|
+
TAX = "TAX",
|
|
33
|
+
RELIGION = "RELIGION",
|
|
34
|
+
TRANSFER = "TRANSFER",
|
|
35
|
+
REFERRAL_BONUS = "REFERRAL_BONUS",
|
|
36
|
+
FEES = "FEES",
|
|
37
|
+
FEE_COLLECTION = "FEE_COLLECTION",
|
|
38
|
+
PENALTY = "PENALTY",
|
|
39
|
+
LOAN_INTEREST = "LOAN_INTEREST",
|
|
40
|
+
AJO_FEE = "AJO_FEE"
|
|
41
|
+
}
|
|
42
|
+
export declare enum TransactionStatus {
|
|
43
|
+
PENDING = "PENDING",
|
|
44
|
+
SUCCESSFUL = "SUCCESSFUL",
|
|
45
|
+
FAILED = "FAILED",
|
|
46
|
+
REVERSED = "REVERSED"
|
|
47
|
+
}
|
|
48
|
+
export declare enum LoanStatus {
|
|
49
|
+
PENDING = "PENDING",
|
|
50
|
+
APPROVED = "APPROVED",
|
|
51
|
+
DISBURSED = "DISBURSED",
|
|
52
|
+
REPAID = "REPAID",
|
|
53
|
+
OVERDUE = "OVERDUE",
|
|
54
|
+
DECLINED = "DECLINED"
|
|
55
|
+
}
|
|
56
|
+
export declare enum SavingsStatus {
|
|
57
|
+
ACTIVE = "ACTIVE",
|
|
58
|
+
MATURED = "MATURED",
|
|
59
|
+
CLOSED = "CLOSED",
|
|
60
|
+
PENDING = "PENDING",
|
|
61
|
+
SUSPENDED = "SUSPENDED"
|
|
62
|
+
}
|
|
63
|
+
export declare enum AjoStatus {
|
|
64
|
+
ACTIVE = "ACTIVE",
|
|
65
|
+
COMPLETED = "COMPLETED",
|
|
66
|
+
CANCELLED = "CANCELLED",
|
|
67
|
+
PAUSED = "PAUSED"
|
|
68
|
+
}
|
|
69
|
+
export declare enum AjoMembershipStatus {
|
|
70
|
+
PENDING = "PENDING",
|
|
71
|
+
ACTIVE = "ACTIVE",
|
|
72
|
+
INACTIVE = "INACTIVE",
|
|
73
|
+
REMOVED = "REMOVED"
|
|
74
|
+
}
|
|
75
|
+
export declare enum AjoType {
|
|
76
|
+
PERSONAL = "PERSONAL",
|
|
77
|
+
FAMILY = "FAMILY",
|
|
78
|
+
FRIEND = "FRIEND",
|
|
79
|
+
GROUP = "GROUP"
|
|
80
|
+
}
|
|
81
|
+
export declare enum Frequency {
|
|
82
|
+
DAILY = "DAILY",
|
|
83
|
+
WEEKLY = "WEEKLY",
|
|
84
|
+
MONTHLY = "MONTHLY"
|
|
85
|
+
}
|