@riocrypto/common-server 1.0.969 → 1.0.970

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
@@ -16,6 +16,7 @@ export * from "./middlewares/not-sandbox";
16
16
  export * from "./services/apiKey";
17
17
  export * from "./services/password";
18
18
  export * from "./models/admin-auth";
19
+ export * from "./models/admin";
19
20
  export * from "./models/auth";
20
21
  export * from "./models/bank-payout";
21
22
  export * from "./models/bank-payment";
package/build/index.js CHANGED
@@ -32,6 +32,7 @@ __exportStar(require("./middlewares/not-sandbox"), exports);
32
32
  __exportStar(require("./services/apiKey"), exports);
33
33
  __exportStar(require("./services/password"), exports);
34
34
  __exportStar(require("./models/admin-auth"), exports);
35
+ __exportStar(require("./models/admin"), exports);
35
36
  __exportStar(require("./models/auth"), exports);
36
37
  __exportStar(require("./models/bank-payout"), exports);
37
38
  __exportStar(require("./models/bank-payment"), exports);
@@ -0,0 +1,24 @@
1
+ import { AdminTaskType } from "@riocrypto/common";
2
+ import { Mongoose, Model, Document } from "mongoose";
3
+ interface AdminAttrs {
4
+ createdAt: Date;
5
+ adminAuthIds?: string[];
6
+ name: string;
7
+ email: string;
8
+ assignedTaskTypes: AdminTaskType[];
9
+ privileges: string[];
10
+ }
11
+ interface AdminModel extends Model<AdminDoc> {
12
+ build(attrs: AdminAttrs): AdminDoc;
13
+ }
14
+ interface AdminDoc extends Document {
15
+ _id: string;
16
+ createdAt: Date;
17
+ adminAuthIds?: string[];
18
+ name: string;
19
+ email: string;
20
+ assignedTaskTypes: AdminTaskType[];
21
+ privileges: string[];
22
+ }
23
+ declare const buildAdmin: (mongoose: Mongoose) => AdminModel;
24
+ export { buildAdmin, AdminDoc };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildAdmin = void 0;
4
+ const buildAdmin = (mongoose) => {
5
+ // if model is already defined, return it
6
+ if (mongoose.models.Admin) {
7
+ return mongoose.model("Admin");
8
+ }
9
+ const AdminSchema = new mongoose.Schema({
10
+ authIds: [
11
+ {
12
+ type: String,
13
+ },
14
+ ],
15
+ createdAt: {
16
+ type: mongoose.Schema.Types.Date,
17
+ required: true,
18
+ },
19
+ name: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ email: {
24
+ type: String,
25
+ required: true,
26
+ },
27
+ privileges: [
28
+ {
29
+ type: String,
30
+ required: true,
31
+ },
32
+ ],
33
+ assignedTaskTypes: [
34
+ {
35
+ type: String,
36
+ required: true,
37
+ },
38
+ ],
39
+ }, {
40
+ toJSON: {
41
+ transform(doc, ret) {
42
+ ret.id = ret._id.valueOf();
43
+ delete ret._id;
44
+ delete ret.__v;
45
+ },
46
+ },
47
+ });
48
+ AdminSchema.statics.build = (attrs) => {
49
+ return new Admin(attrs);
50
+ };
51
+ const Admin = mongoose.model("Admin", AdminSchema);
52
+ return Admin;
53
+ };
54
+ exports.buildAdmin = buildAdmin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.969",
3
+ "version": "1.0.970",
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.833",
27
+ "@riocrypto/common": "^1.0.834",
28
28
  "@types/express": "^4.17.13",
29
29
  "axios": "^0.27.2",
30
30
  "ccxt": "^3.0.30",