@sedni/cloud_common 1.1.0 → 1.2.0

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.
@@ -75,19 +75,12 @@ const channeldataBucketSchema = new mongoose.Schema({
75
75
  * Index the start_date and end_date fields for faster queries.
76
76
  * The compound index will be used to query the buckets by date range.
77
77
  */
78
- channeldataBucketSchema.index({ start_date: 1, end_date: 1 });
78
+ channeldataBucketSchema.index({ start_date: 1, end_date: 1 }, { background: true });
79
79
 
80
80
  /**
81
81
  * Index used to delete old buckets automatically.
82
- * This function will need to be called to create the TTL index.
83
- * The index will expire documents after the specified time in seconds.
84
- * The default is set to one year, but it can be changed by passing the expirationTimeInSeconds parameter.
85
82
  */
86
- const oneYear = 60 * 60 * 24 * 365; // One year in seconds
87
- channeldataBucketSchema.addTTLIndex = function(ttlField, expirationTimeInSeconds = oneYear)
88
- {
89
- this.index({ [ttlField]: 1 }, { expireAfterSeconds: expirationTimeInSeconds });
90
- }
83
+ channeldataBucketSchema.index({ start_date: 1 }, { expireAfterSeconds: 60 * 60 * 24 * 365, background: true }); // 1 year
91
84
 
92
85
  /**
93
86
  * ///////////////////////////////////////////////
@@ -2,7 +2,7 @@ const mongoose = require("mongoose");
2
2
  const mongooseAutopopulate = require("mongoose-autopopulate");
3
3
  const mongoosePaginate = require("mongoose-paginate-v2");
4
4
  const mongooseAggregatePaginate = require("mongoose-aggregate-paginate-v2");
5
- const { EventCategories } = require("../types/event.types");
5
+ const { EventCategories, EventCriticality } = require("../types/event.types");
6
6
 
7
7
  const eventSchema = new mongoose.Schema({
8
8
  event_message: {
@@ -22,6 +22,11 @@ const eventSchema = new mongoose.Schema({
22
22
  required: true,
23
23
  enum: Object.values(EventCategories)
24
24
  },
25
+ event_criticality: {
26
+ type: String,
27
+ required: true,
28
+ enum: Object.values(EventCriticality)
29
+ },
25
30
  event_type: {
26
31
  type: String,
27
32
  required: true
@@ -10,6 +10,15 @@ const EventCategories =
10
10
  POTENTIAL_ATTACK: "PotentialAttackActivity",
11
11
  };
12
12
 
13
+ const EventCriticality = {
14
+ VERBOSE: "Verbose",
15
+ INFO: "Info",
16
+ WARNING: "Warning",
17
+ ERROR: "Error",
18
+ CRITICAL: "Critical",
19
+ };
20
+
13
21
  module.exports = {
14
22
  EventCategories,
23
+ EventCriticality,
15
24
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sedni/cloud_common",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Common package for all types, resources and tools of Diamar Cloud",
5
5
  "main": "index.js",
6
6
  "scripts": {