@riocrypto/common-server 1.0.1052 → 1.0.1053
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.
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Mongoose, Model, Document } from "mongoose";
|
|
2
|
+
interface WebhookRegistrationAttrs {
|
|
3
|
+
userId: string;
|
|
4
|
+
type: "user" | "order" | "bank-account";
|
|
5
|
+
url: string;
|
|
6
|
+
}
|
|
7
|
+
interface WebhookRegistrationDoc extends Document {
|
|
8
|
+
userId: string;
|
|
9
|
+
type: "user" | "order" | "bank-account";
|
|
10
|
+
url: string;
|
|
11
|
+
}
|
|
12
|
+
interface WebhookRegistrationModel extends Model<WebhookRegistrationDoc> {
|
|
13
|
+
build(attrs: WebhookRegistrationAttrs): WebhookRegistrationDoc;
|
|
14
|
+
}
|
|
15
|
+
declare const buildWebhookRegistration: (mongoose: Mongoose) => WebhookRegistrationModel;
|
|
16
|
+
export { buildWebhookRegistration, WebhookRegistrationDoc };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildWebhookRegistration = void 0;
|
|
4
|
+
const buildWebhookRegistration = (mongoose) => {
|
|
5
|
+
// if model is already defined, return it
|
|
6
|
+
if (mongoose.models.WebhookRegistration) {
|
|
7
|
+
return mongoose.model("WebhookRegistration");
|
|
8
|
+
}
|
|
9
|
+
const WebhookRegistrationSchema = new mongoose.Schema({
|
|
10
|
+
userId: {
|
|
11
|
+
type: String,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
url: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: true,
|
|
21
|
+
},
|
|
22
|
+
}, {
|
|
23
|
+
toJSON: {
|
|
24
|
+
transform(doc, ret) {
|
|
25
|
+
ret.id = ret._id.valueOf();
|
|
26
|
+
delete ret._id;
|
|
27
|
+
delete ret.__v;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
WebhookRegistrationSchema.statics.build = (attrs) => {
|
|
32
|
+
return new WebhookRegistration(attrs);
|
|
33
|
+
};
|
|
34
|
+
const WebhookRegistration = mongoose.model("WebhookRegistration", WebhookRegistrationSchema);
|
|
35
|
+
return WebhookRegistration;
|
|
36
|
+
};
|
|
37
|
+
exports.buildWebhookRegistration = buildWebhookRegistration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1053",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
25
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
26
26
|
"@google-cloud/storage": "^6.9.5",
|
|
27
|
-
"@riocrypto/common": "^1.0.
|
|
27
|
+
"@riocrypto/common": "^1.0.905",
|
|
28
28
|
"@types/express": "^4.17.13",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"ccxt": "^3.0.30",
|