tango-api-schema 2.6.66 → 2.6.68

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'
@@ -132,6 +133,7 @@ import audioStaticValueModel from "./schema/audioStaticValue.model.js";
132
133
  import recurringFlagTrackerModel from "./schema/recurringFlagTracker.model.js";
133
134
  import regionKeyModel from "./schema/regionKey.model.js";
134
135
  import lookPlanoCollectionModel from "./schema/lookPlanoCollection.model.js";
136
+ import lookLibraryModel from "./schema/lookLibrary.model.js";
135
137
 
136
138
 
137
139
  export default {
@@ -246,6 +248,7 @@ export default {
246
248
  eyeTestConfigurationModel,
247
249
  copilotMachineConfigModel,
248
250
  findReplaceAiModel,
251
+ cctvPlacementModel,
249
252
  planoDuplicateModel,
250
253
  storeLayoutDuplicateModel,
251
254
  storeFixtureDuplicateModel,
@@ -265,5 +268,6 @@ export default {
265
268
  audioStaticValueModel,
266
269
  recurringFlagTrackerModel,
267
270
  regionKeyModel,
268
- lookPlanoCollectionModel
271
+ lookPlanoCollectionModel,
272
+ lookLibraryModel
269
273
  };
package/package.json CHANGED
@@ -1,28 +1,28 @@
1
- {
2
- "name": "tango-api-schema",
3
- "version": "2.6.66",
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.68",
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 );
@@ -0,0 +1,112 @@
1
+ import mongoose from 'mongoose';
2
+
3
+ const lookLibrarySchema = new mongoose.Schema(
4
+ {
5
+ clientId: {
6
+ type: String,
7
+ required: true,
8
+ },
9
+ // "Looks" column — canonical look name, e.g. 'JJ Icons Slim Non Metal (Eye)'.
10
+ // The '(Eye)' / '(Sun)' suffix is load-bearing: MBQ splits combined look cells on '&'
11
+ // and every part is required to carry it, so never store a look name without it.
12
+ lookName: {
13
+ type: String,
14
+ required: true,
15
+ trim: true,
16
+ },
17
+ // Case/whitespace-normalised lookName ( lowercase, single-spaced ) — the actual join key.
18
+ // PID and header text coming off client sheets varies in case and spacing, so every
19
+ // lookup resolves on this, not on lookName. Controller writes it; see normaliseLookKey.
20
+ lookKey: {
21
+ type: String,
22
+ required: true,
23
+ trim: true,
24
+ lowercase: true,
25
+ },
26
+ // Older / renamed spellings that must still resolve to this look ( PID renames,
27
+ // 'Icon' vs 'Icons' class of typo ). Raw text in aliases, normalised in aliasKeys —
28
+ // query aliasKeys, display aliases.
29
+ aliases: [ String ],
30
+ aliasKeys: [ String ],
31
+ // "Category" column. Always agrees with the name suffix: (Eye) -> eyeframe, (Sun) -> sunglasses.
32
+ category: {
33
+ type: String,
34
+ enum: [ 'eyeframe', 'sunglasses' ],
35
+ },
36
+ // "Brand" column — lineup brand ( Vincent Chase, John Jacobs, Lenskart Air, Hooper... ).
37
+ // Free text, deliberately not an enum: the brand list grows with every lineup drop.
38
+ brand: {
39
+ type: String,
40
+ trim: true,
41
+ },
42
+ // "Band" column — MBQ band. Every look in the first master lands on 'Others'.
43
+ band: {
44
+ type: String,
45
+ trim: true,
46
+ default: 'Others',
47
+ },
48
+ // "Definition" column verbatim, so the master can be re-exported unchanged.
49
+ definition: {
50
+ type: String,
51
+ },
52
+ // Sections parsed out of definition:
53
+ // 'Style & Design: <...> Materials: <...> Fits & Variations: <...>'
54
+ styleAndDesign: {
55
+ type: String,
56
+ },
57
+ materials: {
58
+ type: String,
59
+ },
60
+ fitsAndVariations: {
61
+ type: String,
62
+ },
63
+ summary: {
64
+ type: String,
65
+ },
66
+ // Library presentation / lifecycle — mirrors planoVmDetail.
67
+ imageUrl: {
68
+ type: String,
69
+ },
70
+ sortOrder: {
71
+ type: Number,
72
+ default: 0,
73
+ },
74
+ // Retire a look without deleting it — historical revisions still reference the name.
75
+ isActive: {
76
+ type: Boolean,
77
+ default: true,
78
+ },
79
+ status: {
80
+ type: String,
81
+ enum: [ 'draft', 'complete' ],
82
+ default: 'draft',
83
+ },
84
+ createdBy: {
85
+ type: String,
86
+ },
87
+ createdByName: {
88
+ type: String,
89
+ },
90
+ updatedBy: {
91
+ type: String,
92
+ },
93
+ updatedByName: {
94
+ type: String,
95
+ },
96
+ },
97
+ {
98
+ strict: false,
99
+ versionKey: false,
100
+ timestamps: true,
101
+ },
102
+ );
103
+
104
+ // Indexes — {clientId,lookKey} is the resolve-a-look-by-name path and doubles as the dedupe
105
+ // guard, so it is unique: dedupe the seed before creating it or index build fails.
106
+ // {clientId,aliasKeys} covers the renamed-PID fallback lookup; {clientId,brand,category}
107
+ // covers the library grid's brand/category filters and its default sort.
108
+ lookLibrarySchema.index( { clientId: 1, lookKey: 1 }, { unique: true } );
109
+ lookLibrarySchema.index( { clientId: 1, aliasKeys: 1 } );
110
+ lookLibrarySchema.index( { clientId: 1, brand: 1, category: 1 } );
111
+
112
+ export default mongoose.model( 'lookLibrary', lookLibrarySchema );
@@ -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,