@flink-app/stripe-plugin 0.3.7 → 0.3.8
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/.flink/generatedHandlers.ts +1 -1
- package/.flink/generatedRepos.ts +1 -1
- package/.flink/schemas/schemas.ts +1 -1
- package/.flink/start.ts +1 -1
- package/dist/.flink/generatedHandlers.js +1 -1
- package/dist/.flink/generatedRepos.js +1 -1
- package/dist/.flink/schemas/schemas.js +1 -1
- package/dist/.flink/start.js +1 -1
- package/dist/src/handlers/Management/Get.d.ts +7 -0
- package/dist/src/handlers/Management/Get.js +53 -0
- package/dist/src/handlers/Management/GetManagement.d.ts +8 -0
- package/dist/src/handlers/Management/GetManagement.js +53 -0
- package/dist/src/handlers/User/DeleteByUserid.d.ts +9 -0
- package/dist/src/handlers/User/DeleteByUserid.js +70 -0
- package/dist/src/handlers/User/GetByUserid.d.ts +9 -0
- package/dist/src/handlers/User/GetByUserid.js +71 -0
- package/dist/src/handlers/User/GetList.d.ts +9 -0
- package/dist/src/handlers/User/GetList.js +64 -0
- package/dist/src/handlers/User/GetMe.d.ts +8 -0
- package/dist/src/handlers/User/GetMe.js +81 -0
- package/dist/src/handlers/User/Post.d.ts +10 -0
- package/dist/src/handlers/User/Post.js +87 -0
- package/dist/src/handlers/User/PostLogin.d.ts +10 -0
- package/dist/src/handlers/User/PostLogin.js +86 -0
- package/dist/src/handlers/User/PutByUserid.d.ts +9 -0
- package/dist/src/handlers/User/PutByUserid.js +97 -0
- package/dist/src/managementApiContext.d.ts +7 -0
- package/dist/src/managementApiContext.js +2 -0
- package/dist/src/models/ManagementApi.d.ts +28 -0
- package/dist/src/models/ManagementApi.js +8 -0
- package/dist/src/repos/ConnectSessionRepo.d.ts +5 -0
- package/dist/src/repos/ConnectSessionRepo.js +26 -0
- package/dist/src/repos/ManagementUserRepo.d.ts +5 -0
- package/dist/src/repos/ManagementUserRepo.js +26 -0
- package/dist/src/schemas/Management/GetReq.d.ts +2 -0
- package/dist/src/schemas/Management/GetReq.js +2 -0
- package/dist/src/schemas/Management/GetRes.d.ts +3 -0
- package/dist/src/schemas/Management/GetRes.js +2 -0
- package/dist/src/schemas/ManagementUser.d.ts +6 -0
- package/dist/src/schemas/ManagementUser.js +2 -0
- package/dist/src/schemas/ManagementUserViewModel.d.ts +4 -0
- package/dist/src/schemas/ManagementUserViewModel.js +19 -0
- package/dist/src/schemas/ModuleList.d.ts +18 -0
- package/dist/src/schemas/ModuleList.js +2 -0
- package/dist/src/schemas/User/DeleteByUseridReq.d.ts +2 -0
- package/dist/src/schemas/User/DeleteByUseridReq.js +2 -0
- package/dist/src/schemas/User/DeleteByUseridRes.d.ts +2 -0
- package/dist/src/schemas/User/DeleteByUseridRes.js +2 -0
- package/dist/src/schemas/User/GetByUseridReq.d.ts +2 -0
- package/dist/src/schemas/User/GetByUseridReq.js +2 -0
- package/dist/src/schemas/User/GetByUseridRes.d.ts +3 -0
- package/dist/src/schemas/User/GetByUseridRes.js +2 -0
- package/dist/src/schemas/User/GetListReq.d.ts +2 -0
- package/dist/src/schemas/User/GetListReq.js +2 -0
- package/dist/src/schemas/User/GetListRes.d.ts +4 -0
- package/dist/src/schemas/User/GetListRes.js +2 -0
- package/dist/src/schemas/User/GetMeReq.d.ts +2 -0
- package/dist/src/schemas/User/GetMeReq.js +2 -0
- package/dist/src/schemas/User/GetMeRes.d.ts +3 -0
- package/dist/src/schemas/User/GetMeRes.js +2 -0
- package/dist/src/schemas/User/PostLoginReq.d.ts +4 -0
- package/dist/src/schemas/User/PostLoginReq.js +2 -0
- package/dist/src/schemas/User/PostLoginRes.d.ts +5 -0
- package/dist/src/schemas/User/PostLoginRes.js +2 -0
- package/dist/src/schemas/User/PostReq.d.ts +3 -0
- package/dist/src/schemas/User/PostReq.js +2 -0
- package/dist/src/schemas/User/PostRes.d.ts +3 -0
- package/dist/src/schemas/User/PostRes.js +2 -0
- package/dist/src/schemas/User/PutByUseridReq.d.ts +3 -0
- package/dist/src/schemas/User/PutByUseridReq.js +2 -0
- package/dist/src/schemas/User/PutByUseridRes.d.ts +3 -0
- package/dist/src/schemas/User/PutByUseridRes.js +2 -0
- package/dist/src/stripePlguinContext.d.ts +5 -0
- package/dist/src/stripePlguinContext.js +2 -0
- package/dist/src/utils/bcrypt.d.ts +2 -0
- package/dist/src/utils/bcrypt.js +28 -0
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Sun Oct 16 2022 11:48:09 GMT+0200 (Central European Summer Time)
|
|
2
2
|
import { autoRegisteredHandlers, HttpMethod } from "@flink-app/flink";
|
|
3
3
|
import * as HandlebarsTemplateHandler_0 from "../src/handlers/HandlebarsTemplateHandler";
|
|
4
4
|
|
package/.flink/generatedRepos.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Sun Oct 16 2022 11:48:09 GMT+0200 (Central European Summer Time)
|
|
2
2
|
import { autoRegisteredRepos } from "@flink-app/flink";
|
|
3
3
|
export const repos = [];
|
|
4
4
|
autoRegisteredRepos.push(...repos);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
// Generated
|
|
1
|
+
// Generated Sun Oct 16 2022 11:48:09 GMT+0200 (Central European Summer Time)
|
package/.flink/start.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.handlers = void 0;
|
|
4
|
-
// Generated
|
|
4
|
+
// Generated Sun Oct 16 2022 11:48:09 GMT+0200 (Central European Summer Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.handlers = [];
|
|
7
7
|
flink_1.autoRegisteredHandlers.push.apply(flink_1.autoRegisteredHandlers, exports.handlers);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.repos = void 0;
|
|
4
|
-
// Generated
|
|
4
|
+
// Generated Sun Oct 16 2022 11:48:09 GMT+0200 (Central European Summer Time)
|
|
5
5
|
var flink_1 = require("@flink-app/flink");
|
|
6
6
|
exports.repos = [];
|
|
7
7
|
flink_1.autoRegisteredRepos.push.apply(flink_1.autoRegisteredRepos, exports.repos);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Generated
|
|
2
|
+
// Generated Sun Oct 16 2022 11:48:09 GMT+0200 (Central European Summer Time)
|
package/dist/.flink/start.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Generated
|
|
3
|
+
// Generated Sun Oct 16 2022 11:48:09 GMT+0200 (Central European Summer Time)
|
|
4
4
|
require("./generatedHandlers");
|
|
5
5
|
require("./generatedRepos");
|
|
6
6
|
require("../src/index");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GetHandler } from "@flink-app/flink";
|
|
2
|
+
import { Ctx } from "../../Ctx";
|
|
3
|
+
import { GetManagementRes } from "../../schemas/Management/GetRes";
|
|
4
|
+
declare const GetManagement: GetHandler<Ctx, GetManagementRes>;
|
|
5
|
+
export default GetManagement;
|
|
6
|
+
export declare const __assumedHttpMethod = "get", __file = "Get.ts";
|
|
7
|
+
export declare const __schemas: any;
|
|
@@ -0,0 +1,53 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.__schemas = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
|
+
var GetManagement = function (_a) {
|
|
41
|
+
var ctx = _a.ctx, req = _a.req;
|
|
42
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
return __generator(this, function (_b) {
|
|
44
|
+
return [2 /*return*/, {
|
|
45
|
+
data: ctx.plugins.managementApi.moduleList,
|
|
46
|
+
status: 200,
|
|
47
|
+
}];
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
exports.default = GetManagement;
|
|
52
|
+
exports.__assumedHttpMethod = "get", exports.__file = "Get.ts";
|
|
53
|
+
exports.__schemas = { reqSchema: undefined, resSchema: { "type": "object", "additionalProperties": false, "properties": { "modules": { "type": "array", "items": { "$ref": "#/definitions/Module" } } }, "required": ["modules"] } };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Handler } from "@flink-app/flink";
|
|
2
|
+
import { Ctx } from "../../Ctx";
|
|
3
|
+
import { GetManagementReq } from "../../schemas/Management/GetReq";
|
|
4
|
+
import { GetManagementRes } from "../../schemas/Management/GetRes";
|
|
5
|
+
declare const GetManagement: Handler<Ctx, GetManagementReq, GetManagementRes>;
|
|
6
|
+
export default GetManagement;
|
|
7
|
+
export declare const __assumedHttpMethod = "get", __file = "GetManagement.ts", __query: never[], __params: never[];
|
|
8
|
+
export declare const __schemas: any;
|
|
@@ -0,0 +1,53 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
|
+
var GetManagement = function (_a) {
|
|
41
|
+
var ctx = _a.ctx, req = _a.req;
|
|
42
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
43
|
+
return __generator(this, function (_b) {
|
|
44
|
+
return [2 /*return*/, {
|
|
45
|
+
data: ctx.plugins.managementApi.moduleList,
|
|
46
|
+
status: 200,
|
|
47
|
+
}];
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
exports.default = GetManagement;
|
|
52
|
+
exports.__assumedHttpMethod = "get", exports.__file = "GetManagement.ts", exports.__query = [], exports.__params = [];
|
|
53
|
+
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": {} }, resSchema: { "type": "object", "additionalProperties": false, "properties": { "modules": { "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "type": { "type": "string" }, "features": { "type": "array", "items": { "type": "string" } }, "title": { "type": "string" }, "ui": { "type": "string" }, "data": { "type": "object" }, "endpoints": { "type": "array", "items": { "type": "object", "properties": { "method": { "type": "string" }, "url": { "type": "string" } }, "required": ["method", "url"], "additionalProperties": false } } }, "required": ["id", "type", "features", "title", "ui", "data", "endpoints"], "additionalProperties": false } } }, "required": ["modules"] } };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Handler, RouteProps } from "@flink-app/flink";
|
|
2
|
+
import { Ctx } from "../../Ctx";
|
|
3
|
+
import { DeleteUserByUseridReq } from "../../schemas/User/DeleteByUseridReq";
|
|
4
|
+
import { DeleteUserByUseridRes } from "../../schemas/User/DeleteByUseridRes";
|
|
5
|
+
export declare const Route: RouteProps;
|
|
6
|
+
declare const DeleteUserByUserid: Handler<Ctx, DeleteUserByUseridReq, DeleteUserByUseridRes>;
|
|
7
|
+
export default DeleteUserByUserid;
|
|
8
|
+
export declare const __assumedHttpMethod = "delete", __file = "DeleteByUserid.ts", __query: never[], __params: never[];
|
|
9
|
+
export declare const __schemas: any;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = exports.Route = void 0;
|
|
40
|
+
var flink_1 = require("@flink-app/flink");
|
|
41
|
+
exports.Route = {
|
|
42
|
+
path: "/user/:userid",
|
|
43
|
+
method: flink_1.HttpMethod.delete,
|
|
44
|
+
};
|
|
45
|
+
// type Params = {
|
|
46
|
+
// userid: string;
|
|
47
|
+
// };
|
|
48
|
+
var DeleteUserByUserid = function (_a) {
|
|
49
|
+
var ctx = _a.ctx, req = _a.req;
|
|
50
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
+
var count;
|
|
52
|
+
return __generator(this, function (_b) {
|
|
53
|
+
switch (_b.label) {
|
|
54
|
+
case 0: return [4 /*yield*/, ctx.repos.managementuserRepo.deleteById(req.params.userid)];
|
|
55
|
+
case 1:
|
|
56
|
+
count = _b.sent();
|
|
57
|
+
if (count == 0) {
|
|
58
|
+
return [2 /*return*/, flink_1.notFound()];
|
|
59
|
+
}
|
|
60
|
+
return [2 /*return*/, {
|
|
61
|
+
data: {},
|
|
62
|
+
status: 200,
|
|
63
|
+
}];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
exports.default = DeleteUserByUserid;
|
|
69
|
+
exports.__assumedHttpMethod = "delete", exports.__file = "DeleteByUserid.ts", exports.__query = [], exports.__params = [];
|
|
70
|
+
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": {} }, resSchema: { "type": "object", "additionalProperties": false, "properties": {} } };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Handler, RouteProps } from "@flink-app/flink";
|
|
2
|
+
import { GetUserByUseridReq } from "../../schemas/User/GetByUseridReq";
|
|
3
|
+
import { GetUserByUseridRes } from "../../schemas/User/GetByUseridRes";
|
|
4
|
+
import { Ctx } from "../../Ctx";
|
|
5
|
+
export declare const Route: RouteProps;
|
|
6
|
+
declare const GetUserByUserid: Handler<Ctx, GetUserByUseridReq, GetUserByUseridRes>;
|
|
7
|
+
export default GetUserByUserid;
|
|
8
|
+
export declare const __assumedHttpMethod = "get", __file = "GetByUserid.ts", __query: never[], __params: never[];
|
|
9
|
+
export declare const __schemas: any;
|
|
@@ -0,0 +1,71 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = exports.Route = void 0;
|
|
40
|
+
var flink_1 = require("@flink-app/flink");
|
|
41
|
+
var ManagementUserViewModel_1 = require("../../schemas/ManagementUserViewModel");
|
|
42
|
+
exports.Route = {
|
|
43
|
+
path: "/user/:userid",
|
|
44
|
+
method: flink_1.HttpMethod.get,
|
|
45
|
+
};
|
|
46
|
+
// type Params = {
|
|
47
|
+
// userid: string;
|
|
48
|
+
// };
|
|
49
|
+
var GetUserByUserid = function (_a) {
|
|
50
|
+
var ctx = _a.ctx, req = _a.req;
|
|
51
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
52
|
+
var user;
|
|
53
|
+
return __generator(this, function (_b) {
|
|
54
|
+
switch (_b.label) {
|
|
55
|
+
case 0: return [4 /*yield*/, ctx.repos.managementuserRepo.getById(req.params.userid)];
|
|
56
|
+
case 1:
|
|
57
|
+
user = _b.sent();
|
|
58
|
+
if (user == null) {
|
|
59
|
+
return [2 /*return*/, flink_1.notFound()];
|
|
60
|
+
}
|
|
61
|
+
return [2 /*return*/, {
|
|
62
|
+
data: ManagementUserViewModel_1.GetManagementUserViewModel(user),
|
|
63
|
+
status: 200,
|
|
64
|
+
}];
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
exports.default = GetUserByUserid;
|
|
70
|
+
exports.__assumedHttpMethod = "get", exports.__file = "GetByUserid.ts", exports.__query = [], exports.__params = [];
|
|
71
|
+
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": {} }, resSchema: { "type": "object", "additionalProperties": false, "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"] } };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Handler } from "@flink-app/flink";
|
|
2
|
+
import { GetUserListReq } from "../../schemas/User/GetListReq";
|
|
3
|
+
import { GetUserListRes } from "../../schemas/User/GetListRes";
|
|
4
|
+
import { Ctx } from "../../Ctx";
|
|
5
|
+
declare type Params = {};
|
|
6
|
+
declare const GetUserList: Handler<Ctx, GetUserListReq, GetUserListRes, Params>;
|
|
7
|
+
export default GetUserList;
|
|
8
|
+
export declare const __assumedHttpMethod = "get", __file = "GetList.ts", __query: never[], __params: never[];
|
|
9
|
+
export declare const __schemas: any;
|
|
@@ -0,0 +1,64 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
40
|
+
var ManagementUserViewModel_1 = require("../../schemas/ManagementUserViewModel");
|
|
41
|
+
var GetUserList = function (_a) {
|
|
42
|
+
var ctx = _a.ctx, req = _a.req;
|
|
43
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
+
var repo, users;
|
|
45
|
+
return __generator(this, function (_b) {
|
|
46
|
+
switch (_b.label) {
|
|
47
|
+
case 0:
|
|
48
|
+
repo = ctx.repos.managementuserRepo;
|
|
49
|
+
return [4 /*yield*/, repo.findAll()];
|
|
50
|
+
case 1:
|
|
51
|
+
users = _b.sent();
|
|
52
|
+
return [2 /*return*/, {
|
|
53
|
+
data: {
|
|
54
|
+
users: users.map(ManagementUserViewModel_1.GetManagementUserViewModel)
|
|
55
|
+
},
|
|
56
|
+
status: 200
|
|
57
|
+
}];
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
exports.default = GetUserList;
|
|
63
|
+
exports.__assumedHttpMethod = "get", exports.__file = "GetList.ts", exports.__query = [], exports.__params = [];
|
|
64
|
+
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": {} }, resSchema: { "type": "object", "additionalProperties": false, "properties": { "users": { "type": "array", "items": { "type": "object", "additionalProperties": false, "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"] } } }, "required": ["users"] } };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Handler } from "@flink-app/flink";
|
|
2
|
+
import { Ctx } from "../../Ctx";
|
|
3
|
+
import { GetUserMeReq } from "../../schemas/User/GetMeReq";
|
|
4
|
+
import { GetUserMeRes } from "../../schemas/User/GetMeRes";
|
|
5
|
+
declare const GetUserMe: Handler<Ctx, GetUserMeReq, GetUserMeRes>;
|
|
6
|
+
export default GetUserMe;
|
|
7
|
+
export declare const __assumedHttpMethod = "get", __file = "GetMe.ts", __query: never[], __params: never[];
|
|
8
|
+
export declare const __schemas: any;
|
|
@@ -0,0 +1,81 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
39
|
+
var t = {};
|
|
40
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
41
|
+
t[p] = s[p];
|
|
42
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
43
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
44
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
45
|
+
t[p[i]] = s[p[i]];
|
|
46
|
+
}
|
|
47
|
+
return t;
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = void 0;
|
|
54
|
+
var flink_1 = require("@flink-app/flink");
|
|
55
|
+
var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
56
|
+
var GetUserMe = function (_a) {
|
|
57
|
+
var ctx = _a.ctx, req = _a.req;
|
|
58
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
59
|
+
var user, iat, rest;
|
|
60
|
+
return __generator(this, function (_b) {
|
|
61
|
+
try {
|
|
62
|
+
user = jsonwebtoken_1.default.verify(req.headers["management-token"], ctx.plugins.managementApi.jwtSecret);
|
|
63
|
+
iat = user.iat, rest = __rest(user, ["iat"]);
|
|
64
|
+
return [2 /*return*/, {
|
|
65
|
+
data: {
|
|
66
|
+
token: req.headers["management-token"],
|
|
67
|
+
user: rest
|
|
68
|
+
},
|
|
69
|
+
status: 200
|
|
70
|
+
}];
|
|
71
|
+
}
|
|
72
|
+
catch (ex) {
|
|
73
|
+
return [2 /*return*/, flink_1.unauthorized()];
|
|
74
|
+
}
|
|
75
|
+
return [2 /*return*/];
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
exports.default = GetUserMe;
|
|
80
|
+
exports.__assumedHttpMethod = "get", exports.__file = "GetMe.ts", exports.__query = [], exports.__params = [];
|
|
81
|
+
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": {} }, resSchema: { "type": "object", "additionalProperties": false, "properties": { "user": { "type": "object", "additionalProperties": false, "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"] }, "token": { "type": "string" } }, "required": ["token", "user"] } };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Handler, RouteProps } from "@flink-app/flink";
|
|
2
|
+
import { Ctx } from "../../Ctx";
|
|
3
|
+
import { PostUserReq } from "../../schemas/User/PostReq";
|
|
4
|
+
import { PostUserRes } from "../../schemas/User/PostRes";
|
|
5
|
+
export declare const Route: RouteProps;
|
|
6
|
+
declare type Params = {};
|
|
7
|
+
declare const PostUser: Handler<Ctx, PostUserReq, PostUserRes, Params>;
|
|
8
|
+
export default PostUser;
|
|
9
|
+
export declare const __assumedHttpMethod = "post", __file = "Post.ts", __query: never[], __params: never[];
|
|
10
|
+
export declare const __schemas: any;
|
|
@@ -0,0 +1,87 @@
|
|
|
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 __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.__schemas = exports.__params = exports.__query = exports.__file = exports.__assumedHttpMethod = exports.Route = void 0;
|
|
40
|
+
var flink_1 = require("@flink-app/flink");
|
|
41
|
+
var bcrypt_1 = require("../../utils/bcrypt");
|
|
42
|
+
var ManagementUserViewModel_1 = require("../../schemas/ManagementUserViewModel");
|
|
43
|
+
exports.Route = {
|
|
44
|
+
path: "/user",
|
|
45
|
+
method: flink_1.HttpMethod.post,
|
|
46
|
+
};
|
|
47
|
+
var PostUser = function (_a) {
|
|
48
|
+
var ctx = _a.ctx, req = _a.req;
|
|
49
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
50
|
+
var existingUser, salt, hash, obj, user;
|
|
51
|
+
return __generator(this, function (_b) {
|
|
52
|
+
switch (_b.label) {
|
|
53
|
+
case 0:
|
|
54
|
+
if (req.body.username.length == 0 || req.body.password.length == 0) {
|
|
55
|
+
return [2 /*return*/, flink_1.badRequest("Username and password must be specified")];
|
|
56
|
+
}
|
|
57
|
+
return [4 /*yield*/, ctx.repos.managementuserRepo.getOne({ username: req.body.username })];
|
|
58
|
+
case 1:
|
|
59
|
+
existingUser = _b.sent();
|
|
60
|
+
if (existingUser != null) {
|
|
61
|
+
return [2 /*return*/, flink_1.conflict("Username already taken")];
|
|
62
|
+
}
|
|
63
|
+
return [4 /*yield*/, bcrypt_1.genSalt(10)];
|
|
64
|
+
case 2:
|
|
65
|
+
salt = _b.sent();
|
|
66
|
+
return [4 /*yield*/, bcrypt_1.encrypt(req.body.password, salt)];
|
|
67
|
+
case 3:
|
|
68
|
+
hash = _b.sent();
|
|
69
|
+
obj = {
|
|
70
|
+
username: req.body.username,
|
|
71
|
+
password: hash,
|
|
72
|
+
salt: salt
|
|
73
|
+
};
|
|
74
|
+
return [4 /*yield*/, ctx.repos.managementuserRepo.create(obj)];
|
|
75
|
+
case 4:
|
|
76
|
+
user = _b.sent();
|
|
77
|
+
return [2 /*return*/, {
|
|
78
|
+
data: ManagementUserViewModel_1.GetManagementUserViewModel(user),
|
|
79
|
+
status: 200
|
|
80
|
+
}];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
exports.default = PostUser;
|
|
86
|
+
exports.__assumedHttpMethod = "post", exports.__file = "Post.ts", exports.__query = [], exports.__params = [];
|
|
87
|
+
exports.__schemas = { reqSchema: { "type": "object", "additionalProperties": false, "properties": { "username": { "type": "string" }, "password": { "type": "string" } }, "required": ["password", "username"] }, resSchema: { "type": "object", "additionalProperties": false, "properties": { "_id": { "type": "string" }, "username": { "type": "string" } }, "required": ["_id", "username"] } };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Handler, RouteProps } from "@flink-app/flink";
|
|
2
|
+
import { Ctx } from "../../Ctx";
|
|
3
|
+
import { PostUserLoginReq } from "../../schemas/User/PostLoginReq";
|
|
4
|
+
import { PostUserLoginRes } from "../../schemas/User/PostLoginRes";
|
|
5
|
+
export declare const Route: RouteProps;
|
|
6
|
+
declare type Params = {};
|
|
7
|
+
declare const PostUserLogin: Handler<Ctx, PostUserLoginReq, PostUserLoginRes, Params>;
|
|
8
|
+
export default PostUserLogin;
|
|
9
|
+
export declare const __assumedHttpMethod = "post", __file = "PostLogin.ts", __query: never[], __params: never[];
|
|
10
|
+
export declare const __schemas: any;
|