@riocrypto/common-server 1.0.1338 → 1.0.1342

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
@@ -40,6 +40,7 @@ export * from "./models/bitso-mxn-withdrawal";
40
40
  export * from "./models/circle-address-book-recipient";
41
41
  export * from "./models/circle-payout";
42
42
  export * from "./models/market-data";
43
+ export * from "./models/telegram-session";
43
44
  export * from "./clients/bitstamp-client";
44
45
  export * from "./clients/ccxt-client";
45
46
  export * from "./clients/kushki-client";
package/build/index.js CHANGED
@@ -56,6 +56,7 @@ __exportStar(require("./models/bitso-mxn-withdrawal"), exports);
56
56
  __exportStar(require("./models/circle-address-book-recipient"), exports);
57
57
  __exportStar(require("./models/circle-payout"), exports);
58
58
  __exportStar(require("./models/market-data"), exports);
59
+ __exportStar(require("./models/telegram-session"), exports);
59
60
  __exportStar(require("./clients/bitstamp-client"), exports);
60
61
  __exportStar(require("./clients/ccxt-client"), exports);
61
62
  __exportStar(require("./clients/kushki-client"), exports);
@@ -0,0 +1,22 @@
1
+ import mongoose from "mongoose";
2
+ interface TelegramSessionAttrs {
3
+ createdAt: Date;
4
+ telgramUsername: string;
5
+ telgramChatId: number;
6
+ isVerified: boolean;
7
+ state: string;
8
+ authId?: string;
9
+ }
10
+ interface TelegramSessionDoc extends mongoose.Document {
11
+ createdAt: Date;
12
+ telgramUsername: string;
13
+ telgramChatId: number;
14
+ isVerified: boolean;
15
+ state: string;
16
+ authId?: string;
17
+ }
18
+ interface TelegramSessionModel extends mongoose.Model<TelegramSessionDoc> {
19
+ build(attrs: TelegramSessionAttrs): TelegramSessionDoc;
20
+ }
21
+ declare const buildTelegramSession: (mongoose: typeof mongoose) => TelegramSessionModel;
22
+ export { buildTelegramSession, TelegramSessionDoc };
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildTelegramSession = void 0;
4
+ const buildTelegramSession = (mongoose) => {
5
+ // if model is already defined, return it
6
+ if (mongoose.models.TelegramSession) {
7
+ return mongoose.model("TelegramSession");
8
+ }
9
+ const TelegramSessionSchema = new mongoose.Schema({
10
+ createdAt: {
11
+ type: Date,
12
+ required: true,
13
+ },
14
+ authId: {
15
+ type: String,
16
+ },
17
+ telgramUsername: {
18
+ type: String,
19
+ required: true,
20
+ },
21
+ telgramChatId: {
22
+ type: Number,
23
+ required: true,
24
+ },
25
+ isVerified: {
26
+ type: Boolean,
27
+ required: true,
28
+ },
29
+ state: {
30
+ type: String,
31
+ required: true,
32
+ },
33
+ }, {
34
+ toJSON: {
35
+ transform(doc, ret) {
36
+ ret.id = ret._id;
37
+ delete ret._id;
38
+ delete ret.__v;
39
+ },
40
+ },
41
+ });
42
+ TelegramSessionSchema.statics.build = (attrs) => {
43
+ return new TelegramSession(attrs);
44
+ };
45
+ const TelegramSession = mongoose.model("TelegramSession", TelegramSessionSchema);
46
+ return TelegramSession;
47
+ };
48
+ exports.buildTelegramSession = buildTelegramSession;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1338",
3
+ "version": "1.0.1342",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",