blend-kit 1.0.1

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.
Files changed (210) hide show
  1. package/dist/helper/ApiHelper.js +0 -0
  2. package/dist/helper/BasicHelper.js +28 -0
  3. package/dist/helper/CommonHelper.js +10 -0
  4. package/dist/helper/DataHelper.js +241 -0
  5. package/dist/helper/ExpressHelper.js +728 -0
  6. package/dist/helper/FrontEndApiHelper.js +485 -0
  7. package/dist/helper/FrontEndReactApiHelper.js +483 -0
  8. package/dist/helper/MongoHelper.js +143 -0
  9. package/dist/helper/RNHelper.js +560 -0
  10. package/dist/helper/ReactHelper.js +524 -0
  11. package/dist/helper/SectionHelper.js +152 -0
  12. package/dist/helper/fileHelper.js +127 -0
  13. package/dist/helper/grammarHelper/BlendApiGrammarHelper.js +48 -0
  14. package/dist/helper/grammarHelper/BlendBasicGrammarHelper.js +98 -0
  15. package/dist/helper/grammarHelper/BlendDataGrammarHelper.js +47 -0
  16. package/dist/helper/grammarHelper/BlendMDPGrammarHelper.js +29 -0
  17. package/dist/helper/grammarHelper/BlendMongoGrammarHelper.js +51 -0
  18. package/dist/helper/grammarHelper/BlendRNGrammarHelper.js +56 -0
  19. package/dist/helper/grammarHelper/BlendReactGrammarHelper.js +55 -0
  20. package/dist/helper/grammarHelper/GrammarErrorHelper.js +16 -0
  21. package/dist/index.js +159 -0
  22. package/dist/parser/blendApi/src/grammar/BlendApiLexer.js +201 -0
  23. package/dist/parser/blendApi/src/grammar/BlendApiListener.js +3 -0
  24. package/dist/parser/blendApi/src/grammar/BlendApiParser.js +961 -0
  25. package/dist/parser/blendData/src/grammar/BlendDataLexer.js +154 -0
  26. package/dist/parser/blendData/src/grammar/BlendDataListener.js +3 -0
  27. package/dist/parser/blendData/src/grammar/BlendDataParser.js +641 -0
  28. package/dist/parser/blendMDP/src/grammar/BlendMDPLexer.js +151 -0
  29. package/dist/parser/blendMDP/src/grammar/BlendMDPListener.js +3 -0
  30. package/dist/parser/blendMDP/src/grammar/BlendMDPParser.js +490 -0
  31. package/dist/parser/blendMongo/src/grammar/BlendMongoLexer.js +187 -0
  32. package/dist/parser/blendMongo/src/grammar/BlendMongoListener.js +3 -0
  33. package/dist/parser/blendMongo/src/grammar/BlendMongoParser.js +848 -0
  34. package/dist/parser/blendRN/src/grammar/BlendRNLexer.js +172 -0
  35. package/dist/parser/blendRN/src/grammar/BlendRNListener.js +3 -0
  36. package/dist/parser/blendRN/src/grammar/BlendRNParser.js +657 -0
  37. package/dist/parser/blendReact/src/grammar/BlendReactLexer.js +159 -0
  38. package/dist/parser/blendReact/src/grammar/BlendReactListener.js +3 -0
  39. package/dist/parser/blendReact/src/grammar/BlendReactParser.js +644 -0
  40. package/dist/parser/blendbasic/src/grammar/BlendBasicLexer.js +147 -0
  41. package/dist/parser/blendbasic/src/grammar/BlendBasicListener.js +3 -0
  42. package/dist/parser/blendbasic/src/grammar/BlendBasicParser.js +747 -0
  43. package/dist/src/app.js +76 -0
  44. package/dist/src/app.ts +54 -0
  45. package/dist/types/apiOperationTypes.js +13 -0
  46. package/dist/types/basicOperationTypes.js +2 -0
  47. package/dist/types/dataOperationTypes.js +2 -0
  48. package/dist/types/frontendOperationTypes.js +4 -0
  49. package/dist/types/generalTypes.js +0 -0
  50. package/dist/types/mongoOperationTypes.js +12 -0
  51. package/package.json +29 -0
  52. package/src/grammar/.antlr/ApiModuleLexer.interp +71 -0
  53. package/src/grammar/.antlr/ApiModuleLexer.java +194 -0
  54. package/src/grammar/.antlr/ApiModuleLexer.tokens +32 -0
  55. package/src/grammar/.antlr/BlendApi.interp +70 -0
  56. package/src/grammar/.antlr/BlendApi.tokens +44 -0
  57. package/src/grammar/.antlr/BlendApiLexer.interp +89 -0
  58. package/src/grammar/.antlr/BlendApiLexer.java +237 -0
  59. package/src/grammar/.antlr/BlendApiLexer.tokens +44 -0
  60. package/src/grammar/.antlr/BlendApiParser.java +767 -0
  61. package/src/grammar/.antlr/BlendBasic.interp +41 -0
  62. package/src/grammar/.antlr/BlendBasic.tokens +20 -0
  63. package/src/grammar/.antlr/BlendBasicLexer.interp +50 -0
  64. package/src/grammar/.antlr/BlendBasicLexer.java +179 -0
  65. package/src/grammar/.antlr/BlendBasicLexer.tokens +20 -0
  66. package/src/grammar/.antlr/BlendBasicParser.java +599 -0
  67. package/src/grammar/.antlr/BlendData.interp +50 -0
  68. package/src/grammar/.antlr/BlendData.tokens +29 -0
  69. package/src/grammar/.antlr/BlendDataLexer.interp +65 -0
  70. package/src/grammar/.antlr/BlendDataLexer.java +181 -0
  71. package/src/grammar/.antlr/BlendDataLexer.tokens +29 -0
  72. package/src/grammar/.antlr/BlendDataParser.java +520 -0
  73. package/src/grammar/.antlr/BlendMDP.interp +45 -0
  74. package/src/grammar/.antlr/BlendMDP.tokens +25 -0
  75. package/src/grammar/.antlr/BlendMDPLexer.interp +59 -0
  76. package/src/grammar/.antlr/BlendMDPLexer.java +178 -0
  77. package/src/grammar/.antlr/BlendMDPLexer.tokens +25 -0
  78. package/src/grammar/.antlr/BlendMDPParser.java +386 -0
  79. package/src/grammar/.antlr/BlendMongo.interp +65 -0
  80. package/src/grammar/.antlr/BlendMongo.tokens +41 -0
  81. package/src/grammar/.antlr/BlendMongoLexer.interp +83 -0
  82. package/src/grammar/.antlr/BlendMongoLexer.java +219 -0
  83. package/src/grammar/.antlr/BlendMongoLexer.tokens +41 -0
  84. package/src/grammar/.antlr/BlendMongoParser.java +669 -0
  85. package/src/grammar/.antlr/BlendRN.interp +53 -0
  86. package/src/grammar/.antlr/BlendRN.tokens +31 -0
  87. package/src/grammar/.antlr/BlendRNLexer.interp +71 -0
  88. package/src/grammar/.antlr/BlendRNLexer.java +202 -0
  89. package/src/grammar/.antlr/BlendRNLexer.tokens +31 -0
  90. package/src/grammar/.antlr/BlendRNParser.java +542 -0
  91. package/src/grammar/.antlr/BlendReact.interp +49 -0
  92. package/src/grammar/.antlr/BlendReact.tokens +28 -0
  93. package/src/grammar/.antlr/BlendReactLexer.interp +65 -0
  94. package/src/grammar/.antlr/BlendReactLexer.java +188 -0
  95. package/src/grammar/.antlr/BlendReactLexer.tokens +28 -0
  96. package/src/grammar/.antlr/BlendReactParser.java +530 -0
  97. package/src/grammar/BlendApi.g4 +26 -0
  98. package/src/grammar/BlendBasic.g4 +16 -0
  99. package/src/grammar/BlendData.g4 +24 -0
  100. package/src/grammar/BlendMDP.g4 +12 -0
  101. package/src/grammar/BlendMongo.g4 +24 -0
  102. package/src/grammar/BlendRN.g4 +18 -0
  103. package/src/grammar/BlendReact.g4 +16 -0
  104. package/src/helper/BasicHelper.ts +35 -0
  105. package/src/helper/CommonHelper.ts +5 -0
  106. package/src/helper/DataHelper.ts +268 -0
  107. package/src/helper/ExpressHelper.ts +807 -0
  108. package/src/helper/FrontEndApiHelper.ts +526 -0
  109. package/src/helper/FrontEndReactApiHelper.ts +532 -0
  110. package/src/helper/MongoHelper.ts +165 -0
  111. package/src/helper/RNHelper.ts +651 -0
  112. package/src/helper/ReactHelper.ts +597 -0
  113. package/src/helper/SectionHelper.ts +154 -0
  114. package/src/helper/fileHelper.ts +111 -0
  115. package/src/helper/grammarHelper/BlendApiGrammarHelper.ts +45 -0
  116. package/src/helper/grammarHelper/BlendBasicGrammarHelper.ts +101 -0
  117. package/src/helper/grammarHelper/BlendDataGrammarHelper.ts +49 -0
  118. package/src/helper/grammarHelper/BlendMDPGrammarHelper.ts +33 -0
  119. package/src/helper/grammarHelper/BlendMongoGrammarHelper.ts +50 -0
  120. package/src/helper/grammarHelper/BlendRNGrammarHelper.ts +65 -0
  121. package/src/helper/grammarHelper/BlendReactGrammarHelper.ts +65 -0
  122. package/src/helper/grammarHelper/GrammarErrorHelper.ts +13 -0
  123. package/src/index.ts +168 -0
  124. package/src/parser/blendApi/src/grammar/BlendApi.interp +70 -0
  125. package/src/parser/blendApi/src/grammar/BlendApi.tokens +44 -0
  126. package/src/parser/blendApi/src/grammar/BlendApiLexer.interp +89 -0
  127. package/src/parser/blendApi/src/grammar/BlendApiLexer.tokens +44 -0
  128. package/src/parser/blendApi/src/grammar/BlendApiLexer.ts +193 -0
  129. package/src/parser/blendApi/src/grammar/BlendApiListener.ts +145 -0
  130. package/src/parser/blendApi/src/grammar/BlendApiParser.ts +968 -0
  131. package/src/parser/blendData/src/grammar/BlendData.interp +50 -0
  132. package/src/parser/blendData/src/grammar/BlendData.tokens +29 -0
  133. package/src/parser/blendData/src/grammar/BlendDataLexer.interp +65 -0
  134. package/src/parser/blendData/src/grammar/BlendDataLexer.tokens +29 -0
  135. package/src/parser/blendData/src/grammar/BlendDataLexer.ts +146 -0
  136. package/src/parser/blendData/src/grammar/BlendDataListener.ts +97 -0
  137. package/src/parser/blendData/src/grammar/BlendDataParser.ts +641 -0
  138. package/src/parser/blendMDP/src/grammar/BlendMDP.interp +45 -0
  139. package/src/parser/blendMDP/src/grammar/BlendMDP.tokens +25 -0
  140. package/src/parser/blendMDP/src/grammar/BlendMDPLexer.interp +59 -0
  141. package/src/parser/blendMDP/src/grammar/BlendMDPLexer.tokens +25 -0
  142. package/src/parser/blendMDP/src/grammar/BlendMDPLexer.ts +143 -0
  143. package/src/parser/blendMDP/src/grammar/BlendMDPListener.ts +85 -0
  144. package/src/parser/blendMDP/src/grammar/BlendMDPParser.ts +483 -0
  145. package/src/parser/blendMongo/src/grammar/BlendMongo.interp +65 -0
  146. package/src/parser/blendMongo/src/grammar/BlendMongo.tokens +41 -0
  147. package/src/parser/blendMongo/src/grammar/BlendMongoLexer.interp +83 -0
  148. package/src/parser/blendMongo/src/grammar/BlendMongoLexer.tokens +41 -0
  149. package/src/parser/blendMongo/src/grammar/BlendMongoLexer.ts +179 -0
  150. package/src/parser/blendMongo/src/grammar/BlendMongoListener.ts +133 -0
  151. package/src/parser/blendMongo/src/grammar/BlendMongoParser.ts +849 -0
  152. package/src/parser/blendRN/src/grammar/BlendRN.interp +53 -0
  153. package/src/parser/blendRN/src/grammar/BlendRN.tokens +31 -0
  154. package/src/parser/blendRN/src/grammar/BlendRNLexer.interp +71 -0
  155. package/src/parser/blendRN/src/grammar/BlendRNLexer.tokens +31 -0
  156. package/src/parser/blendRN/src/grammar/BlendRNLexer.ts +164 -0
  157. package/src/parser/blendRN/src/grammar/BlendRNListener.ts +85 -0
  158. package/src/parser/blendRN/src/grammar/BlendRNParser.ts +659 -0
  159. package/src/parser/blendReact/src/grammar/BlendReact.interp +49 -0
  160. package/src/parser/blendReact/src/grammar/BlendReact.tokens +28 -0
  161. package/src/parser/blendReact/src/grammar/BlendReactLexer.interp +65 -0
  162. package/src/parser/blendReact/src/grammar/BlendReactLexer.tokens +28 -0
  163. package/src/parser/blendReact/src/grammar/BlendReactLexer.ts +151 -0
  164. package/src/parser/blendReact/src/grammar/BlendReactListener.ts +85 -0
  165. package/src/parser/blendReact/src/grammar/BlendReactParser.ts +646 -0
  166. package/src/parser/blendbasic/src/grammar/BlendBasic.interp +41 -0
  167. package/src/parser/blendbasic/src/grammar/BlendBasic.tokens +20 -0
  168. package/src/parser/blendbasic/src/grammar/BlendBasicLexer.interp +50 -0
  169. package/src/parser/blendbasic/src/grammar/BlendBasicLexer.tokens +20 -0
  170. package/src/parser/blendbasic/src/grammar/BlendBasicLexer.ts +139 -0
  171. package/src/parser/blendbasic/src/grammar/BlendBasicListener.ts +109 -0
  172. package/src/parser/blendbasic/src/grammar/BlendBasicParser.ts +747 -0
  173. package/src/types/apiOperationTypes.ts +43 -0
  174. package/src/types/basicOperationTypes.ts +15 -0
  175. package/src/types/dataOperationTypes.ts +20 -0
  176. package/src/types/frontendOperationTypes.ts +92 -0
  177. package/src/types/generalTypes.ts +0 -0
  178. package/src/types/mongoOperationTypes.ts +36 -0
  179. package/template/.env.dev +1 -0
  180. package/template/package.json +36 -0
  181. package/template/src/app.js +76 -0
  182. package/template/src/app.ts +54 -0
  183. package/template/src/config/app.config.js +0 -0
  184. package/template/src/config/app.config.ts +0 -0
  185. package/template/src/config/database.config.js +6 -0
  186. package/template/src/config/database.config.ts +4 -0
  187. package/template/src/data/interfaces.js +2 -0
  188. package/template/src/data/interfaces.ts +23 -0
  189. package/template/src/middlewares/auth.js +22 -0
  190. package/template/src/middlewares/auth.ts +21 -0
  191. package/template/src/models/Database.js +10 -0
  192. package/template/src/models/Database.ts +8 -0
  193. package/template/src/models/User/Permission.model.js +13 -0
  194. package/template/src/models/User/Permission.model.ts +14 -0
  195. package/template/src/models/User/Role.model.js +13 -0
  196. package/template/src/models/User/Role.model.ts +14 -0
  197. package/template/src/models/User/User.model.js +17 -0
  198. package/template/src/models/User/User.model.ts +18 -0
  199. package/template/src/routes/User.routes.js +47 -0
  200. package/template/src/routes/User.routes.ts +41 -0
  201. package/template/src/routes/common/common.routes.config.js +14 -0
  202. package/template/src/routes/common/common.routes.config.ts +15 -0
  203. package/template/src/services/User/User.service.js +75 -0
  204. package/template/src/services/User/User.service.ts +68 -0
  205. package/template/src/services/User/api.data.js +72 -0
  206. package/template/src/services/User/api.data.ts +79 -0
  207. package/template/src/services/User/api.interface.js +3 -0
  208. package/template/src/services/User/api.interface.ts +10 -0
  209. package/template/tsconfig.json +10 -0
  210. package/tsconfig.json +13 -0
@@ -0,0 +1,41 @@
1
+
2
+ import { CommonRoutesConfig } from './common/common.routes.config';
3
+ import UserService from '../services/User/User.service';
4
+ import express from 'express';
5
+
6
+ import {USER_SIGNUP_INPUT,USER_LOGIN_INPUT,} from '../services/User/api.data';
7
+ import verifyToken from '../middlewares/auth';
8
+
9
+ export default class UserRoutes extends CommonRoutesConfig {
10
+ constructor(app: express.Application) {
11
+ super(app, 'UserRoutes');
12
+ }
13
+ UserService = new UserService();
14
+
15
+ configureRoutes(): express.Application {
16
+
17
+
18
+ this.app.route('/user/signup').post(async (req: express.Request, res: express.Response) => {
19
+ const input: USER_SIGNUP_INPUT = USER_SIGNUP_INPUT.fromJSON(req.body);
20
+ const defaultPreCondition = input.checkDefaultPreCondition();
21
+ if(defaultPreCondition.isValid) {
22
+ this.UserService.Signup(input, res);
23
+ } else {
24
+ res.status(412).send(defaultPreCondition.errorBody)
25
+ }
26
+ });
27
+ this.app.route('/user/login').post(async (req: express.Request, res: express.Response) => {
28
+ const input: USER_LOGIN_INPUT = USER_LOGIN_INPUT.fromJSON(req.body);
29
+ const defaultPreCondition = input.checkDefaultPreCondition();
30
+ if(defaultPreCondition.isValid) {
31
+ this.UserService.Login(input, res);
32
+ } else {
33
+ res.status(412).send(defaultPreCondition.errorBody)
34
+ }
35
+ });
36
+
37
+
38
+ return this.app;
39
+ }
40
+ }
41
+
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommonRoutesConfig = void 0;
4
+ class CommonRoutesConfig {
5
+ constructor(app, name) {
6
+ this.app = app;
7
+ this.name = name;
8
+ this.configureRoutes();
9
+ }
10
+ getName() {
11
+ return this.name;
12
+ }
13
+ }
14
+ exports.CommonRoutesConfig = CommonRoutesConfig;
@@ -0,0 +1,15 @@
1
+ import express from 'express';
2
+ export abstract class CommonRoutesConfig {
3
+ app: express.Application;
4
+ name: string;
5
+
6
+ constructor(app: express.Application, name: string) {
7
+ this.app = app;
8
+ this.name = name;
9
+ this.configureRoutes();
10
+ }
11
+ getName() {
12
+ return this.name;
13
+ }
14
+ abstract configureRoutes(): express.Application;
15
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ const User_model_1 = __importDefault(require("../../models/User/User.model"));
16
+ const bcrypt_1 = __importDefault(require("bcrypt"));
17
+ const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
18
+ class UserService {
19
+ Signup(input, res) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ try {
22
+ const user = yield this.findUserByEmail(input.emailId);
23
+ if (user) {
24
+ res.status(400).send("User allready registered");
25
+ }
26
+ else {
27
+ const encryptedPassword = yield bcrypt_1.default.hash(input.password.toString(), 10);
28
+ const newUser = new User_model_1.default({
29
+ userName: input.userName,
30
+ emailId: input.emailId,
31
+ firstName: input.firstName,
32
+ lastName: input.lastName,
33
+ mobile: input.mobile,
34
+ password: encryptedPassword
35
+ });
36
+ yield newUser.save();
37
+ res.send({ userName: newUser.userName });
38
+ }
39
+ }
40
+ catch (e) {
41
+ res.status(500).send("Error" + e);
42
+ }
43
+ });
44
+ }
45
+ Login(input, res) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const secretKey = process.env.JWT_SECRET_KEY || "vadhyan-admin";
48
+ try {
49
+ const user = yield User_model_1.default.findOne({ emailId: input.emailId });
50
+ if (!user) {
51
+ return res.status(400).json({ message: 'User not found' });
52
+ }
53
+ const isPasswordValid = yield bcrypt_1.default.compare(input.password.toString(), user.password.toString());
54
+ if (!isPasswordValid) {
55
+ return res.status(401).json({ message: 'Invalid password' });
56
+ }
57
+ if (secretKey) {
58
+ const token = yield jsonwebtoken_1.default.sign({ id: user._id }, secretKey);
59
+ res.header('auth-token', token).json({ token });
60
+ }
61
+ }
62
+ catch (e) {
63
+ res.status(500).send("Error" + e);
64
+ }
65
+ });
66
+ }
67
+ findUserByEmail(email) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ return User_model_1.default.findOne({
70
+ emailId: email
71
+ }).exec();
72
+ });
73
+ }
74
+ }
75
+ exports.default = UserService;
@@ -0,0 +1,68 @@
1
+
2
+ import express from 'express';
3
+
4
+ import { IUserApi } from './api.interface';
5
+
6
+ import { USER_SIGNUP_INPUT, USER_LOGIN_INPUT, } from './api.data';
7
+ import User from '../../models/User/User.model';
8
+ import bcrypt from 'bcrypt';
9
+ import jwt from 'jsonwebtoken';
10
+
11
+
12
+ export default class UserService implements IUserApi {
13
+ public async Signup(input: USER_SIGNUP_INPUT, res: express.Response) {
14
+ try {
15
+ const user = await this.findUserByEmail(input.emailId);
16
+ if (user) {
17
+ res.status(400).send("User allready registered")
18
+ } else {
19
+ const encryptedPassword = await bcrypt.hash(input.password.toString(), 10);
20
+ const newUser = new User({
21
+ userName: input.userName,
22
+ emailId: input.emailId,
23
+ firstName: input.firstName,
24
+ lastName: input.lastName,
25
+ mobile: input.mobile,
26
+ password: encryptedPassword
27
+ });
28
+ await newUser.save();
29
+ res.send({userName: newUser.userName})
30
+
31
+ }
32
+ } catch (e) {
33
+ res.status(500).send("Error" + e);
34
+ }
35
+ }
36
+ public async Login(input: USER_LOGIN_INPUT, res: express.Response) {
37
+ const secretKey = process.env.JWT_SECRET_KEY || "vadhyan-admin";
38
+ try {
39
+ const user = await User.findOne({emailId: input.emailId});
40
+ if (!user) {
41
+ return res.status(400).json({ message: 'User not found' });
42
+ }
43
+ const isPasswordValid = await bcrypt.compare(input.password.toString(),user.password.toString());
44
+
45
+ if (!isPasswordValid) {
46
+ return res.status(401).json({ message: 'Invalid password' });
47
+ }
48
+
49
+
50
+ if(secretKey) {
51
+ const token = await jwt.sign({id: user._id},secretKey);
52
+ res.header('auth-token', token).json({ token });
53
+ }
54
+
55
+ } catch (e) {
56
+ res.status(500).send("Error" + e);
57
+ }
58
+ }
59
+
60
+
61
+
62
+ async findUserByEmail(email: string) {
63
+ return User.findOne({
64
+ emailId: email
65
+ }).exec();
66
+ }
67
+
68
+ }
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.USER_GETUSERDETAILS_INPUT = exports.USER_LOGIN_INPUT = exports.USER_SIGNUP_INPUT = void 0;
4
+ class USER_SIGNUP_INPUT {
5
+ constructor(userName, emailId, password, firstName, lastName, mobile) {
6
+ this.userName = userName;
7
+ this.emailId = emailId;
8
+ this.password = password;
9
+ this.firstName = firstName;
10
+ this.lastName = lastName;
11
+ this.mobile = mobile;
12
+ }
13
+ static fromJSON(jsonObj) {
14
+ return new USER_SIGNUP_INPUT(jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.userName, jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.emailId, jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.password, jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.firstName, jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.lastName, jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.mobile);
15
+ }
16
+ checkDefaultPreCondition() {
17
+ const error = {};
18
+ if (!this.userName) {
19
+ error['userName'] = "userName is required";
20
+ }
21
+ if (!this.emailId) {
22
+ error['emailId'] = "emailId is required";
23
+ }
24
+ return {
25
+ isValid: Object.keys(error).length == 0,
26
+ errorBody: error
27
+ };
28
+ }
29
+ }
30
+ exports.USER_SIGNUP_INPUT = USER_SIGNUP_INPUT;
31
+ class USER_LOGIN_INPUT {
32
+ constructor(emailId, password) {
33
+ this.emailId = emailId;
34
+ this.password = password;
35
+ }
36
+ static fromJSON(jsonObj) {
37
+ return new USER_LOGIN_INPUT(jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.emailId, jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.password);
38
+ }
39
+ checkDefaultPreCondition() {
40
+ const error = {};
41
+ if (!this.emailId) {
42
+ error['emailId'] = "emailId is required";
43
+ }
44
+ if (!this.password) {
45
+ error['password'] = "password is required";
46
+ }
47
+ return {
48
+ isValid: Object.keys(error).length == 0,
49
+ errorBody: error
50
+ };
51
+ }
52
+ }
53
+ exports.USER_LOGIN_INPUT = USER_LOGIN_INPUT;
54
+ class USER_GETUSERDETAILS_INPUT {
55
+ constructor(emailId) {
56
+ this.emailId = emailId;
57
+ }
58
+ static fromJSON(jsonObj) {
59
+ return new USER_GETUSERDETAILS_INPUT(jsonObj === null || jsonObj === void 0 ? void 0 : jsonObj.emailId);
60
+ }
61
+ checkDefaultPreCondition() {
62
+ const error = {};
63
+ if (!this.emailId) {
64
+ error['emailId'] = "emailId is required";
65
+ }
66
+ return {
67
+ isValid: Object.keys(error).length == 0,
68
+ errorBody: error
69
+ };
70
+ }
71
+ }
72
+ exports.USER_GETUSERDETAILS_INPUT = USER_GETUSERDETAILS_INPUT;
@@ -0,0 +1,79 @@
1
+
2
+
3
+ export class USER_SIGNUP_INPUT {
4
+ userName: string;emailId: string;password: string;firstName: string;lastName: string;mobile: string;
5
+ constructor(userName: string,emailId: string,password: string,firstName: string,lastName: string,mobile: string,) {
6
+ this.userName= userName;this.emailId= emailId;this.password= password;this.firstName= firstName;this.lastName= lastName;this.mobile= mobile;
7
+ }
8
+
9
+ static fromJSON(jsonObj: any) {
10
+ return new USER_SIGNUP_INPUT(
11
+ jsonObj?.userName,jsonObj?.emailId,jsonObj?.password,jsonObj?.firstName,jsonObj?.lastName,jsonObj?.mobile,
12
+ )
13
+ }
14
+
15
+ checkDefaultPreCondition() {
16
+ const error: any = {};
17
+ if(!this.userName) {
18
+ error['userName']="userName is required"
19
+ }if(!this.emailId) {
20
+ error['emailId']="emailId is required"
21
+ }
22
+ return {
23
+ isValid: Object.keys(error).length==0,
24
+ errorBody: error
25
+ }
26
+ }
27
+ }
28
+
29
+ export class USER_LOGIN_INPUT {
30
+ emailId: string;password: string;
31
+ constructor(emailId: string,password: string,) {
32
+ this.emailId= emailId;this.password= password;
33
+ }
34
+
35
+ static fromJSON(jsonObj: any) {
36
+ return new USER_LOGIN_INPUT(
37
+ jsonObj?.emailId,jsonObj?.password,
38
+ )
39
+ }
40
+
41
+ checkDefaultPreCondition() {
42
+ const error: any = {};
43
+ if(!this.emailId) {
44
+ error['emailId']="emailId is required"
45
+ }if(!this.password) {
46
+ error['password']="password is required"
47
+ }
48
+ return {
49
+ isValid: Object.keys(error).length==0,
50
+ errorBody: error
51
+ }
52
+ }
53
+ }
54
+
55
+ export class USER_GETUSERDETAILS_INPUT {
56
+ emailId: string;
57
+ constructor(emailId: string,) {
58
+ this.emailId= emailId;
59
+ }
60
+
61
+ static fromJSON(jsonObj: any) {
62
+ return new USER_GETUSERDETAILS_INPUT(
63
+ jsonObj?.emailId,
64
+ )
65
+ }
66
+
67
+ checkDefaultPreCondition() {
68
+ const error: any = {};
69
+ if(!this.emailId) {
70
+ error['emailId']="emailId is required"
71
+ }
72
+ return {
73
+ isValid: Object.keys(error).length==0,
74
+ errorBody: error
75
+ }
76
+ }
77
+ }
78
+
79
+
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ ;
@@ -0,0 +1,10 @@
1
+
2
+ import express from 'express';
3
+ ;
4
+ import {USER_SIGNUP_INPUT,USER_LOGIN_INPUT,USER_GETUSERDETAILS_INPUT,} from './api.data';
5
+ export interface IUserApi {
6
+ Signup(input: USER_SIGNUP_INPUT, res: express.Response):void
7
+ Login(input: USER_LOGIN_INPUT, res: express.Response):void
8
+ getUserDetails(input: USER_GETUSERDETAILS_INPUT, res: express.Response):void
9
+
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2016",
4
+ "module": "commonjs",
5
+ "outDir": "./dist",
6
+ "strict": true,
7
+ "esModuleInterop": true,
8
+ "inlineSourceMap": true
9
+ }
10
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES6",
4
+ "module": "CommonJS",
5
+ "outDir": "./dist",
6
+ "rootDir": "./src",
7
+ "esModuleInterop": true,
8
+ "skipLibCheck": true,
9
+ "forceConsistentCasingInFileNames": true
10
+ },
11
+ "include": ["src/**/*"],
12
+ "exclude": ["node_modules"]
13
+ }