All checks were successful
farmcontrol/farmcontrol-ws/pipeline/head This commit looks good
- Added `syncHash`, `syncImageHash`, and `marketplaceImageUrls` fields to the `listing`, `listingVariant`, and `marketplaceMapping` schemas to support improved synchronization and image management across marketplaces.
25 lines
658 B
JavaScript
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 }
|
|
);
|
|
}
|