tango-api-schema 2.1.67 → 2.1.69

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-api-schema",
3
- "version": "2.1.67",
3
+ "version": "2.1.69",
4
4
  "description": "tangoEye model schema",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,43 +1,47 @@
1
- import {Schema,model} from 'mongoose'
2
-
3
- const liveConnectionSchema=new Schema({
1
+ import mongoose from "mongoose";
2
+ import mongooseUniqueValidator from 'mongoose-unique-validator';
4
3
 
4
+ const liveConnectionSchema = new mongoose.Schema(
5
+ {
5
6
  clientId: {
6
- type: String,
7
- required:true
7
+ type: String,
8
+ required: true,
9
+ },
10
+ storeId: {
11
+ type: String,
12
+ required: true,
8
13
  },
9
- storeId:{
10
- type: String,
11
- required:true
14
+ remoteAddress: {
15
+ type: String,
12
16
  },
13
- remoteAddress:{
14
- type: String,
17
+ remotePort: {
18
+ type: Number,
15
19
  },
16
- remotePort:{
17
- type: Number,
20
+ connectedAt: {
21
+ type: Date,
22
+ default: new Date(),
18
23
  },
19
- connectedAt:{
20
- type:Date,
21
- default: new Date()
24
+ streamName: {
25
+ type: String,
22
26
  },
23
- streamName:{
24
- type: String,
27
+ status: {
28
+ type: String,
29
+ enum: ["live", "completed", "idle"],
25
30
  },
26
- status:{
27
- type:String,
28
- enum:["live", "completed","idle"]
31
+ module: {
32
+ type: String,
29
33
  },
30
- module:{
31
- type: String,
32
- }
33
- },{
34
+ },
35
+ {
34
36
  timestamps: true,
35
37
  versionKey: false,
36
- strict: false,
37
- } )
38
+ strict: false,
39
+ }
40
+ );
41
+ liveConnectionSchema.plugin( mongooseUniqueValidator );
42
+ liveConnectionSchema.index({ clientId: 1 });
43
+ liveConnectionSchema.index({ storeId: 1 });
44
+ liveConnectionSchema.index({ status: 1 });
45
+ liveConnectionSchema.index({ createdAt: 1 }, { expires: "2d" });
38
46
 
39
- clientConnectionSchema.index({clientId:1,})
40
- clientConnectionSchema.index({storeId:1})
41
- clientConnectionSchema.index({status:1})
42
- clientConnectionSchema.index( { createdAt: 1 }, { expires: '2d'});
43
- export default model( 'liveConnection', liveConnectionSchema,"liveConnection" );
47
+ export default mongoose.model( 'liveConnection', liveConnectionSchema, 'liveConnection' );