tango-api-schema 2.6.67 → 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
@@ -133,6 +133,7 @@ import audioStaticValueModel from "./schema/audioStaticValue.model.js";
133
133
  import recurringFlagTrackerModel from "./schema/recurringFlagTracker.model.js";
134
134
  import regionKeyModel from "./schema/regionKey.model.js";
135
135
  import lookPlanoCollectionModel from "./schema/lookPlanoCollection.model.js";
136
+ import lookLibraryModel from "./schema/lookLibrary.model.js";
136
137
 
137
138
 
138
139
  export default {
@@ -267,5 +268,6 @@ export default {
267
268
  audioStaticValueModel,
268
269
  recurringFlagTrackerModel,
269
270
  regionKeyModel,
270
- lookPlanoCollectionModel
271
+ lookPlanoCollectionModel,
272
+ lookLibraryModel
271
273
  };
package/package.json CHANGED
@@ -1,28 +1,28 @@
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
- }
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
  }
@@ -1,105 +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 );
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 );
@@ -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);