farmcontrol-ws/src/database/schemas/sales/marketplaceMapping.schema.js
Tom Butcher ae2cefb183
All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
Enhance sales schemas with synchronization fields
- Added `syncHash`, `syncImageHash`, and `marketplaceImageUrls` fields to the `listing`, `listingVariant`, and `marketplaceMapping` schemas to support improved synchronization and image management across marketplaces.
2026-08-29 23:13:46 +01:00

25 lines
658 B
JavaScript

import mongoose from 'mongoose';
const { Schema } = mongoose;
export const MARKETPLACE_MAPPING_STATES = ['pending', 'syncing', 'ready', 'failed'];
export function marketplaceSyncMappingSchema() {
return new Schema(
{
marketplace: { type: Schema.Types.ObjectId, ref: 'marketplace', required: true },
externalReference: { type: String, required: false },
syncHash: { type: String, required: false },
state: {
type: {
type: String,
enum: MARKETPLACE_MAPPING_STATES,
default: 'pending',
},
message: { type: String, required: false },
},
},
{ _id: true }
);
}