@riocrypto/common-server 1.0.2347 → 1.0.2348

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
@@ -95,6 +95,7 @@ export * from "./models/admin-webauthn-credential";
95
95
  export * from "./models/custom-rate-limit";
96
96
  export * from "./models/order-update-request";
97
97
  export * from "./models/axe";
98
+ export * from "./models/liquidity-reservation";
98
99
  export * from "./clients/axios-with-logging";
99
100
  export * from "./clients/slack-client";
100
101
  export * from "./clients/fireblocks-client";
package/build/index.js CHANGED
@@ -111,6 +111,7 @@ __exportStar(require("./models/admin-webauthn-credential"), exports);
111
111
  __exportStar(require("./models/custom-rate-limit"), exports);
112
112
  __exportStar(require("./models/order-update-request"), exports);
113
113
  __exportStar(require("./models/axe"), exports);
114
+ __exportStar(require("./models/liquidity-reservation"), exports);
114
115
  __exportStar(require("./clients/axios-with-logging"), exports);
115
116
  __exportStar(require("./clients/slack-client"), exports);
116
117
  __exportStar(require("./clients/fireblocks-client"), exports);
@@ -0,0 +1,26 @@
1
+ import { Fiat, Side, Crypto } from "@riocrypto/common";
2
+ import { LiquidityReservationStatus } from "@riocrypto/common";
3
+ import { Mongoose, Model, Document } from "mongoose";
4
+ interface LiquidityReservationAttrs {
5
+ side: Side;
6
+ userId: string;
7
+ currency: Crypto | Fiat;
8
+ amount: number;
9
+ status: LiquidityReservationStatus;
10
+ createdAt: Date;
11
+ expiresAt: Date;
12
+ }
13
+ interface LiquidityReservationDoc extends Document {
14
+ side: Side;
15
+ userId: string;
16
+ currency: Crypto | Fiat;
17
+ amount: number;
18
+ status: LiquidityReservationStatus;
19
+ createdAt: Date;
20
+ expiresAt: Date;
21
+ }
22
+ interface LiquidityReservationModel extends Model<LiquidityReservationDoc> {
23
+ build(attrs: LiquidityReservationAttrs): LiquidityReservationDoc;
24
+ }
25
+ declare const buildLiquidityReservation: (mongoose: Mongoose) => LiquidityReservationModel;
26
+ export { buildLiquidityReservation, LiquidityReservationDoc, LiquidityReservationAttrs, };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildLiquidityReservation = void 0;
4
+ const buildLiquidityReservation = (mongoose) => {
5
+ // if model is already defined, return it
6
+ if (mongoose.models.LiquidityReservation) {
7
+ return mongoose.model("LiquidityReservation");
8
+ }
9
+ const LiquidityReservationSchema = new mongoose.Schema({
10
+ side: {
11
+ type: String,
12
+ required: true,
13
+ },
14
+ userId: {
15
+ type: String,
16
+ required: true,
17
+ },
18
+ currency: {
19
+ type: String,
20
+ required: true,
21
+ },
22
+ amount: {
23
+ type: Number,
24
+ required: true,
25
+ },
26
+ status: {
27
+ type: String,
28
+ required: true,
29
+ },
30
+ createdAt: {
31
+ type: mongoose.Schema.Types.Date,
32
+ required: true,
33
+ },
34
+ expiresAt: {
35
+ type: mongoose.Schema.Types.Date,
36
+ required: true,
37
+ },
38
+ }, {
39
+ toJSON: {
40
+ transform(doc, ret) {
41
+ ret.id = ret._id.valueOf();
42
+ delete ret._id;
43
+ delete ret.__v;
44
+ },
45
+ },
46
+ });
47
+ LiquidityReservationSchema.statics.build = (attrs) => {
48
+ return new LiquidityReservation(attrs);
49
+ };
50
+ const LiquidityReservation = mongoose.model("LiquidityReservation", LiquidityReservationSchema);
51
+ return LiquidityReservation;
52
+ };
53
+ exports.buildLiquidityReservation = buildLiquidityReservation;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2347",
3
+ "version": "1.0.2348",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.2063",
31
+ "@riocrypto/common": "^1.0.2064",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",