repzo 1.0.292 → 1.0.293
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/changelog.md +28 -0
- package/lib/index.d.ts +244 -2
- package/lib/index.js +541 -0
- package/lib/types/index.d.ts +4530 -1
- package/package.json +1 -1
- package/src/index.ts +1270 -0
- package/src/oas/activity-ai-object-detection-session-frame.yaml +600 -0
- package/src/oas/ai-object-detection-assigned-missions.yaml +283 -0
- package/src/oas/ai-object-detection-assignment-rule.yaml +357 -0
- package/src/oas/ai-object-detection-category.yaml +338 -0
- package/src/oas/ai-object-detection-dataset.yaml +342 -0
- package/src/oas/ai-object-detection-detection-settings.yaml +410 -0
- package/src/oas/ai-object-detection-inference.yaml +818 -0
- package/src/oas/ai-object-detection-label-group.yaml +265 -0
- package/src/oas/ai-object-detection-label-report.yaml +366 -0
- package/src/oas/ai-object-detection-label.yaml +395 -0
- package/src/oas/ai-object-detection-metric-result.yaml +734 -0
- package/src/oas/ai-object-detection-metric.yaml +559 -0
- package/src/oas/ai-object-detection-mission-results.yaml +370 -0
- package/src/oas/ai-object-detection-mission-set.yaml +250 -0
- package/src/oas/ai-object-detection-mission.yaml +349 -0
- package/src/oas/ai-object-detection-model-version-epoch.yaml +214 -0
- package/src/oas/ai-object-detection-model-version-train-agent.yaml +88 -0
- package/src/oas/ai-object-detection-model-version.yaml +567 -0
- package/src/oas/ai-object-detection-model.yaml +369 -0
- package/src/oas/ai-object-detection-segment.yaml +301 -0
- package/src/oas/ai-object-detection-session-analysis.yaml +1306 -0
- package/src/oas/ai-object-detection-session-election.yaml +193 -0
- package/src/oas/ai-object-detection-session-insight.yaml +418 -0
- package/src/oas/ai-object-detection-session.yaml +840 -0
- package/src/oas/ai-object-detection-settings.yaml +249 -0
- package/src/oas/ai-object-detection-task.yaml +1007 -0
- package/src/oas/object-detection-analytics-report.yaml +674 -0
- package/src/types/index.ts +5156 -1
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: Repzo API - AI Object Detection Assigned Missions
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: |
|
|
6
|
+
**Assigned missions** — the read the MOBILE APP (and the dashboard's
|
|
7
|
+
assignment SIMULATOR) uses to know which missions apply to a CLIENT and
|
|
8
|
+
whether they are already done in the current interval.
|
|
9
|
+
|
|
10
|
+
**Assignment read** (`GET ?client=<id>[&rep=<id>][&visit=<visit_id>]`,
|
|
11
|
+
or `GET /<client id>` with the same optional `rep` / `visit` params).
|
|
12
|
+
Resolves the enabled assignment rules against that client's attributes
|
|
13
|
+
(tags, area tags, channel, assigned reps, chain, teams) and returns:
|
|
14
|
+
- `rules[]` — every enabled rule with `matched` and PER-CONDITION
|
|
15
|
+
verdicts (the simulator renders exactly why a rule hit or missed),
|
|
16
|
+
plus its `frequency`, its `mission_sets[]` lines (set, set name,
|
|
17
|
+
`requirement_mode`) and the STRICTEST `requirement_mode` of those
|
|
18
|
+
lines.
|
|
19
|
+
- `missions[]` — the missions of the matched rules' sets, each with its
|
|
20
|
+
`requirements[]` (one per matching rule × set line: frequency,
|
|
21
|
+
`requirement_mode`, current window start, completions inside the
|
|
22
|
+
window, satisfied), the STRICTEST `requirement_mode` across them, and
|
|
23
|
+
a rolled-up `done`. A completion = a SUCCESSFUL analysis of one of the
|
|
24
|
+
client's sessions (optionally only the given rep's) whose weighted
|
|
25
|
+
mission score meets the mission's `min_score` (a ZERO score never
|
|
26
|
+
completes). A session STAMPED with the mission it was started from
|
|
27
|
+
credits ONLY that mission — scanning one mission never completes the
|
|
28
|
+
client's others.
|
|
29
|
+
- `business_day` — the CURRENT business day the windows are anchored to,
|
|
30
|
+
`timezone` — the zone it was resolved in, `visit_id` — the visit the
|
|
31
|
+
read is scoped to (or `null`), and `rep_can_redo` — whether the rep in
|
|
32
|
+
context may re-scan a DONE mission.
|
|
33
|
+
|
|
34
|
+
**Windows are BUSINESS days, not calendar days.** `day` = the current
|
|
35
|
+
business day, `week` = the current business week (first day =
|
|
36
|
+
`settings.first_business_day_in_week`), `month` / `quarter` = the current
|
|
37
|
+
month / quarter of business days. Business days are the platform's: the
|
|
38
|
+
rep's open-day stamping context (shift schedule, `end_of_day` cut, time
|
|
39
|
+
zone) when a rep is in scope (`rep` or a rep token), else the company's —
|
|
40
|
+
so "per day" means the same business day the visit and its activities
|
|
41
|
+
carry. A completion's business day is the one stamped on the result (from
|
|
42
|
+
the scan's session), else derived from its time.
|
|
43
|
+
|
|
44
|
+
**`every_visit` and the visit.** Pass `visit` = the DEVICE visit id
|
|
45
|
+
(`visits.visit_id`) the rep is currently in — the same id every activity
|
|
46
|
+
carries — and every_visit demands are scoped to THAT visit: done only when
|
|
47
|
+
a completion stamped with it exists (a completion earlier today in ANOTHER
|
|
48
|
+
visit to the same client leaves the mission due; whatever business day the
|
|
49
|
+
visit spans). No visit lookup happens — the visit may not have synced to
|
|
50
|
+
the server yet. Without `visit` the current business day is the practical
|
|
51
|
+
visit proxy — what older mobiles get. The visit id reaches the results
|
|
52
|
+
through the frame intake (`activity-ai-object-detection-session-frame`
|
|
53
|
+
stamps `visit_id` / `route` / `business_day` on the session) and the
|
|
54
|
+
evaluator (copies them onto every mission result).
|
|
55
|
+
|
|
56
|
+
**Requirement mode is carried, not judged.** `satisfied` and `done`
|
|
57
|
+
count completions regardless of the mode. The MOBILE APP applies the
|
|
58
|
+
mode when deciding whether the rep may END THE VISIT: `not_required`
|
|
59
|
+
blocks nothing, `submission_required` needs a scan submitted for the
|
|
60
|
+
mission during the visit, `completion_required` needs `done`. A mission
|
|
61
|
+
reached through several rules/sets carries the strictest mode.
|
|
62
|
+
|
|
63
|
+
The flat RESULTS LISTING lives in its own service —
|
|
64
|
+
`/ai-object-detection-mission-results` — so this read stays the lean
|
|
65
|
+
per-client one the mobile hits on every visit.
|
|
66
|
+
|
|
67
|
+
Everything is computed on read from current definitions + stored metric
|
|
68
|
+
results — rule/frequency edits and recalculations reflect immediately;
|
|
69
|
+
nothing is stamped on clients or sessions. NOT paginated. Read-only
|
|
70
|
+
(create/update/patch/remove are rejected with 400). Rep- and admin-facing.
|
|
71
|
+
servers:
|
|
72
|
+
- url: https://sv.api.repzo.me
|
|
73
|
+
security:
|
|
74
|
+
- ApiKeyAuth: []
|
|
75
|
+
- JwtAuth: []
|
|
76
|
+
paths:
|
|
77
|
+
/ai-object-detection-assigned-missions:
|
|
78
|
+
get:
|
|
79
|
+
summary: Assigned missions for a client
|
|
80
|
+
operationId: findAiObjectDetectionAssignedMissions
|
|
81
|
+
parameters:
|
|
82
|
+
- in: query
|
|
83
|
+
name: client
|
|
84
|
+
required: true
|
|
85
|
+
description: "Client `_id` — required (400 when missing, invalid or not found in the caller's namespace)."
|
|
86
|
+
schema: { type: string }
|
|
87
|
+
- in: query
|
|
88
|
+
name: rep
|
|
89
|
+
description: "Optional rep `_id` — completions count only that rep's sessions, and the rep's business-day context (shift, end_of_day, time zone) and `rep_can_redo_object_detection_missions` permission apply. Defaults to the rep token's rep; with an admin token and no `rep` the company context is used and `rep_can_redo` is true."
|
|
90
|
+
schema: { type: string }
|
|
91
|
+
- in: query
|
|
92
|
+
name: visit
|
|
93
|
+
description: "Optional DEVICE visit id (`visits.visit_id`) of the visit the rep is in. Scopes every_visit demands to that visit (see the introduction). Not looked up — the visit may not have synced yet."
|
|
94
|
+
schema: { type: string }
|
|
95
|
+
responses:
|
|
96
|
+
"200":
|
|
97
|
+
description: The assignment read (a single object — not paginated).
|
|
98
|
+
content:
|
|
99
|
+
application/json:
|
|
100
|
+
schema:
|
|
101
|
+
$ref: "#/components/schemas/AssignmentRead"
|
|
102
|
+
"400":
|
|
103
|
+
description: "`client` missing / not a valid id / not found, `rep` not a valid id, or no namespace in the token."
|
|
104
|
+
/ai-object-detection-assigned-missions/{id}:
|
|
105
|
+
get:
|
|
106
|
+
summary: Assignment read with the id as the client
|
|
107
|
+
operationId: getAiObjectDetectionAssignedMissions
|
|
108
|
+
parameters:
|
|
109
|
+
- in: path
|
|
110
|
+
name: id
|
|
111
|
+
required: true
|
|
112
|
+
description: "Client `_id` — the same read as `GET ?client=<id>`."
|
|
113
|
+
schema: { type: string }
|
|
114
|
+
- in: query
|
|
115
|
+
name: rep
|
|
116
|
+
description: "Optional rep `_id` (same semantics as on the list read)."
|
|
117
|
+
schema: { type: string }
|
|
118
|
+
- in: query
|
|
119
|
+
name: visit
|
|
120
|
+
description: "Optional DEVICE visit id (same semantics as on the list read)."
|
|
121
|
+
schema: { type: string }
|
|
122
|
+
responses:
|
|
123
|
+
"200":
|
|
124
|
+
description: Same shape as the assignment read.
|
|
125
|
+
content:
|
|
126
|
+
application/json:
|
|
127
|
+
schema:
|
|
128
|
+
$ref: "#/components/schemas/AssignmentRead"
|
|
129
|
+
"400":
|
|
130
|
+
description: "Client not found / invalid, `rep` invalid, or no namespace in the token."
|
|
131
|
+
components:
|
|
132
|
+
securitySchemes:
|
|
133
|
+
ApiKeyAuth:
|
|
134
|
+
type: apiKey
|
|
135
|
+
in: header
|
|
136
|
+
name: api-key
|
|
137
|
+
JwtAuth:
|
|
138
|
+
type: apiKey
|
|
139
|
+
in: header
|
|
140
|
+
name: Authorization
|
|
141
|
+
schemas:
|
|
142
|
+
RuleFrequency:
|
|
143
|
+
type: object
|
|
144
|
+
properties:
|
|
145
|
+
interval:
|
|
146
|
+
type: string
|
|
147
|
+
enum: [every_visit, day, week, month, quarter]
|
|
148
|
+
times:
|
|
149
|
+
type: integer
|
|
150
|
+
minimum: 1
|
|
151
|
+
description: "Completions required per interval (1 for every_visit)."
|
|
152
|
+
RequirementMode:
|
|
153
|
+
type: string
|
|
154
|
+
enum: [not_required, submission_required, completion_required]
|
|
155
|
+
description: "What a rule demands of a set's missions: not_required (optional), submission_required (a scan must be submitted, pass or fail), completion_required (the scan must complete the mission). Carried by the backend, enforced by the mobile app when the rep ends the visit."
|
|
156
|
+
AssignmentRead:
|
|
157
|
+
type: object
|
|
158
|
+
properties:
|
|
159
|
+
client:
|
|
160
|
+
type: object
|
|
161
|
+
properties:
|
|
162
|
+
_id: { type: string }
|
|
163
|
+
name: { type: string }
|
|
164
|
+
rep:
|
|
165
|
+
type: string
|
|
166
|
+
nullable: true
|
|
167
|
+
description: "The `rep` query param echoed back — null when not sent."
|
|
168
|
+
rep_can_redo:
|
|
169
|
+
type: boolean
|
|
170
|
+
description: 'The rep''s `rep_can_redo_object_detection_missions` permission (default false) — the mobile disables "SCAN THIS MISSION" on DONE rows unless true. Always true when no rep is in context (admin simulator).'
|
|
171
|
+
timezone:
|
|
172
|
+
type: string
|
|
173
|
+
description: IANA time zone the business day was resolved in.
|
|
174
|
+
business_day:
|
|
175
|
+
type: string
|
|
176
|
+
description: "The CURRENT business day (`YYYY-MM-DD`) the windows are anchored to — the rep's stamping context when a rep is in scope, else the company's."
|
|
177
|
+
visit_id:
|
|
178
|
+
type: string
|
|
179
|
+
nullable: true
|
|
180
|
+
description: "The device visit id the read is scoped to — null when `visit` was not sent."
|
|
181
|
+
rules:
|
|
182
|
+
type: array
|
|
183
|
+
description: Every enabled rule with per-condition verdicts (simulator food).
|
|
184
|
+
items:
|
|
185
|
+
type: object
|
|
186
|
+
properties:
|
|
187
|
+
_id: { type: string }
|
|
188
|
+
name: { type: string }
|
|
189
|
+
mission_sets:
|
|
190
|
+
type: array
|
|
191
|
+
description: The sets the rule assigns, each with its demand.
|
|
192
|
+
items:
|
|
193
|
+
type: object
|
|
194
|
+
properties:
|
|
195
|
+
mission_set: { type: string }
|
|
196
|
+
set_name:
|
|
197
|
+
type: string
|
|
198
|
+
description: Absent when the set is disabled / deleted.
|
|
199
|
+
requirement_mode:
|
|
200
|
+
$ref: "#/components/schemas/RequirementMode"
|
|
201
|
+
requirement_mode:
|
|
202
|
+
allOf:
|
|
203
|
+
- $ref: "#/components/schemas/RequirementMode"
|
|
204
|
+
description: "The STRICTEST of the rule's `mission_sets[]` lines."
|
|
205
|
+
matched:
|
|
206
|
+
type: boolean
|
|
207
|
+
description: "Every condition line holds (AND); zero lines = true."
|
|
208
|
+
frequency:
|
|
209
|
+
$ref: "#/components/schemas/RuleFrequency"
|
|
210
|
+
conditions:
|
|
211
|
+
type: array
|
|
212
|
+
items:
|
|
213
|
+
type: object
|
|
214
|
+
properties:
|
|
215
|
+
key:
|
|
216
|
+
type: string
|
|
217
|
+
enum:
|
|
218
|
+
[
|
|
219
|
+
client,
|
|
220
|
+
client_tag,
|
|
221
|
+
client_channel,
|
|
222
|
+
assigned_to,
|
|
223
|
+
chain,
|
|
224
|
+
area_tag,
|
|
225
|
+
team,
|
|
226
|
+
]
|
|
227
|
+
operator:
|
|
228
|
+
type: string
|
|
229
|
+
enum: [in, nin]
|
|
230
|
+
value:
|
|
231
|
+
type: array
|
|
232
|
+
items: { type: string }
|
|
233
|
+
matched: { type: boolean }
|
|
234
|
+
missions:
|
|
235
|
+
type: array
|
|
236
|
+
description: The ASSIGNED missions only (via matched rules' sets), sorted by name.
|
|
237
|
+
items:
|
|
238
|
+
type: object
|
|
239
|
+
properties:
|
|
240
|
+
_id: { type: string }
|
|
241
|
+
name: { type: string }
|
|
242
|
+
min_score:
|
|
243
|
+
type: number
|
|
244
|
+
description: "0..1 — the weighted mission score a scan must reach to complete the mission."
|
|
245
|
+
category:
|
|
246
|
+
type: string
|
|
247
|
+
description: "Optional detection category — stamp it on the session started FROM this mission (`session.category`) so the pipeline auto-analyzes it."
|
|
248
|
+
category_name: { type: string }
|
|
249
|
+
via_sets:
|
|
250
|
+
type: array
|
|
251
|
+
description: Names of the matched sets that carry this mission.
|
|
252
|
+
items: { type: string }
|
|
253
|
+
requirement_mode:
|
|
254
|
+
allOf:
|
|
255
|
+
- $ref: "#/components/schemas/RequirementMode"
|
|
256
|
+
description: "The STRICTEST demand across `requirements[]` — what the mobile enforces when the rep ends the visit; not_required means the mission is optional here."
|
|
257
|
+
requirements:
|
|
258
|
+
type: array
|
|
259
|
+
description: One demand per matching rule × set line.
|
|
260
|
+
items:
|
|
261
|
+
type: object
|
|
262
|
+
properties:
|
|
263
|
+
rule: { type: string }
|
|
264
|
+
rule_name: { type: string }
|
|
265
|
+
set: { type: string }
|
|
266
|
+
set_name: { type: string }
|
|
267
|
+
frequency:
|
|
268
|
+
$ref: "#/components/schemas/RuleFrequency"
|
|
269
|
+
requirement_mode:
|
|
270
|
+
$ref: "#/components/schemas/RequirementMode"
|
|
271
|
+
window_start:
|
|
272
|
+
type: number
|
|
273
|
+
nullable: true
|
|
274
|
+
description: "Start (ms) of the first BUSINESS day of the demand's current window. null for a visit-scoped every_visit demand (matched by visit, not by time)."
|
|
275
|
+
completions:
|
|
276
|
+
type: number
|
|
277
|
+
description: "Completions whose business day falls inside the window — for a visit-scoped every_visit demand, the completions stamped with that visit id."
|
|
278
|
+
satisfied:
|
|
279
|
+
type: boolean
|
|
280
|
+
description: "completions ≥ frequency.times (a visit-scoped every_visit demand: ≥ 1) — regardless of requirement_mode."
|
|
281
|
+
done:
|
|
282
|
+
type: boolean
|
|
283
|
+
description: "Every requirement satisfied (every_visit: completed during the scoped visit, or in the current business day when no visit is given) — mode-agnostic; the mobile combines it with requirement_mode."
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
openapi: 3.0.3
|
|
2
|
+
info:
|
|
3
|
+
title: Repzo API - AI Object Detection Assignment Rule
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
description: |
|
|
6
|
+
**Assignment rules** attach one or more mission SETS to clients, built
|
|
7
|
+
line by line:
|
|
8
|
+
each condition is `key` / `operator` / `value` (ids), ALL lines must hold
|
|
9
|
+
(AND) — every added line narrows the audience. ZERO lines = the set
|
|
10
|
+
applies to every client. Keys: `client` (client ids), `client_tag`
|
|
11
|
+
(client-type Tag ids), `area_tag` (area-type Tag ids — both tag kinds
|
|
12
|
+
live in the client's `tags` array), `client_channel` (client-channel
|
|
13
|
+
ids), `assigned_to` (rep ids — matches when the client is assigned to
|
|
14
|
+
any of them), `chain` (chain-client ids, i.e. clients with
|
|
15
|
+
`isChain: true` — matches the client's `chain` ref), `team` (team ids on
|
|
16
|
+
the client). Operators: `in` (any overlap), `nin` (no overlap — a client
|
|
17
|
+
missing the attribute passes `nin` and fails `in`).
|
|
18
|
+
|
|
19
|
+
**Frequency.** Each rule carries how often its set is DEMANDED:
|
|
20
|
+
`every_visit` (default — due on every visit, never pre-completed) or
|
|
21
|
+
`times` completions per `day` / `week` / `month` / `quarter` (company
|
|
22
|
+
timezone). The assigned-missions read uses it to mark missions `done`
|
|
23
|
+
within the current interval.
|
|
24
|
+
|
|
25
|
+
**Mission sets & requirement mode.** `mission_sets` is an array of
|
|
26
|
+
lines — `{ mission_set, requirement_mode }`, at least one, each set
|
|
27
|
+
listed once. `requirement_mode` says what the rule DEMANDS of that set's
|
|
28
|
+
missions at the client: `not_required` (optional — available to scan,
|
|
29
|
+
nothing demanded), `submission_required` (default — a scan must be
|
|
30
|
+
SUBMITTED, i.e. a session analyzed for the mission, pass or fail) or
|
|
31
|
+
`completion_required` (the submitted scan must COMPLETE the mission,
|
|
32
|
+
weighted score ≥ `min_score`). The backend CARRIES the mode —
|
|
33
|
+
the assigned-missions read turns each line into a per-mission
|
|
34
|
+
requirement, reports the STRICTEST mode per rule and per mission, and
|
|
35
|
+
keeps `done` counting completions; the MOBILE APP enforces the mode when
|
|
36
|
+
the rep ends the visit. `mission_sets` is REQUIRED on write — the
|
|
37
|
+
pre-array single `mission_set` key is not accepted (every stored rule
|
|
38
|
+
carries `mission_sets`; filter by set with `mission_sets.mission_set`).
|
|
39
|
+
|
|
40
|
+
Resolution happens at read time (mission `scores_for` and
|
|
41
|
+
`/ai-object-detection-assigned-missions`) — rules are never stamped onto
|
|
42
|
+
clients, so editing a rule re-targets instantly.
|
|
43
|
+
|
|
44
|
+
**Writes are re-validated in full.** `PUT` runs the same validation as
|
|
45
|
+
`POST`: `mission_sets` must be sent again, an omitted `conditions` resets
|
|
46
|
+
the rule to "every client" and an omitted `frequency` resets it to
|
|
47
|
+
`every_visit`; every violation is reported in one 400. `PATCH` is
|
|
48
|
+
rejected (400 — use update). `DELETE` soft-deletes (`disabled: true`,
|
|
49
|
+
`editor` stamped) and returns the row. The list returns active AND
|
|
50
|
+
soft-deleted rows unless `disabled=false` is passed, and is always ordered
|
|
51
|
+
by `_id` descending. `creator` / `editor` are stamped from the caller's
|
|
52
|
+
token.
|
|
53
|
+
|
|
54
|
+
Scoped by `company_namespace` (single-namespace token required for
|
|
55
|
+
create / update), soft-deleted via `disabled`. Admin-facing.
|
|
56
|
+
servers:
|
|
57
|
+
- url: https://sv.api.repzo.me
|
|
58
|
+
security:
|
|
59
|
+
- ApiKeyAuth: []
|
|
60
|
+
- JwtAuth: []
|
|
61
|
+
paths:
|
|
62
|
+
/ai-object-detection-assignment-rule:
|
|
63
|
+
get:
|
|
64
|
+
summary: List assignment rules
|
|
65
|
+
operationId: findAssignmentRule
|
|
66
|
+
parameters:
|
|
67
|
+
- in: query
|
|
68
|
+
name: _id
|
|
69
|
+
description: "Filter by document `_id`. Pass once or as `?_id[]=...` for multiple."
|
|
70
|
+
schema:
|
|
71
|
+
oneOf:
|
|
72
|
+
- type: string
|
|
73
|
+
- type: array
|
|
74
|
+
items: { type: string }
|
|
75
|
+
- in: query
|
|
76
|
+
name: name
|
|
77
|
+
description: Exact name match (one or many).
|
|
78
|
+
schema:
|
|
79
|
+
oneOf:
|
|
80
|
+
- type: string
|
|
81
|
+
- type: array
|
|
82
|
+
items: { type: string }
|
|
83
|
+
- in: query
|
|
84
|
+
name: enabled
|
|
85
|
+
schema: { type: boolean }
|
|
86
|
+
- in: query
|
|
87
|
+
name: mission_sets.mission_set
|
|
88
|
+
description: "Filter by a targeted mission set id — matches rules whose `mission_sets` list it (the array path; there is no `mission_set` filter). One or many."
|
|
89
|
+
schema:
|
|
90
|
+
oneOf:
|
|
91
|
+
- type: string
|
|
92
|
+
- type: array
|
|
93
|
+
items: { type: string }
|
|
94
|
+
- in: query
|
|
95
|
+
name: search
|
|
96
|
+
description: "Case-insensitive regex search on `name`."
|
|
97
|
+
schema: { type: string }
|
|
98
|
+
- in: query
|
|
99
|
+
name: disabled
|
|
100
|
+
description: "Omit to get active AND soft-deleted rows; `false` = active only; `true` = soft-deleted only."
|
|
101
|
+
schema: { type: boolean }
|
|
102
|
+
- in: query
|
|
103
|
+
name: from_updatedAt
|
|
104
|
+
description: "ms epoch (or date string). Snapped to the start of that day in the company time zone unless `exact_time=true`."
|
|
105
|
+
schema: { type: number }
|
|
106
|
+
- in: query
|
|
107
|
+
name: to_updatedAt
|
|
108
|
+
description: "ms epoch (or date string). Snapped to the end of that day unless `exact_time=true`."
|
|
109
|
+
schema: { type: number }
|
|
110
|
+
- in: query
|
|
111
|
+
name: from_createdAt
|
|
112
|
+
schema: { type: number }
|
|
113
|
+
- in: query
|
|
114
|
+
name: to_createdAt
|
|
115
|
+
schema: { type: number }
|
|
116
|
+
- in: query
|
|
117
|
+
name: exact_time
|
|
118
|
+
description: "Use the exact instants of the `from_*` / `to_*` bounds instead of whole days."
|
|
119
|
+
schema: { type: boolean }
|
|
120
|
+
- in: query
|
|
121
|
+
name: per_page
|
|
122
|
+
schema: { type: integer, minimum: 1 }
|
|
123
|
+
- in: query
|
|
124
|
+
name: page
|
|
125
|
+
schema: { type: integer, minimum: 1, default: 1 }
|
|
126
|
+
responses:
|
|
127
|
+
"200":
|
|
128
|
+
description: "Paginated documents, ordered by `_id` descending (`sort` / `sortPageOrder` are ignored)."
|
|
129
|
+
content:
|
|
130
|
+
application/json:
|
|
131
|
+
schema:
|
|
132
|
+
$ref: "#/components/schemas/PaginatedAssignmentRules"
|
|
133
|
+
post:
|
|
134
|
+
summary: Create an assignment rule
|
|
135
|
+
operationId: createAssignmentRule
|
|
136
|
+
requestBody:
|
|
137
|
+
required: true
|
|
138
|
+
content:
|
|
139
|
+
application/json:
|
|
140
|
+
schema:
|
|
141
|
+
$ref: "#/components/schemas/AssignmentRuleCreate"
|
|
142
|
+
responses:
|
|
143
|
+
"201":
|
|
144
|
+
description: "The created document (`creator` stamped, `frequency` / `mission_sets` normalized)."
|
|
145
|
+
content:
|
|
146
|
+
application/json:
|
|
147
|
+
schema:
|
|
148
|
+
$ref: "#/components/schemas/AssignmentRule"
|
|
149
|
+
"400":
|
|
150
|
+
description: "Validation failed — the message lists every violation (`errors[]` in the error data). Also returned when the token spans several namespaces."
|
|
151
|
+
/ai-object-detection-assignment-rule/{id}:
|
|
152
|
+
get:
|
|
153
|
+
summary: Get an assignment rule
|
|
154
|
+
operationId: getAssignmentRule
|
|
155
|
+
parameters:
|
|
156
|
+
- in: path
|
|
157
|
+
name: id
|
|
158
|
+
required: true
|
|
159
|
+
schema: { type: string }
|
|
160
|
+
responses:
|
|
161
|
+
"200":
|
|
162
|
+
description: The document.
|
|
163
|
+
content:
|
|
164
|
+
application/json:
|
|
165
|
+
schema:
|
|
166
|
+
$ref: "#/components/schemas/AssignmentRule"
|
|
167
|
+
"400":
|
|
168
|
+
description: "No rule with that id in the caller's namespace (the backend answers 400, not 404)."
|
|
169
|
+
put:
|
|
170
|
+
summary: Update an assignment rule (re-validated in full)
|
|
171
|
+
operationId: updateAssignmentRule
|
|
172
|
+
parameters:
|
|
173
|
+
- in: path
|
|
174
|
+
name: id
|
|
175
|
+
required: true
|
|
176
|
+
schema: { type: string }
|
|
177
|
+
requestBody:
|
|
178
|
+
required: true
|
|
179
|
+
content:
|
|
180
|
+
application/json:
|
|
181
|
+
schema:
|
|
182
|
+
$ref: "#/components/schemas/AssignmentRuleUpdate"
|
|
183
|
+
responses:
|
|
184
|
+
"200":
|
|
185
|
+
description: "The updated document (`editor` stamped)."
|
|
186
|
+
content:
|
|
187
|
+
application/json:
|
|
188
|
+
schema:
|
|
189
|
+
$ref: "#/components/schemas/AssignmentRule"
|
|
190
|
+
"400":
|
|
191
|
+
description: Validation failed — the message lists every violation.
|
|
192
|
+
"404":
|
|
193
|
+
description: No rule with that id.
|
|
194
|
+
delete:
|
|
195
|
+
summary: Soft-delete an assignment rule
|
|
196
|
+
operationId: removeAssignmentRule
|
|
197
|
+
parameters:
|
|
198
|
+
- in: path
|
|
199
|
+
name: id
|
|
200
|
+
required: true
|
|
201
|
+
schema: { type: string }
|
|
202
|
+
responses:
|
|
203
|
+
"200":
|
|
204
|
+
description: "The disabled document (`disabled: true`, `editor` stamped)."
|
|
205
|
+
content:
|
|
206
|
+
application/json:
|
|
207
|
+
schema:
|
|
208
|
+
$ref: "#/components/schemas/AssignmentRule"
|
|
209
|
+
"404":
|
|
210
|
+
description: No rule with that id.
|
|
211
|
+
components:
|
|
212
|
+
securitySchemes:
|
|
213
|
+
ApiKeyAuth:
|
|
214
|
+
type: apiKey
|
|
215
|
+
in: header
|
|
216
|
+
name: api-key
|
|
217
|
+
JwtAuth:
|
|
218
|
+
type: apiKey
|
|
219
|
+
in: header
|
|
220
|
+
name: Authorization
|
|
221
|
+
schemas:
|
|
222
|
+
RuleMissionSet:
|
|
223
|
+
type: object
|
|
224
|
+
required: [mission_set]
|
|
225
|
+
properties:
|
|
226
|
+
mission_set:
|
|
227
|
+
type: string
|
|
228
|
+
description: The mission set id.
|
|
229
|
+
requirement_mode:
|
|
230
|
+
type: string
|
|
231
|
+
enum: [not_required, submission_required, completion_required]
|
|
232
|
+
default: submission_required
|
|
233
|
+
description: "What the rule demands of this set's missions at the client: not_required (optional), submission_required (a scan must be submitted, pass or fail), completion_required (the scan must complete the mission)."
|
|
234
|
+
RuleCondition:
|
|
235
|
+
type: object
|
|
236
|
+
required: [key, operator, value]
|
|
237
|
+
properties:
|
|
238
|
+
_id:
|
|
239
|
+
type: string
|
|
240
|
+
description: Subdocument id — server-generated on stored rows, ignored on input.
|
|
241
|
+
key:
|
|
242
|
+
type: string
|
|
243
|
+
enum:
|
|
244
|
+
[
|
|
245
|
+
client,
|
|
246
|
+
client_tag,
|
|
247
|
+
client_channel,
|
|
248
|
+
assigned_to,
|
|
249
|
+
chain,
|
|
250
|
+
area_tag,
|
|
251
|
+
team,
|
|
252
|
+
]
|
|
253
|
+
operator:
|
|
254
|
+
type: string
|
|
255
|
+
enum: [in, nin]
|
|
256
|
+
value:
|
|
257
|
+
type: array
|
|
258
|
+
minItems: 1
|
|
259
|
+
items: { type: string }
|
|
260
|
+
description: "Ids matching the key: clients / client-type tags / channels / reps / chain clients (isChain) / area-type tags / teams."
|
|
261
|
+
RuleFrequency:
|
|
262
|
+
type: object
|
|
263
|
+
description: "How often the set is demanded. Absent = every_visit."
|
|
264
|
+
properties:
|
|
265
|
+
interval:
|
|
266
|
+
type: string
|
|
267
|
+
enum: [every_visit, day, week, month, quarter]
|
|
268
|
+
default: every_visit
|
|
269
|
+
times:
|
|
270
|
+
type: integer
|
|
271
|
+
minimum: 1
|
|
272
|
+
default: 1
|
|
273
|
+
description: "Completions required per interval (pinned to 1 for every_visit)."
|
|
274
|
+
UserStamp:
|
|
275
|
+
type: object
|
|
276
|
+
description: "Who created / last edited the row — taken from the caller's token."
|
|
277
|
+
properties:
|
|
278
|
+
_id: { type: string }
|
|
279
|
+
type:
|
|
280
|
+
type: string
|
|
281
|
+
enum: [admin, rep, client, tenant]
|
|
282
|
+
name: { type: string }
|
|
283
|
+
admin: { type: string }
|
|
284
|
+
rep: { type: string }
|
|
285
|
+
client: { type: string }
|
|
286
|
+
tenant: { type: string }
|
|
287
|
+
AssignmentRuleWrite:
|
|
288
|
+
type: object
|
|
289
|
+
required: [mission_sets]
|
|
290
|
+
properties:
|
|
291
|
+
name: { type: string }
|
|
292
|
+
mission_sets:
|
|
293
|
+
type: array
|
|
294
|
+
minItems: 1
|
|
295
|
+
description: "REQUIRED on every write. The mission sets this rule assigns, one line per set (a set may appear once)."
|
|
296
|
+
items:
|
|
297
|
+
$ref: "#/components/schemas/RuleMissionSet"
|
|
298
|
+
conditions:
|
|
299
|
+
type: array
|
|
300
|
+
description: "AND-ed lines; empty or omitted = applies to every client."
|
|
301
|
+
items:
|
|
302
|
+
$ref: "#/components/schemas/RuleCondition"
|
|
303
|
+
frequency:
|
|
304
|
+
$ref: "#/components/schemas/RuleFrequency"
|
|
305
|
+
enabled: { type: boolean, default: true }
|
|
306
|
+
AssignmentRuleCreate:
|
|
307
|
+
allOf:
|
|
308
|
+
- $ref: "#/components/schemas/AssignmentRuleWrite"
|
|
309
|
+
- type: object
|
|
310
|
+
required: [name]
|
|
311
|
+
properties:
|
|
312
|
+
company_namespace:
|
|
313
|
+
type: array
|
|
314
|
+
items: { type: string }
|
|
315
|
+
description: Optional tenant namespace override for SDK callers.
|
|
316
|
+
AssignmentRuleUpdate:
|
|
317
|
+
allOf:
|
|
318
|
+
- $ref: "#/components/schemas/AssignmentRuleWrite"
|
|
319
|
+
- type: object
|
|
320
|
+
description: "Full re-validation: `mission_sets` is required again; an omitted `conditions` resets to every client and an omitted `frequency` resets to every_visit."
|
|
321
|
+
properties:
|
|
322
|
+
disabled:
|
|
323
|
+
type: boolean
|
|
324
|
+
description: "Set `true` to soft-delete through the update (same effect as DELETE)."
|
|
325
|
+
AssignmentRule:
|
|
326
|
+
allOf:
|
|
327
|
+
- $ref: "#/components/schemas/AssignmentRuleWrite"
|
|
328
|
+
- type: object
|
|
329
|
+
properties:
|
|
330
|
+
_id: { type: string }
|
|
331
|
+
disabled: { type: boolean }
|
|
332
|
+
creator:
|
|
333
|
+
$ref: "#/components/schemas/UserStamp"
|
|
334
|
+
editor:
|
|
335
|
+
$ref: "#/components/schemas/UserStamp"
|
|
336
|
+
company_namespace:
|
|
337
|
+
type: array
|
|
338
|
+
items: { type: string }
|
|
339
|
+
createdAt: { type: string, format: date-time }
|
|
340
|
+
updatedAt: { type: string, format: date-time }
|
|
341
|
+
PaginatedAssignmentRules:
|
|
342
|
+
type: object
|
|
343
|
+
properties:
|
|
344
|
+
total_result: { type: integer }
|
|
345
|
+
current_count: { type: integer }
|
|
346
|
+
total_pages: { type: integer }
|
|
347
|
+
current_page: { type: integer }
|
|
348
|
+
per_page: { type: integer }
|
|
349
|
+
first_page_url: { type: string }
|
|
350
|
+
last_page_url: { type: string }
|
|
351
|
+
next_page_url: { type: string, nullable: true }
|
|
352
|
+
prev_page_url: { type: string, nullable: true }
|
|
353
|
+
path: { type: string }
|
|
354
|
+
data:
|
|
355
|
+
type: array
|
|
356
|
+
items:
|
|
357
|
+
$ref: "#/components/schemas/AssignmentRule"
|