@riocrypto/common 1.0.435 → 1.0.437

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 CHANGED
@@ -155,6 +155,7 @@ export * from "./models/bank-payout";
155
155
  export * from "./models/order";
156
156
  export * from "./models/partner";
157
157
  export * from "./models/user";
158
+ export * from "./models/ccxt-order";
158
159
  export * from "./clients/bitstamp-client";
159
160
  export * from "./clients/ccxt-wrapper";
160
161
  export * from "./clients/fixer-client";
package/build/index.js CHANGED
@@ -172,6 +172,7 @@ __exportStar(require("./models/bank-payout"), exports);
172
172
  __exportStar(require("./models/order"), exports);
173
173
  __exportStar(require("./models/partner"), exports);
174
174
  __exportStar(require("./models/user"), exports);
175
+ __exportStar(require("./models/ccxt-order"), exports);
175
176
  __exportStar(require("./clients/bitstamp-client"), exports);
176
177
  __exportStar(require("./clients/ccxt-wrapper"), exports);
177
178
  __exportStar(require("./clients/fixer-client"), exports);
@@ -0,0 +1,16 @@
1
+ import mongoose from "mongoose";
2
+ interface CCXTOrderAttrs {
3
+ orderId: string;
4
+ ccxtId: string;
5
+ status: string;
6
+ }
7
+ interface CCXTOrderDoc extends mongoose.Document {
8
+ orderId: string;
9
+ status: string;
10
+ ccxtId: string;
11
+ }
12
+ interface CCXTOrderModel extends mongoose.Model<CCXTOrderDoc> {
13
+ build(attrs: CCXTOrderAttrs): CCXTOrderDoc;
14
+ }
15
+ declare const buildCCXTOrder: (mongoose: typeof mongoose) => CCXTOrderModel;
16
+ export { buildCCXTOrder, CCXTOrderDoc };
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCCXTOrder = void 0;
4
+ const buildCCXTOrder = (mongoose) => {
5
+ const CCXTOrderSchema = new mongoose.Schema({
6
+ orderId: {
7
+ type: String,
8
+ required: true,
9
+ },
10
+ ccxtId: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ status: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ }, {
19
+ toJSON: {
20
+ transform(doc, ret) {
21
+ ret.id = ret._id;
22
+ delete ret._id;
23
+ delete ret.__v;
24
+ },
25
+ },
26
+ });
27
+ CCXTOrderSchema.statics.build = (attrs) => {
28
+ return new CCXTOrder(attrs);
29
+ };
30
+ const CCXTOrder = mongoose.model("CCXTOrder", CCXTOrderSchema);
31
+ return CCXTOrder;
32
+ };
33
+ exports.buildCCXTOrder = buildCCXTOrder;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.435",
3
+ "version": "1.0.437",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",