Skip to content

Commit

Permalink
other: add data to init db scripts for alarm (anomalies, notification…
Browse files Browse the repository at this point in the history
…s, recognizingNodes, security rules), monitoring (devices), auth (users)
  • Loading branch information
paga16-hash committed Jan 29, 2024
1 parent 0684130 commit 5a9293a
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 30 deletions.
87 changes: 57 additions & 30 deletions alarm/db/alarm-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ db.createCollection('anomaly')

db.anomaly.insert([
{
_id: {
$oid: '65b514200718dbb3580fb9e6'
},
_id: '65b514200718dbb3580fb9e6',
deviceId: {
type: 'SENSOR',
code: 'sen-01'
Expand All @@ -19,9 +17,7 @@ db.anomaly.insert([
__v: 0
},
{
_id: {
$oid: '65b514240718dbb3580fb9e8'
},
_id: '65b514240718dbb3580fb9e8',
deviceId: {
type: 'CAMERA',
code: 'cam-03'
Expand All @@ -38,25 +34,17 @@ db.createCollection('notification')

db.notification.insert([
{
_id: {
$oid: '65b5113633b1c7e038248937'
},
anomalyId: {
$oid: '65b514200718dbb3580fb9e6'
},
_id: '65b5113633b1c7e038248937',
anomalyId: '65b514200718dbb3580fb9e6',
anomalyType: 'EXCEEDING',
timestamp: {
$date: '2024-01-27T14:20:38.950Z'
},
__v: 0
},
{
_id: {
$oid: '65b513ef0718dbb3580fb9e3'
},
anomalyId: {
$oid: '65b514240718dbb3580fb9e8'
},
_id: '65b513ef0718dbb3580fb9e3',
anomalyId: '65b514240718dbb3580fb9e8',
anomalyType: 'INTRUSION',
timestamp: {
$date: '2024-01-27T14:32:15.925Z'
Expand All @@ -68,16 +56,12 @@ db.notification.insert([
db.createCollection('securityRule')
db.securityRule.insert([
{
_id: {
$oid: '65b527590fa38e9a5422537c'
},
_id: '65b527590fa38e9a5422537c',
deviceId: {
type: 'SENSOR',
code: 'sen-01'
},
creatorId: {
$oid: '6582b78ee645d6402a3be6e2' // qui andra messo l'id dell'utente inserito nello script di auth db
},
creatorId: 'aaaaaaaaaaaaaaaaaaaaaaaa',
description: 'Exceeding rule description',
minValue: 0,
maxValue: 25,
Expand Down Expand Up @@ -107,16 +91,12 @@ db.securityRule.insert([
__v: 0
},
{
_id: {
$oid: '65b52e53cffd8e469604ef10'
},
_id: '65b52e53cffd8e469604ef10',
deviceId: {
type: 'CAMERA',
code: 'cam-01'
},
creatorId: {
$oid: '6582b78ee645d6402a3be6e2'
},
creatorId: 'aaaaaaaaaaaaaaaaaaaaaaab',
description: 'Intrusion rule description',
objectClass: 'PERSON',
contacts: [
Expand Down Expand Up @@ -144,3 +124,50 @@ db.securityRule.insert([
__v: 0
}
])

db.createCollection('recognizingNode')

db.recognizingNode.insert([
{
_id: '65a020d5de7178fe501e7dda',
ipAddress: '192.168.1.2',
deviceIds: [
{
type: 'CAMERA',
code: 'cam-01',
_id: {
$oid: '65a10044aa628f95323324a9'
}
},
{
type: 'SENSOR',
code: 'sen-01',
_id: {
$oid: '65a10044aa628f95323324aa'
}
}
],
__v: 0
},
{
_id: '65a020d5de7178fe501e7ddb',
ipAddress: '192.168.1.2',
deviceIds: [
{
type: 'CAMERA',
code: 'cam-02',
_id: {
$oid: '65a10044aa628f95323324b9'
}
},
{
type: 'SENSOR',
code: 'sen-02',
_id: {
$oid: '65a10044aa628f95323324ac'
}
}
],
__v: 0
}
])
2 changes: 2 additions & 0 deletions auth/db/auth-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ db.createCollection('user')
//TODO to test
db.user.insertMany([
{
_id: 'aaaaaaaaaaaaaaaaaaaaaaaa',
name: 'Mattia',
surname: 'Matteini',
username: 'mattia',
Expand All @@ -17,6 +18,7 @@ db.user.insertMany([
]
},
{
_id: 'aaaaaaaaaaaaaaaaaaaaaaab',
name: 'Mario',
surname: 'Rossi',
username: 'paga16',
Expand Down
23 changes: 23 additions & 0 deletions monitoring/db/device-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,27 @@ db.device.insert([{
'width': 200
},
'__v': 0
}, {
'_id': {
'type': 'SENSOR',
'code': 'sen-02'
},
'ipAddress': '192.168.1.30',
'intervalMillis': 1000,
'measures': [
'PRESSURE',
'TEMPERATURE'
],
'__v': 0
}, {
'_id': {
'type': 'CAMERA',
'code': 'cam-02'
},
'ipAddress': '192.168.1.40',
'resolution': {
'height': 200,
'width': 200
},
'__v': 0
}])

0 comments on commit 5a9293a

Please sign in to comment.