tango-api-schema 2.6.65 → 2.6.67

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/index.js CHANGED
@@ -111,6 +111,7 @@ import templateLogSchema from "./schema/templateLog.model.js";
111
111
  import eyeTestConfigurationModel from "./schema/eyeTestConfiguration.model.js";
112
112
  import copilotMachineConfigModel from "./schema/copilotMachineConfig.model.js";
113
113
  import findReplaceAiModel from "./schema/findReplaceAi.model.js";
114
+ import cctvPlacementModel from "./schema/cctvPlacement.model.js";
114
115
 
115
116
  import planoDuplicateModel from './schema/planogramDuplicate.model.js'
116
117
  import storeLayoutDuplicateModel from './schema/storeLayoutDuplicate.model.js'
@@ -246,6 +247,7 @@ export default {
246
247
  eyeTestConfigurationModel,
247
248
  copilotMachineConfigModel,
248
249
  findReplaceAiModel,
250
+ cctvPlacementModel,
249
251
  planoDuplicateModel,
250
252
  storeLayoutDuplicateModel,
251
253
  storeFixtureDuplicateModel,
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "tango-api-schema",
3
- "version": "2.6.65",
4
- "description": "tangoEye model schema",
5
- "main": "index.js",
6
- "type": "module",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1",
9
- "start": "node index.js",
10
- "build:patch": "node build.js patch && npm publish",
11
- "build:minor": "node build.js minor && npm publish",
12
- "build:major": "node build.js major && npm publish"
13
- },
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://praveen22raj@bitbucket.org/tangoeye-retail/tango-api-schema.git"
17
- },
18
- "author": "praveenraj",
19
- "license": "ISC",
20
- "bugs": {
21
- "url": "https://bitbucket.org/tangoeye-retail/tango-api-schema/issues"
22
- },
23
- "homepage": "https://bitbucket.org/tangoeye-retail/tango-api-schema#readme",
24
- "dependencies": {
25
- "express": "^4.21.1",
26
- "mongoose": "^7.5.3"
27
- }
1
+ {
2
+ "name": "tango-api-schema",
3
+ "version": "2.6.67",
4
+ "description": "tangoEye model schema",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "start": "node index.js",
10
+ "build:patch": "node build.js patch && npm publish",
11
+ "build:minor": "node build.js minor && npm publish",
12
+ "build:major": "node build.js major && npm publish"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://praveen22raj@bitbucket.org/tangoeye-retail/tango-api-schema.git"
17
+ },
18
+ "author": "praveenraj",
19
+ "license": "ISC",
20
+ "bugs": {
21
+ "url": "https://bitbucket.org/tangoeye-retail/tango-api-schema/issues"
22
+ },
23
+ "homepage": "https://bitbucket.org/tangoeye-retail/tango-api-schema#readme",
24
+ "dependencies": {
25
+ "express": "^4.21.1",
26
+ "mongoose": "^7.5.3"
27
+ }
28
28
  }
@@ -0,0 +1,105 @@
1
+ import mongoose from 'mongoose';
2
+
3
+ // CCTV camera placement tracking — one row per floor (v1).
4
+ // Backs the internal "CCTV" table in Manage Planogram (tango-store-builder).
5
+ // The floor's storeLayout.cctv sub-doc is the approval-team-facing mirror of
6
+ // this row's status; both are written together by the store-builder API
7
+ // transitions. Full design: tango-store-builder docs/CCTV_PLACEMENT_PLAN.md.
8
+ // Added Aug 2026 — new collection, safe to drop to revert (see
9
+ // tango-store-builder docs/CCTV_DB_CHANGES.md).
10
+ const cctvPlacementSchema = new mongoose.Schema( {
11
+ clientId: {
12
+ type: String,
13
+ required: true,
14
+ },
15
+ storeId: {
16
+ type: String,
17
+ required: true,
18
+ },
19
+ storeName: {
20
+ type: String,
21
+ required: true,
22
+ },
23
+ planoId: {
24
+ type: mongoose.Types.ObjectId,
25
+ required: true,
26
+ },
27
+ floorId: {
28
+ type: mongoose.Types.ObjectId,
29
+ required: true,
30
+ },
31
+ floorNumber: {
32
+ type: Number,
33
+ default: 1,
34
+ },
35
+ // Auto-placement job id (also the OpenSearch job-doc _id): `${floorId}-${ts}`
36
+ jobId: {
37
+ type: String,
38
+ },
39
+ // autoPlacement: queued / engine processing (row not openable)
40
+ // failed: kickoff push or engine failed (Retry re-runs)
41
+ // open: engine done — waiting for internal-team correction
42
+ // approvalPending: internal team submitted — waiting for approval team
43
+ // approved: terminal, locked
44
+ status: {
45
+ type: String,
46
+ enum: [ 'autoPlacement', 'failed', 'open', 'approvalPending', 'approved' ],
47
+ default: 'autoPlacement',
48
+ },
49
+ // The floor.cadFiles entry (S3 key) this placement run descends from.
50
+ sourceKey: {
51
+ type: String,
52
+ },
53
+ errorMsg: {
54
+ type: String,
55
+ },
56
+ // CCTV DXF version timeline (loose Array — matches storeLayout.cadFiles
57
+ // style). Entry: { key, fileName, version, kind: 'auto'|'manual'|'approver',
58
+ // sourceKey, cameraCount, uploadedBy, uploadedByName, uploadedAt }
59
+ files: {
60
+ type: Array,
61
+ default: [],
62
+ },
63
+ isRework: {
64
+ type: Boolean,
65
+ default: false,
66
+ },
67
+ reworkCount: {
68
+ type: Number,
69
+ default: 0,
70
+ },
71
+ // Status transition audit trail. Entry: { from, to, by, byName, at, comment }
72
+ history: {
73
+ type: Array,
74
+ default: [],
75
+ },
76
+ createdBy: {
77
+ type: mongoose.Types.ObjectId,
78
+ },
79
+ createdByName: {
80
+ type: String,
81
+ },
82
+ createdByEmail: {
83
+ type: String,
84
+ },
85
+ updatedBy: {
86
+ type: mongoose.Types.ObjectId,
87
+ },
88
+ updatedByName: {
89
+ type: String,
90
+ },
91
+ },
92
+ {
93
+ strict: true,
94
+ versionKey: false,
95
+ timestamps: true,
96
+ },
97
+ );
98
+
99
+ // One placement row per floor (v1 — the future override flow resets/reuses the
100
+ // same row rather than creating a second one).
101
+ cctvPlacementSchema.index( { floorId: 1 }, { unique: true } );
102
+ // Internal CCTV table: list/filter by client + status.
103
+ cctvPlacementSchema.index( { clientId: 1, status: 1 } );
104
+
105
+ export default mongoose.model( 'cctvPlacement', cctvPlacementSchema );
@@ -126,6 +126,11 @@ const processedchecklistSchema = new mongoose.Schema({
126
126
  submitTime:{
127
127
  type: Date,
128
128
  },
129
+ // First submission instant; unlike submitTime it is never overwritten
130
+ // when a redo makes the user submit the checklist again
131
+ firstSubmitTime:{
132
+ type: Date,
133
+ },
129
134
  startTime_string:{
130
135
  type: String,
131
136
  },
@@ -1,92 +1,92 @@
1
- import mongoose from 'mongoose';
2
-
3
- const recurringFlagTrackerSchema = new mongoose.Schema({
4
- client_id: {
5
- type: String,
6
- required: true,
7
- },
8
- sourceCheckList_id: {
9
- type: mongoose.SchemaTypes.ObjectId,
10
- ref: 'checklistconfig',
11
- required: true,
12
- },
13
- checkListName: {
14
- type: String,
15
- },
16
- coverage: {
17
- type: String,
18
- enum: ['store', 'user'],
19
- default: 'store',
20
- },
21
- store_id: {
22
- type: String,
23
- default: '',
24
- },
25
- storeName: {
26
- type: String,
27
- },
28
- user_id: {
29
- type: String,
30
- default: '',
31
- },
32
- userName: {
33
- type: String,
34
- },
35
- userEmail: {
36
- type: String,
37
- },
38
- section_id: {
39
- type: String,
40
- },
41
- sectionName: {
42
- type: String,
43
- },
44
- qno: {
45
- type: String,
46
- },
47
- qname: {
48
- type: String,
49
- },
50
- consecutiveCount: {
51
- type: Number,
52
- default: 0,
53
- },
54
- lastFlaggedDate: {
55
- type: String,
56
- },
57
- lastEmailDate: {
58
- type: String,
59
- },
60
- runAICount: {
61
- type: Number,
62
- default: 0,
63
- },
64
- lastRunAIFlaggedDate: {
65
- type: String,
66
- },
67
- emailHistory: {
68
- type: [ String ],
69
- default: [],
70
- },
71
- lastSubmittedBy: {
72
- type: String,
73
- },
74
- lastSubmissionDate: {
75
- type: String,
76
- },
77
- }, {
78
- strict: true,
79
- versionKey: false,
80
- timestamps: true,
81
- });
82
-
83
- recurringFlagTrackerSchema.index({
84
- client_id: 1,
85
- sourceCheckList_id: 1,
86
- store_id: 1,
87
- user_id: 1,
88
- section_id: 1,
89
- qno: 1,
90
- }, { unique: true });
91
-
92
- export default mongoose.model('recurringFlagTracker', recurringFlagTrackerSchema);
1
+ import mongoose from 'mongoose';
2
+
3
+ const recurringFlagTrackerSchema = new mongoose.Schema({
4
+ client_id: {
5
+ type: String,
6
+ required: true,
7
+ },
8
+ sourceCheckList_id: {
9
+ type: mongoose.SchemaTypes.ObjectId,
10
+ ref: 'checklistconfig',
11
+ required: true,
12
+ },
13
+ checkListName: {
14
+ type: String,
15
+ },
16
+ coverage: {
17
+ type: String,
18
+ enum: ['store', 'user'],
19
+ default: 'store',
20
+ },
21
+ store_id: {
22
+ type: String,
23
+ default: '',
24
+ },
25
+ storeName: {
26
+ type: String,
27
+ },
28
+ user_id: {
29
+ type: String,
30
+ default: '',
31
+ },
32
+ userName: {
33
+ type: String,
34
+ },
35
+ userEmail: {
36
+ type: String,
37
+ },
38
+ section_id: {
39
+ type: String,
40
+ },
41
+ sectionName: {
42
+ type: String,
43
+ },
44
+ qno: {
45
+ type: String,
46
+ },
47
+ qname: {
48
+ type: String,
49
+ },
50
+ consecutiveCount: {
51
+ type: Number,
52
+ default: 0,
53
+ },
54
+ lastFlaggedDate: {
55
+ type: String,
56
+ },
57
+ lastEmailDate: {
58
+ type: String,
59
+ },
60
+ runAICount: {
61
+ type: Number,
62
+ default: 0,
63
+ },
64
+ lastRunAIFlaggedDate: {
65
+ type: String,
66
+ },
67
+ emailHistory: {
68
+ type: [ String ],
69
+ default: [],
70
+ },
71
+ lastSubmittedBy: {
72
+ type: String,
73
+ },
74
+ lastSubmissionDate: {
75
+ type: String,
76
+ },
77
+ }, {
78
+ strict: true,
79
+ versionKey: false,
80
+ timestamps: true,
81
+ });
82
+
83
+ recurringFlagTrackerSchema.index({
84
+ client_id: 1,
85
+ sourceCheckList_id: 1,
86
+ store_id: 1,
87
+ user_id: 1,
88
+ section_id: 1,
89
+ qno: 1,
90
+ }, { unique: true });
91
+
92
+ export default mongoose.model('recurringFlagTracker', recurringFlagTrackerSchema);
@@ -100,6 +100,58 @@ const storeLayoutSchema = new mongoose.Schema( {
100
100
  kissflowProjectItemId:{
101
101
  type: String,
102
102
  },
103
+ // ── CCTV placement (additive, Aug 2026) ────────────────────────────────
104
+ // Approval-team-facing status of the CCTV camera-placement flow for this
105
+ // floor — independent of the planogram `status` above. Mirrors the
106
+ // cctvPlacement row (internal CCTV table); both are written together by
107
+ // the store-builder API. Revert: remove this block (+ optional $unset) —
108
+ // see tango-store-builder docs/CCTV_DB_CHANGES.md.
109
+ cctv: {
110
+ status: {
111
+ type: String,
112
+ enum: [ 'notStarted', 'processing', 'queueFailed', 'waitingApproval', 'approved' ],
113
+ default: 'notStarted',
114
+ },
115
+ // detail inside 'processing': auto = engine running, internal = team correcting
116
+ phase: {
117
+ type: String,
118
+ enum: [ 'auto', 'internal' ],
119
+ },
120
+ // Auto-placement job id (also the OpenSearch job-doc _id): `${floorId}-${ts}`
121
+ jobId: {
122
+ type: String,
123
+ },
124
+ currentVersion: {
125
+ type: Number,
126
+ },
127
+ // Latest CCTV DXF version (S3 key) derived from the current source CAD.
128
+ latestKey: {
129
+ type: String,
130
+ },
131
+ isRework: {
132
+ type: Boolean,
133
+ },
134
+ reworkCount: {
135
+ type: Number,
136
+ default: 0,
137
+ },
138
+ cameraCount: {
139
+ type: Number,
140
+ },
141
+ // Kickoff failure detail (Mongo-only — the OS job doc may not exist yet).
142
+ queueError: {
143
+ type: String,
144
+ },
145
+ approvedBy: {
146
+ type: mongoose.Types.ObjectId,
147
+ },
148
+ approvedByName: {
149
+ type: String,
150
+ },
151
+ approvedAt: {
152
+ type: Date,
153
+ },
154
+ },
103
155
  },
104
156
  {
105
157
  strict: true,