@riocrypto/common-server 1.0.566 → 1.0.568
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/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/models/partner-auth.d.ts +16 -0
- package/build/models/partner-auth.js +60 -0
- package/package.json +2 -2
package/build/index.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export * from "./models/kushki-payment";
|
|
|
27
27
|
export * from "./models/kyc";
|
|
28
28
|
export * from "./models/checked-address";
|
|
29
29
|
export * from "./models/rio-settings";
|
|
30
|
+
export * from "./models/partner-auth";
|
|
30
31
|
export * from "./clients/bitstamp-client";
|
|
31
32
|
export * from "./clients/ccxt-client";
|
|
32
33
|
export * from "./clients/fixer-client";
|
package/build/index.js
CHANGED
|
@@ -43,6 +43,7 @@ __exportStar(require("./models/kushki-payment"), exports);
|
|
|
43
43
|
__exportStar(require("./models/kyc"), exports);
|
|
44
44
|
__exportStar(require("./models/checked-address"), exports);
|
|
45
45
|
__exportStar(require("./models/rio-settings"), exports);
|
|
46
|
+
__exportStar(require("./models/partner-auth"), exports);
|
|
46
47
|
__exportStar(require("./clients/bitstamp-client"), exports);
|
|
47
48
|
__exportStar(require("./clients/ccxt-client"), exports);
|
|
48
49
|
__exportStar(require("./clients/fixer-client"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
2
|
+
interface PartnerAuthAttrs {
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
|
+
previousPasswords?: string[];
|
|
6
|
+
}
|
|
7
|
+
interface PartnerAuthDoc extends Document {
|
|
8
|
+
email: string;
|
|
9
|
+
password: string;
|
|
10
|
+
previousPasswords?: string[];
|
|
11
|
+
}
|
|
12
|
+
interface PartnerAuthModel extends Model<PartnerAuthDoc> {
|
|
13
|
+
build(attrs: PartnerAuthAttrs): PartnerAuthDoc;
|
|
14
|
+
}
|
|
15
|
+
declare const buildPartnerAuth: (mongoose: Mongoose) => PartnerAuthModel;
|
|
16
|
+
export { buildPartnerAuth, PartnerAuthDoc };
|
|
@@ -0,0 +1,60 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.buildPartnerAuth = void 0;
|
|
13
|
+
const password_1 = require("../services/password");
|
|
14
|
+
const buildPartnerAuth = (mongoose) => {
|
|
15
|
+
// if model is already defined, return it
|
|
16
|
+
if (mongoose.models.PartnerAuth) {
|
|
17
|
+
return mongoose.model("PartnerAuth");
|
|
18
|
+
}
|
|
19
|
+
const PartnerSchema = new mongoose.Schema({
|
|
20
|
+
email: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
password: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
previousPasswords: [
|
|
29
|
+
{
|
|
30
|
+
type: String,
|
|
31
|
+
required: false,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
}, {
|
|
35
|
+
toJSON: {
|
|
36
|
+
transform(doc, ret) {
|
|
37
|
+
ret.id = ret._id.valueOf();
|
|
38
|
+
delete ret._id;
|
|
39
|
+
delete ret.__v;
|
|
40
|
+
delete ret.password;
|
|
41
|
+
delete ret.previousPasswords;
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
PartnerSchema.pre("save", function (done) {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
if (this.isModified("password")) {
|
|
48
|
+
const hashed = yield password_1.Password.toHash(this.get("password"));
|
|
49
|
+
this.set("password", hashed);
|
|
50
|
+
}
|
|
51
|
+
done();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
PartnerSchema.statics.build = (attrs) => {
|
|
55
|
+
return new PartnerAuth(attrs);
|
|
56
|
+
};
|
|
57
|
+
const PartnerAuth = mongoose.model("PartnerAuth", PartnerSchema);
|
|
58
|
+
return PartnerAuth;
|
|
59
|
+
};
|
|
60
|
+
exports.buildPartnerAuth = buildPartnerAuth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.568",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
25
|
"@google-cloud/storage": "^6.9.5",
|
|
26
|
-
"@riocrypto/common": "^1.0.
|
|
26
|
+
"@riocrypto/common": "^1.0.554",
|
|
27
27
|
"@types/express": "^4.17.13",
|
|
28
28
|
"axios": "^0.27.2",
|
|
29
29
|
"ccxt": "^3.0.30",
|