@riocrypto/common-server 1.0.982 → 1.0.985

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.
@@ -1,7 +1,6 @@
1
1
  declare class SlackClient {
2
- private webhookUrl;
3
- constructor(webhookUrl: string);
4
- sendMessage(message: string): Promise<void>;
2
+ constructor();
3
+ sendMessageWithWebhook(message: string, webhookUrl: string): Promise<void>;
5
4
  }
6
5
  export declare const slackClient: SlackClient;
7
6
  export {};
@@ -15,13 +15,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.slackClient = void 0;
16
16
  const axios_1 = __importDefault(require("axios"));
17
17
  class SlackClient {
18
- constructor(webhookUrl) {
19
- this.webhookUrl = webhookUrl;
20
- }
21
- sendMessage(message) {
18
+ constructor() { }
19
+ sendMessageWithWebhook(message, webhookUrl) {
22
20
  return __awaiter(this, void 0, void 0, function* () {
23
21
  try {
24
- yield axios_1.default.post(this.webhookUrl, {
22
+ yield axios_1.default.post(webhookUrl, {
25
23
  text: message,
26
24
  });
27
25
  }
@@ -31,4 +29,4 @@ class SlackClient {
31
29
  });
32
30
  }
33
31
  }
34
- exports.slackClient = new SlackClient(process.env.SLACK_WEBHOOK_URL);
32
+ exports.slackClient = new SlackClient();
@@ -5,6 +5,7 @@ interface AdminAttrs {
5
5
  adminAuthIds?: string[];
6
6
  name: string;
7
7
  email: string;
8
+ slackWebhookUrl: string;
8
9
  acceptingTasks?: boolean;
9
10
  assignedTaskTypes: AdminTaskType[];
10
11
  privileges: string[];
@@ -18,6 +19,7 @@ interface AdminDoc extends Document {
18
19
  adminAuthIds?: string[];
19
20
  name: string;
20
21
  email: string;
22
+ slackWebhookUrl: string;
21
23
  acceptingTasks?: boolean;
22
24
  assignedTaskTypes: AdminTaskType[];
23
25
  privileges: string[];
@@ -24,6 +24,10 @@ const buildAdmin = (mongoose) => {
24
24
  type: String,
25
25
  required: true,
26
26
  },
27
+ slackWebhookUrl: {
28
+ type: String,
29
+ required: true,
30
+ },
27
31
  privileges: [
28
32
  {
29
33
  type: String,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.982",
3
+ "version": "1.0.985",
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.843",
27
+ "@riocrypto/common": "^1.0.846",
28
28
  "@types/express": "^4.17.13",
29
29
  "axios": "^0.27.2",
30
30
  "ccxt": "^3.0.30",