CouponsIndexDocumentDeletedPayload coupons.index_document.deleted@1
Generated at from
openvibe-contracts v0.34.2 and
openvibe-sdk v0.5.0.
- Version
- 1.0.0
- Owner
- coupons
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/events/payloads/coupons.index_document.deleted.v1.json
coupons.index_document.deleted v1 (OpenVibe.Coupons server/domain/publication.js sendDocument, via openvibe-publishing/index-hooks indexEvent). A Search tombstone: the code left active results (expired, disabled, its merchant disabled) or the merchant is no longer active, so Search drops it at this revision or older. Only sent for a resource Search was sent before: a code or merchant that was never indexed gets no tombstone. Consumed by OpenVibe.Search ('*.index_document.*'). Envelope: subject { type: coupon | merchant, id, revision }, visibility internal, priority important, actor service:coupons.
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
type | enum | yes |
| |
id | string | yes |
| |
revision | integer | yes | Index revision of the tombstone; wins over any document at the same or an older revision. |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: coupon
{
"type": "coupon",
"id": "cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"revision": 3
}Valid: merchant
{
"type": "merchant",
"id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
"revision": 5
}Rejected: bad-id
{
"type": "coupon",
"id": "TRAIL15",
"revision": 3
}Rejected: full-document
{
"owner": "coupons",
"type": "coupon",
"id": "cpn_01K5R8Z3Q4M2N7P9T1V6W8X0YA",
"revision": 3,
"deleted": true
}Rejected: revision-zero
{
"type": "merchant",
"id": "mer_01K5R7A1B2C3D4E5F6G7H8J9KM",
"revision": 0
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('coupons.index_document.deleted@1', value); // { valid, errors: [{ path, message }] }